diff --git a/README.rst b/README.rst index 6eb0991..0c645f7 100644 --- a/README.rst +++ b/README.rst @@ -1,16 +1,11 @@ -Pylibemu |travis badge| |landscape badge| |downloads badge| |version badge| +Pylibemu |version badge| |downloads badge| ============================================================================ -.. |travis badge| image:: https://img.shields.io/travis/buffer/pylibemu/master.svg - :target: https://travis-ci.org/buffer/pylibemu -.. |landscape badge| image:: https://landscape.io/github/buffer/pylibemu/master/landscape.png - :target: https://landscape.io/github/buffer/pylibemu/master - :alt: Code Health -.. |downloads badge| image:: https://img.shields.io/pypi/dm/pylibemu.svg - :target: https://pypi.python.org/pypi/pylibemu/ .. |version badge| image:: https://img.shields.io/pypi/v/pylibemu.svg :target: https://pypi.python.org/pypi/pylibemu/ +.. |downloads badge| image:: https://img.shields.io/pypi/dm/pylibemu.svg + :target: https://pypi.python.org/pypi/pylibemu/ Pylibemu is a wrapper for the Libemu library (https://github.com/buffer/libemu). @@ -202,6 +197,6 @@ method and subsequently run the shellcode emulation test again as shown above. License information =================== -Copyright (C) 2011-2022 Angelo Dell'Aera +Copyright (C) 2011-2023 Angelo Dell'Aera License: GNU General Public License, version 2 diff --git a/setup.py b/setup.py index 63aec70..e269294 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ setup( name = "pylibemu", packages = [], - version = "0.8", + version = "1.0", description = "Libemu Python wrapper", url = "https://github.com/buffer/pylibemu", author = "Angelo Dell'Aera", diff --git a/src/pylibemu.c b/src/pylibemu.c index 6dc3a7f..b07f53e 100644 --- a/src/pylibemu.c +++ b/src/pylibemu.c @@ -1,22 +1,72 @@ -/* Generated by Cython 0.29.32 */ +/* Generated by Cython 3.0.6 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [], + "libraries": [ + "emu" + ], + "name": "pylibemu", + "sources": [ + "src/pylibemu.pyx" + ] + }, + "module_name": "pylibemu" +} +END: Cython Metadata */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN #endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #endif +#endif + #include "Python.h" + + #if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj) + #else + #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj, NULL) + #endif + + + #if PY_MAJOR_VERSION <= 2 + #define PyDict_GetItemWithError _PyDict_GetItemWithError + #endif + + + #if (PY_VERSION_HEX < 0x030700b1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600)) && !defined(PyContextVar_Get) + #define PyContextVar_Get(var, d, v) ((d) ? ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) : ((v)[0] = NULL, 0) ) + #endif + #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.6+ or Python 3.3+. +#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. +#else +#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" #else -#define CYTHON_ABI "0_29_32" -#define CYTHON_HEX_VERSION 0x001D20F0 +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_6" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030006F0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif -#if !defined(WIN32) && !defined(MS_WINDOWS) +#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif @@ -35,9 +85,7 @@ #endif #define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x02070000 - #define HAVE_LONG_LONG - #endif + #define HAVE_LONG_LONG #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG @@ -45,13 +93,19 @@ #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 +#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX +#if defined(GRAALVM_PYTHON) + /* For very preliminary testing purposes. Most variables are set the same as PyPy. + The existence of this section does not imply that anything works or is even tested */ + #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 1 #define CYTHON_COMPILING_IN_NOGIL 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #if PY_VERSION_HEX < 0x03050000 @@ -76,10 +130,19 @@ #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 #undef CYTHON_USE_DICT_VERSIONS @@ -87,46 +150,123 @@ #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_HEX >= 0x07030900) + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 +#elif defined(PYPY_VERSION) + #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) + #endif + #if PY_VERSION_HEX < 0x03090000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif +#elif defined(CYTHON_LIMITED_API) + #ifdef Py_LIMITED_API + #undef __PYX_LIMITED_VERSION_HEX + #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API + #endif + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 1 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #undef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 1 #undef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL 0 + #undef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif #undef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT 0 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #endif #undef CYTHON_USE_DICT_VERSIONS #define CYTHON_USE_DICT_VERSIONS 0 #undef CYTHON_USE_EXC_INFO_STACK @@ -134,10 +274,11 @@ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 #endif -#elif defined(PY_NOGIL) +#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL) #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 @@ -181,16 +322,17 @@ #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 #define CYTHON_COMPILING_IN_NOGIL 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #ifndef CYTHON_USE_PYTYPE_LOOKUP #define CYTHON_USE_PYTYPE_LOOKUP 1 #endif #if PY_MAJOR_VERSION < 3 @@ -199,10 +341,7 @@ #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) + #ifndef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS @@ -226,29 +365,47 @@ #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif - #if PY_VERSION_HEX >= 0x030B00A4 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #elif !defined(CYTHON_FAST_THREAD_STATE) + #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000) + #define CYTHON_FAST_PYCALL 1 #endif - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 #endif - #ifndef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #if PY_VERSION_HEX < 0x030600B1 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #elif !defined(CYTHON_USE_DICT_VERSIONS) + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) #endif - #if PY_VERSION_HEX >= 0x030B00A4 + #if PY_VERSION_HEX < 0x030700A3 #undef CYTHON_USE_EXC_INFO_STACK #define CYTHON_USE_EXC_INFO_STACK 0 #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #define CYTHON_USE_EXC_INFO_STACK 1 #endif #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 @@ -257,6 +414,10 @@ #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) #if CYTHON_USE_PYLONG_INTERNALS #if PY_MAJOR_VERSION < 3 #include "longintrepr.h" @@ -285,6 +446,17 @@ #define CYTHON_RESTRICT #endif #endif +#ifndef CYTHON_UNUSED + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(maybe_unused) + #define CYTHON_UNUSED [[maybe_unused]] + #endif + #endif + #endif +#endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) @@ -298,13 +470,16 @@ # define CYTHON_UNUSED # endif #endif -#ifndef CYTHON_MAYBE_UNUSED_VAR +#ifndef CYTHON_UNUSED_VAR # if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } + template void CYTHON_UNUSED_VAR( const T& ) { } # else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# define CYTHON_UNUSED_VAR(x) (void)(x) # endif #endif +#ifndef CYTHON_MAYBE_UNUSED_VAR + #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) +#endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED @@ -312,28 +487,59 @@ # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif +#ifndef CYTHON_USE_CPP_STD_MOVE + #if defined(__cplusplus) && (\ + __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) + #define CYTHON_USE_CPP_STD_MOVE 1 + #else + #define CYTHON_USE_CPP_STD_MOVE 0 + #endif +#endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifdef _MSC_VER #ifndef _MSC_STDINT_H_ #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned int uint32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int32 uint32_t; + typedef unsigned __int32 __pyx_uintptr_t; #endif #endif #else - #include + #include + typedef uintptr_t __pyx_uintptr_t; #endif #ifndef CYTHON_FALLTHROUGH - #if defined(__cplusplus) && __cplusplus >= 201103L - #if __has_cpp_attribute(fallthrough) - #define CYTHON_FALLTHROUGH [[fallthrough]] - #elif __has_cpp_attribute(clang::fallthrough) - #define CYTHON_FALLTHROUGH [[clang::fallthrough]] - #elif __has_cpp_attribute(gnu::fallthrough) - #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #if defined(__cplusplus) + /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 + * but leads to warnings with -pedantic, since it is a C++17 feature */ + #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif #endif #endif #ifndef CYTHON_FALLTHROUGH @@ -343,13 +549,26 @@ #define CYTHON_FALLTHROUGH #endif #endif - #if defined(__clang__ ) && defined(__apple_build_version__) + #if defined(__clang__) && defined(__apple_build_version__) #if __apple_build_version__ < 7000000 #undef CYTHON_FALLTHROUGH #define CYTHON_FALLTHROUGH #endif #endif #endif +#ifdef __cplusplus + template + struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; + #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value) +#else + #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) +#endif +#if CYTHON_COMPILING_IN_PYPY == 1 + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) #ifndef CYTHON_INLINE #if defined(__clang__) @@ -365,85 +584,145 @@ #endif #endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_DefaultClassType PyType_Type -#if PY_VERSION_HEX >= 0x030B00A1 - static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, PyObject *code, PyObject *c, PyObject* n, PyObject *v, PyObject *fv, PyObject *cell, PyObject* fn, PyObject *name, int fline, PyObject *lnos) { - PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; - PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; - const char *fn_cstr=NULL; - const char *name_cstr=NULL; - PyCodeObject* co=NULL; + PyObject *exception_table = NULL; + PyObject *types_module=NULL, *code_type=NULL, *result=NULL; + #if __PYX_LIMITED_VERSION_HEX < 0x030B0000 + PyObject *version_info; // borrowed + PyObject *py_minor_version = NULL; + #endif + long minor_version = 0; PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); - if (!(kwds=PyDict_New())) goto end; - if (!(argcount=PyLong_FromLong(a))) goto end; - if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; - if (!(posonlyargcount=PyLong_FromLong(0))) goto end; - if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; - if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; - if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; - if (!(nlocals=PyLong_FromLong(l))) goto end; - if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; - if (!(stacksize=PyLong_FromLong(s))) goto end; - if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; - if (!(flags=PyLong_FromLong(f))) goto end; - if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; - if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; - if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; - if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; - if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; - if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; - if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here - if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; - Py_XDECREF((PyObject*)co); - co = (PyCodeObject*)call_result; - call_result = NULL; - if (0) { - cleanup_code_too: - Py_XDECREF((PyObject*)co); - co = NULL; + #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 + minor_version = 11; // we don't yet need to distinguish between versions > 11 + #else + if (!(version_info = PySys_GetObject("version_info"))) goto end; + if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; + minor_version = PyLong_AsLong(py_minor_version); + Py_DECREF(py_minor_version); + if (minor_version == -1 && PyErr_Occurred()) goto end; + #endif + if (!(types_module = PyImport_ImportModule("types"))) goto end; + if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; + if (minor_version <= 7) { + (void)p; + result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else if (minor_version <= 10) { + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, fline, lnos, fv, cell); + } else { + if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; + result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, + c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); } - end: - Py_XDECREF(kwds); - Py_XDECREF(argcount); - Py_XDECREF(posonlyargcount); - Py_XDECREF(kwonlyargcount); - Py_XDECREF(nlocals); - Py_XDECREF(stacksize); - Py_XDECREF(replace); - Py_XDECREF(call_result); - Py_XDECREF(empty); + end: + Py_XDECREF(code_type); + Py_XDECREF(exception_table); + Py_XDECREF(types_module); if (type) { PyErr_Restore(type, value, traceback); } - return co; + return result; } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyCodeObject *result; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); // we don't have access to __pyx_empty_bytes here + if (!empty_bytes) return NULL; + result = + #if PY_VERSION_HEX >= 0x030C0000 + PyUnstable_Code_NewWithPosOnlyArgs + #else + PyCode_NewWithPosOnlyArgs + #endif + (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #define __Pyx_DefaultClassType PyType_Type +#endif +#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) + #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) +#else + #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) + #define __Pyx_Py_Is(x, y) Py_Is(x, y) +#else + #define __Pyx_Py_Is(x, y) ((x) == (y)) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) + #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) +#else + #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) + #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) +#else + #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) +#endif +#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) + #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) +#else + #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) +#endif +#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) +#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) +#else + #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) +#endif +#ifndef CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 @@ -457,6 +736,12 @@ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef Py_TPFLAGS_SEQUENCE + #define Py_TPFLAGS_SEQUENCE 0 +#endif +#ifndef Py_TPFLAGS_MAPPING + #define Py_TPFLAGS_MAPPING 0 +#endif #ifndef METH_STACKLESS #define METH_STACKLESS 0 #endif @@ -471,31 +756,81 @@ #define __Pyx_PyCFunctionFast _PyCFunctionFast #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) +#if CYTHON_METH_FASTCALL + #define __Pyx_METH_FASTCALL METH_FASTCALL + #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast + #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords +#else + #define __Pyx_METH_FASTCALL METH_VARARGS + #define __Pyx_PyCFunction_FastCall PyCFunction + #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords +#endif +#if CYTHON_VECTORCALL + #define __pyx_vectorcallfunc vectorcallfunc + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET + #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_MAJOR_VERSION >= 0x030900B1 +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) +#else +#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) +#endif +#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) +#elif !CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) +#endif +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) +static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { + return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; +} +#endif +static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) { +#if CYTHON_COMPILING_IN_LIMITED_API + return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; +#else + return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +#endif +} +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) +#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) + typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); #else -#define __Pyx_PyFastCFunction_Check(func) 0 + #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) + #define __Pyx_PyCMethod PyCMethod +#endif +#ifndef METH_METHOD + #define METH_METHOD 0x200 #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 - #define PyMem_RawMalloc(n) PyMem_Malloc(n) - #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) - #define PyMem_RawFree(p) PyMem_Free(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif -#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyThreadState_Current PyThreadState_Get() +#elif !CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() #elif PY_VERSION_HEX >= 0x03060000 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() #elif PY_VERSION_HEX >= 0x03000000 @@ -503,6 +838,22 @@ #else #define __Pyx_PyThreadState_Current _PyThreadState_Current #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) +{ + void *result; + result = PyModule_GetState(op); + if (!result) + Py_FatalError("Couldn't find the module state"); + return result; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) #include "pythread.h" #define Py_tss_NEEDS_INIT 0 @@ -533,7 +884,29 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } #endif -#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else #define __Pyx_PyDict_NewPresized(n) PyDict_New() @@ -545,34 +918,91 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS -#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { + PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); + if (res == NULL) PyErr_Clear(); + return res; +} +#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) +#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#else +static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { +#if CYTHON_COMPILING_IN_PYPY + return PyDict_GetItem(dict, name); +#else + PyDictEntry *ep; + PyDictObject *mp = (PyDictObject*) dict; + long hash = ((PyStringObject *) name)->ob_shash; + assert(hash != -1); + ep = (mp->ma_lookup)(mp, name, hash); + if (ep == NULL) { + return NULL; + } + return ep->me_value; +#endif +} +#define __Pyx_PyDict_GetItemStr PyDict_GetItem +#endif +#if CYTHON_USE_TYPE_SLOTS + #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) + #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) #else -#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) #endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ + PyTypeObject *type = Py_TYPE((PyObject*)obj);\ + assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ + PyObject_GC_Del(obj);\ + Py_DECREF(type);\ +} +#else +#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) +#endif +#if CYTHON_COMPILING_IN_LIMITED_API #define CYTHON_PEP393_ENABLED 1 - #if defined(PyUnicode_IS_READY) - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #else #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) + #define __Pyx_PyUnicode_DATA(u) ((void*)u) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) + #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) - #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) - #endif + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #else - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif #endif #else #define CYTHON_PEP393_ENABLED 0 @@ -582,11 +1012,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY @@ -597,14 +1027,20 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef PyUnicode_Contains + #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) + #endif + #if !defined(PyByteArray_Check) + #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) + #endif + #if !defined(PyObject_Format) + #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) + #endif #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) @@ -633,8 +1069,14 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif +#if CYTHON_COMPILING_IN_CPYTHON + #define __Pyx_PySequence_ListKeepNew(obj)\ + (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) +#else + #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) +#endif #ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) #endif #if PY_VERSION_HEX >= 0x030900A4 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) @@ -644,15 +1086,42 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) #endif #if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) #else + #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) + #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) + #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) + #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) + #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) + #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) + #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) +#endif +#if PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } #endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong @@ -664,6 +1133,9 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject @@ -681,11 +1153,6 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods @@ -730,7 +1197,16 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_ERR(f_index, lineno, Ln_error) \ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } -#ifndef __PYX_EXTERN_C +#ifdef CYTHON_EXTERN_C + #undef __PYX_EXTERN_C + #define __PYX_EXTERN_C CYTHON_EXTERN_C +#elif defined(__PYX_EXTERN_C) + #ifdef _MSC_VER + #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") + #else + #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. + #endif +#else #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -744,6 +1220,7 @@ static CYTHON_INLINE float __PYX_NAN() { #include #include #include +#include #include "pythread.h" #include "stdarg.h" #include "stdio.h" @@ -810,9 +1287,10 @@ static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize @@ -830,9 +1308,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) @@ -840,11 +1318,22 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode @@ -870,14 +1359,60 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_VERSION_HEX >= 0x030C00A7 + #ifndef _PyLong_SIGN_MASK + #define _PyLong_SIGN_MASK 3 + #endif + #ifndef _PyLong_NON_SIZE_BITS + #define _PyLong_NON_SIZE_BITS 3 + #endif + #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) + #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) + #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) + #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) + #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_SignedDigitCount(x)\ + ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) + #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) + #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) + #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) + #else + #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) + #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) + #endif + typedef Py_ssize_t __Pyx_compact_pylong; + typedef size_t __Pyx_compact_upylong; + #else // Py < 3.12 + #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) + #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) + #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) + #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) + #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) + #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) + #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) + #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) + #define __Pyx_PyLong_CompactValue(x)\ + ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) + typedef sdigit __Pyx_compact_pylong; + typedef digit __Pyx_compact_upylong; + #endif + #if PY_VERSION_HEX >= 0x030C00A5 + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) + #else + #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) + #endif +#endif +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +#include +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; const char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; @@ -892,7 +1427,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { - ascii_chars[c] = c; + ascii_chars[c] = (char) c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); @@ -922,6 +1457,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +#include static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; @@ -957,34 +1493,67 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #endif /* __GNUC__ */ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } +#if !CYTHON_USE_MODULE_STATE static PyObject *__pyx_m = NULL; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_cython_runtime = NULL; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; +#endif static int __pyx_lineno; static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; +static const char * __pyx_cfilenm = __FILE__; static const char *__pyx_filename; +/* #### Code section: filename_table ### */ static const char *__pyx_f[] = { "src/pylibemu.pyx", - "stringsource", + "", + "contextvars.pxd", "type.pxd", "bool.pxd", "complex.pxd", }; +/* #### Code section: utility_code_proto_before_types ### */ +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ struct __pyx_obj_8pylibemu_EmuProfile; struct __pyx_obj_8pylibemu_Emulator; +struct __pyx_opt_args_7cpython_11contextvars_get_value; +struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default; + +/* "cpython/contextvars.pxd":112 + * + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, + */ +struct __pyx_opt_args_7cpython_11contextvars_get_value { + int __pyx_n; + PyObject *default_value; +}; + +/* "cpython/contextvars.pxd":129 + * + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. + */ +struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default { + int __pyx_n; + PyObject *default_value; +}; struct __pyx_opt_args_8pylibemu_8Emulator_test; struct __pyx_opt_args_8pylibemu_8Emulator_run; -/* "pylibemu.pyx":546 +/* "pylibemu.pyx":545 * return hook.hook.win.fnname.decode('utf-8') in ('ExitProcess', 'ExitThread', 'exit') * * cpdef int test(self, steps = 1000000): # <<<<<<<<<<<<<< @@ -996,7 +1565,7 @@ struct __pyx_opt_args_8pylibemu_8Emulator_test { PyObject *steps; }; -/* "pylibemu.pyx":618 +/* "pylibemu.pyx":617 * return 0 * * cpdef int run(self, shellcode, steps = 1000000): # <<<<<<<<<<<<<< @@ -1008,7 +1577,7 @@ struct __pyx_opt_args_8pylibemu_8Emulator_run { PyObject *steps; }; -/* "pylibemu.pyx":109 +/* "pylibemu.pyx":108 * * * cdef class EmuProfile: # <<<<<<<<<<<<<< @@ -1027,7 +1596,7 @@ struct __pyx_obj_8pylibemu_EmuProfile { }; -/* "pylibemu.pyx":435 +/* "pylibemu.pyx":434 * * * cdef class Emulator: # <<<<<<<<<<<<<< @@ -1046,7 +1615,7 @@ struct __pyx_obj_8pylibemu_Emulator { -/* "pylibemu.pyx":109 +/* "pylibemu.pyx":108 * * * cdef class EmuProfile: # <<<<<<<<<<<<<< @@ -1081,7 +1650,7 @@ struct __pyx_vtabstruct_8pylibemu_EmuProfile { static struct __pyx_vtabstruct_8pylibemu_EmuProfile *__pyx_vtabptr_8pylibemu_EmuProfile; -/* "pylibemu.pyx":435 +/* "pylibemu.pyx":434 * * * cdef class Emulator: # <<<<<<<<<<<<<< @@ -1095,6 +1664,7 @@ struct __pyx_vtabstruct_8pylibemu_Emulator { int (*run)(struct __pyx_obj_8pylibemu_Emulator *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_run *__pyx_optional_args); }; static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emulator; +/* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -1103,11 +1673,11 @@ static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emula #endif #if CYTHON_REFNANNY typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); + void (*INCREF)(void*, PyObject*, Py_ssize_t); + void (*DECREF)(void*, PyObject*, Py_ssize_t); + void (*GOTREF)(void*, PyObject*, Py_ssize_t); + void (*GIVEREF)(void*, PyObject*, Py_ssize_t); + void* (*SetupContext)(const char*, Py_ssize_t, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; @@ -1117,28 +1687,40 @@ static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emula #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() #endif + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) + #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContextNogil() #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -1149,6 +1731,10 @@ static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emula #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif +#define __Pyx_Py_XDECREF_SET(r, v) do {\ + PyObject *tmp = (PyObject *) r;\ + r = v; Py_XDECREF(tmp);\ + } while (0) #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ @@ -1160,6 +1746,57 @@ static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emula #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#if PY_VERSION_HEX >= 0x030C00A6 +#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) +#else +#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) +#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) +#endif +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) +#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); @@ -1167,6 +1804,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); @@ -1198,18 +1838,18 @@ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UIN /* GetModuleGlobalName.proto */ #if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ +#define __Pyx_GetModuleGlobalName(var, name) do {\ static PY_UINT64_T __pyx_dict_version = 0;\ static PyObject *__pyx_dict_cached_value = NULL;\ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ +} while(0) +#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ PY_UINT64_T __pyx_dict_version;\ PyObject *__pyx_dict_cached_value;\ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} +} while(0) static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) @@ -1244,42 +1884,39 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, Py_UCS4 max_char); -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #define __Pyx_BUILD_ASSERT_EXPR(cond)\ (sizeof(char [1 - 2*!(cond)]) - 1) #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif -#if CYTHON_FAST_PYCALL - static size_t __pyx_pyframe_localsplus_offset = 0; +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif // CYTHON_FAST_PYCALL +#endif +#endif #endif /* PyObjectCall.proto */ @@ -1289,40 +1926,20 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif +/* PyObjectFastCall.proto */ +#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); /* GetTopmostException.proto */ -#if CYTHON_USE_EXC_INFO_STACK +#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); #endif -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) @@ -1346,82 +1963,106 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f); static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f); +/* PyObject_Str.proto */ +#define __Pyx_PyObject_Str(obj)\ + (likely(PyString_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj)) + /* PyObjectLookupSpecial.proto */ #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) { - PyObject *res; - PyTypeObject *tp = Py_TYPE(obj); -#if PY_MAJOR_VERSION < 3 - if (unlikely(PyInstance_Check(obj))) - return __Pyx_PyObject_GetAttrStr(obj, attr_name); -#endif - res = _PyType_Lookup(tp, attr_name); - if (likely(res)) { - descrgetfunc f = Py_TYPE(res)->tp_descr_get; - if (!f) { - Py_INCREF(res); - } else { - res = f(res, obj, (PyObject *)tp); - } - } else { - PyErr_SetObject(PyExc_AttributeError, attr_name); - } - return res; -} +#define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0) +#define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1) +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error); #else +#define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n) #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) #endif -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* TupleAndListFromArray.proto */ #if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) #else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) #endif +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) + #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) #else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) + #define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op + #define __Pyx_Arg_XDECREF_VARARGS(arg) // no-op - arg is borrowed +#endif +#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) +#define __Pyx_KwValues_VARARGS(args, nargs) NULL +#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) +#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) +#if CYTHON_METH_FASTCALL + #define __Pyx_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) + #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) + static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 + CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); + #else + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #endif + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs + #define __Pyx_Arg_XDECREF_FASTCALL(arg) // no-op - arg was returned from array +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS + #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS + #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS + #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS + #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS + #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) + #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) #endif -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); + /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* PyObjectFormat.proto */ #if CYTHON_USE_UNICODE_WRITER @@ -1430,6 +2071,31 @@ static PyObject* __Pyx_PyObject_Format(PyObject* s, PyObject* f); #define __Pyx_PyObject_Format(s, f) PyObject_Format(s, f) #endif +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); +#endif + +/* PyType_Ready.proto */ +CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); + /* PyObject_GenericGetAttrNoDict.proto */ #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); @@ -1445,38 +2111,51 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #endif /* SetVTable.proto */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable); +static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable); -/* PyErrExceptionMatches.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); -#else -#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) -#endif +/* GetVTable.proto */ +static void* __Pyx_GetVtable(PyTypeObject *type); -/* PyObjectGetAttrStrNoError.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); +/* MergeVTables.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type); +#endif /* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __Pyx_setup_reduce(PyObject* type_obj); +#endif /* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto -#define __PYX_HAVE_RT_ImportType_proto -enum __Pyx_ImportType_CheckSize { - __Pyx_ImportType_CheckSize_Error = 0, - __Pyx_ImportType_CheckSize_Warn = 1, - __Pyx_ImportType_CheckSize_Ignore = 2 +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_6 +#define __PYX_HAVE_RT_ImportType_proto_3_0_6 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_6(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_6(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_0_6 { + __Pyx_ImportType_CheckSize_Error_3_0_6 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_6 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_6 = 2 }; -static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); +static PyTypeObject *__Pyx_ImportType_3_0_6(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_6 check_size); #endif /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); +/* ImportDottedModule.proto */ +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple); +#endif + /* SetNameInClass.proto */ -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000 #define __Pyx_SetNameInClass(ns, name, value)\ (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value)) #elif CYTHON_COMPILING_IN_CPYTHON @@ -1489,12 +2168,155 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); +/* PyObjectCall2Args.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + /* Py3ClassCreate.proto */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc); static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + typesModule = PyImport_ImportModule("types"); + if (!typesModule) return NULL; + methodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + if (!methodType) return NULL; + result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); + Py_DECREF(methodType); + return result; +} +#elif PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + return PyMethod_New(func, self); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto */ +#define __Pyx_CyFunction_USED +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CYFUNCTION_COROUTINE 0x08 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#else + #define __Pyx_CyFunction_GetClassObj(f)\ + ((PyObject*) ((PyCMethodObject *) (f))->mm_class) +#endif +#define __Pyx_CyFunction_SetClassObj(f, classobj)\ + __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject_HEAD + PyObject *func; +#elif PY_VERSION_HEX < 0x030900B1 + PyCFunctionObject func; +#else + PyCMethodObject func; +#endif +#if CYTHON_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + void *defaults; + int defaults_pyobjects; + size_t defaults_size; // used by FusedFunction for copying defaults + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; + PyObject *func_is_coroutine; +} __pyx_CyFunctionObject; +#undef __Pyx_CyOrPyCFunction_Check +#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) +#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc); +#undef __Pyx_IsSameCFunction +#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(PyObject *module); +#if CYTHON_METH_FASTCALL +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); +#if CYTHON_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1503,6 +2325,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); #endif /* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API typedef struct { PyCodeObject* code_object; int code_line; @@ -1516,13 +2339,14 @@ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC #endif @@ -1577,28 +2401,49 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__emu_segment(enum emu_segme /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* 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) /* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); +static unsigned long __Pyx_get_runtime_version(void); +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); +/* #### Code section: module_declarations ### */ +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/ +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self); /* proto*/ static PyObject *__pyx_f_8pylibemu_10EmuProfile_concatenate(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, char *__pyx_v_dst, char *__pyx_v_src, unsigned long __pyx_v_n); /* proto*/ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self); /* proto*/ @@ -1625,115 +2470,125 @@ static PyObject *__pyx_f_8pylibemu_8Emulator_check_stop_emulation(CYTHON_UNUSED static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_test *__pyx_optional_args); /* proto*/ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_run *__pyx_optional_args); /* proto*/ -/* Module declarations from 'libc.stdint' */ +/* Module declarations from "libc.stdint" */ -/* Module declarations from 'cpython.version' */ +/* Module declarations from "cpython.version" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from 'cpython.type' */ -static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from "cpython.type" */ -/* Module declarations from 'libc.string' */ +/* Module declarations from "libc.string" */ -/* Module declarations from 'libc.stdio' */ +/* Module declarations from "libc.stdio" */ -/* Module declarations from 'cpython.object' */ +/* Module declarations from "cpython.object" */ -/* Module declarations from 'cpython.ref' */ +/* Module declarations from "cpython.ref" */ -/* Module declarations from 'cpython.exc' */ +/* Module declarations from "cpython.exc" */ -/* Module declarations from 'cpython.module' */ +/* Module declarations from "cpython.module" */ -/* Module declarations from 'cpython.mem' */ +/* Module declarations from "cpython.mem" */ -/* Module declarations from 'cpython.tuple' */ +/* Module declarations from "cpython.tuple" */ -/* Module declarations from 'cpython.list' */ +/* Module declarations from "cpython.list" */ -/* Module declarations from 'cpython.sequence' */ +/* Module declarations from "cpython.sequence" */ -/* Module declarations from 'cpython.mapping' */ +/* Module declarations from "cpython.mapping" */ -/* Module declarations from 'cpython.iterator' */ +/* Module declarations from "cpython.iterator" */ -/* Module declarations from 'cpython.number' */ +/* Module declarations from "cpython.number" */ -/* Module declarations from 'cpython.int' */ +/* Module declarations from "cpython.int" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from 'cpython.bool' */ -static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; +/* Module declarations from "cpython.bool" */ -/* Module declarations from 'cpython.long' */ +/* Module declarations from "cpython.long" */ -/* Module declarations from 'cpython.float' */ +/* Module declarations from "cpython.float" */ -/* Module declarations from '__builtin__' */ +/* Module declarations from "__builtin__" */ -/* Module declarations from 'cpython.complex' */ -static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; +/* Module declarations from "cpython.complex" */ -/* Module declarations from 'cpython.string' */ +/* Module declarations from "cpython.string" */ -/* Module declarations from 'cpython.unicode' */ +/* Module declarations from "libc.stddef" */ -/* Module declarations from 'cpython.dict' */ +/* Module declarations from "cpython.unicode" */ -/* Module declarations from 'cpython.instance' */ +/* Module declarations from "cpython.pyport" */ -/* Module declarations from 'cpython.function' */ +/* Module declarations from "cpython.dict" */ -/* Module declarations from 'cpython.method' */ +/* Module declarations from "cpython.instance" */ -/* Module declarations from 'cpython.weakref' */ +/* Module declarations from "cpython.function" */ -/* Module declarations from 'cpython.getargs' */ +/* Module declarations from "cpython.method" */ -/* Module declarations from 'cpython.pythread' */ +/* Module declarations from "cpython.weakref" */ -/* Module declarations from 'cpython.pystate' */ +/* Module declarations from "cpython.getargs" */ -/* Module declarations from 'cpython.cobject' */ +/* Module declarations from "cpython.pythread" */ -/* Module declarations from 'cpython.oldbuffer' */ +/* Module declarations from "cpython.pystate" */ -/* Module declarations from 'cpython.set' */ +/* Module declarations from "cpython.cobject" */ -/* Module declarations from 'cpython.buffer' */ +/* Module declarations from "cpython.oldbuffer" */ -/* Module declarations from 'cpython.bytes' */ +/* Module declarations from "cpython.set" */ -/* Module declarations from 'cpython.pycapsule' */ +/* Module declarations from "cpython.buffer" */ -/* Module declarations from 'cpython' */ +/* Module declarations from "cpython.bytes" */ -/* Module declarations from 'pylibemu' */ -static PyTypeObject *__pyx_ptype_8pylibemu_EmuProfile = 0; -static PyTypeObject *__pyx_ptype_8pylibemu_Emulator = 0; +/* Module declarations from "cpython.pycapsule" */ + +/* Module declarations from "cpython.contextvars" */ + +/* Module declarations from "cpython" */ + +/* Module declarations from "pylibemu" */ static uint32_t __pyx_f_8pylibemu_ExitProcess(struct emu_env *, struct emu_env_hook *, ...); /*proto*/ static uint32_t __pyx_f_8pylibemu_ExitThread(struct emu_env *, struct emu_env_hook *, ...); /*proto*/ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *, struct emu_env_hook *, ...); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ #define __Pyx_MODULE_NAME "pylibemu" extern int __pyx_module_is_main_pylibemu; int __pyx_module_is_main_pylibemu = 0; -/* Implementation of 'pylibemu' */ +/* Implementation of "pylibemu" */ +/* #### Code section: global_var ### */ static PyObject *__pyx_builtin_ImportError; static PyObject *__pyx_builtin_open; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_print; static PyObject *__pyx_builtin_RuntimeError; +/* #### Code section: string_decls ### */ static const char __pyx_k_[] = " ("; +static const char __pyx_k_j[] = "j"; +static const char __pyx_k_s[] = "s"; static const char __pyx_k_x[] = "x"; static const char __pyx_k__2[] = ")"; -static const char __pyx_k__6[] = "\n"; +static const char __pyx_k__4[] = "\n"; +static const char __pyx_k__8[] = "*"; +static const char __pyx_k_gc[] = "gc"; static const char __pyx_k_wb[] = "wb"; static const char __pyx_k_0_8[] = "0.8"; -static const char __pyx_k__12[] = "*"; +static const char __pyx_k__75[] = "?"; +static const char __pyx_k_cpu[] = "_cpu"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_eax[] = "eax"; static const char __pyx_k_ebp[] = "ebp"; @@ -1741,10 +2596,13 @@ static const char __pyx_k_ebx[] = "ebx"; static const char __pyx_k_ecx[] = "ecx"; static const char __pyx_k_edi[] = "edi"; static const char __pyx_k_edx[] = "edx"; +static const char __pyx_k_eip[] = "eip"; +static const char __pyx_k_env[] = "_env"; static const char __pyx_k_esi[] = "esi"; static const char __pyx_k_esp[] = "esp"; static const char __pyx_k_len[] = "_len"; static const char __pyx_k_md5[] = "md5"; +static const char __pyx_k_mem[] = "_mem"; static const char __pyx_k_new[] = "new"; static const char __pyx_k_reg[] = "reg"; static const char __pyx_k_run[] = "run"; @@ -1753,22 +2611,32 @@ static const char __pyx_k_sys[] = "sys"; static const char __pyx_k_val[] = "val"; static const char __pyx_k_addr[] = "addr"; static const char __pyx_k_byte[] = "byte"; +static const char __pyx_k_dict[] = "__dict__"; static const char __pyx_k_exit[] = "__exit__"; +static const char __pyx_k_flag[] = "flag"; static const char __pyx_k_free[] = "free"; 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_open[] = "open"; static const char __pyx_k_read[] = "read"; +static const char __pyx_k_self[] = "self"; +static const char __pyx_k_spec[] = "__spec__"; static const char __pyx_k_test[] = "test"; static const char __pyx_k_word[] = "word"; static const char __pyx_k_Error[] = "Error"; +static const char __pyx_k_block[] = "block"; static const char __pyx_k_dword[] = "dword"; static const char __pyx_k_enter[] = "__enter__"; static const char __pyx_k_print[] = "print"; static const char __pyx_k_range[] = "range"; +static const char __pyx_k_sclen[] = "sclen"; +static const char __pyx_k_scode[] = "scode"; static const char __pyx_k_steps[] = "steps"; +static const char __pyx_k_super[] = "super"; static const char __pyx_k_write[] = "write"; +static const char __pyx_k_buffer[] = "buffer"; +static const char __pyx_k_enable[] = "enable"; static const char __pyx_k_exit_2[] = "_exit"; static const char __pyx_k_exit_3[] = "exit"; static const char __pyx_k_format[] = "format"; @@ -1777,11 +2645,15 @@ static const char __pyx_k_module[] = "__module__"; static const char __pyx_k_offset[] = "offset"; static const char __pyx_k_reduce[] = "__reduce__"; static const char __pyx_k_test_2[] = "__test__"; +static const char __pyx_k_urllib[] = "urllib"; static const char __pyx_k_datefmt[] = "datefmt"; +static const char __pyx_k_disable[] = "disable"; static const char __pyx_k_hashlib[] = "hashlib"; static const char __pyx_k_logging[] = "logging"; static const char __pyx_k_maxsize[] = "maxsize"; static const char __pyx_k_prepare[] = "prepare"; +static const char __pyx_k_request[] = "request"; +static const char __pyx_k_segment[] = "segment"; static const char __pyx_k_timeout[] = "timeout"; static const char __pyx_k_urllib2[] = "urllib2"; static const char __pyx_k_urlopen[] = "urlopen"; @@ -1789,15 +2661,19 @@ static const char __pyx_k_version[] = "__version__"; static const char __pyx_k_warning[] = "warning"; static const char __pyx_k_EMU_REGS[] = "EMU_REGS"; static const char __pyx_k_Emulator[] = "Emulator"; +static const char __pyx_k_cpu_step[] = "cpu_step"; static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_pylibemu[] = "pylibemu"; static const char __pyx_k_qualname[] = "__qualname__"; +static const char __pyx_k_set_name[] = "__set_name__"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_cpu_parse[] = "cpu_parse"; static const char __pyx_k_hexdigest[] = "hexdigest"; +static const char __pyx_k_isenabled[] = "isenabled"; static const char __pyx_k_metaclass[] = "__metaclass__"; static const char __pyx_k_prepare_2[] = "__prepare__"; +static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_shellcode[] = "shellcode"; static const char __pyx_k_EmuProfile[] = "EmuProfile"; @@ -1808,131 +2684,99 @@ static const char __pyx_k_ExitProcess[] = "ExitProcess"; static const char __pyx_k_ImportError[] = "ImportError"; static const char __pyx_k_Y_m_d_H_M_S[] = "[%Y-%m-%d %H:%M:%S]"; static const char __pyx_k_basicConfig[] = "basicConfig"; +static const char __pyx_k_cpu_eip_get[] = "cpu_eip_get"; +static const char __pyx_k_cpu_eip_set[] = "cpu_eip_set"; static const char __pyx_k_output_size[] = "output_size"; +static const char __pyx_k_Emulator_new[] = "Emulator.new"; +static const char __pyx_k_Emulator_run[] = "Emulator.run"; static const char __pyx_k_RuntimeError[] = "RuntimeError"; +static const char __pyx_k_cpu_reg8_get[] = "cpu_reg8_get"; +static const char __pyx_k_cpu_reg8_set[] = "cpu_reg8_set"; static const char __pyx_k_enable_hooks[] = "enable_hooks"; +static const char __pyx_k_initializing[] = "_initializing"; +static const char __pyx_k_instr_string[] = "instr_string"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; +static const char __pyx_k_stringsource[] = ""; +static const char __pyx_k_Emulator_free[] = "Emulator.free"; +static const char __pyx_k_Emulator_test[] = "Emulator.test"; +static const char __pyx_k_cpu_reg16_get[] = "cpu_reg16_get"; +static const char __pyx_k_cpu_reg16_set[] = "cpu_reg16_set"; +static const char __pyx_k_cpu_reg32_get[] = "cpu_reg32_get"; +static const char __pyx_k_cpu_reg32_set[] = "cpu_reg32_set"; +static const char __pyx_k_init_subclass[] = "__init_subclass__"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; +static const char __pyx_k_static_offset[] = "static_offset"; +static const char __pyx_k_cpu_eflags_get[] = "cpu_eflags_get"; +static const char __pyx_k_cpu_eflags_set[] = "cpu_eflags_set"; static const char __pyx_k_urllib_request[] = "urllib.request"; +static const char __pyx_k_set_output_size[] = "set_output_size"; static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; +static const char __pyx_k_Emulator_prepare[] = "Emulator.prepare"; static const char __pyx_k_Unhooked_call_to[] = "Unhooked call to "; +static const char __pyx_k_memory_read_byte[] = "memory_read_byte"; +static const char __pyx_k_memory_read_word[] = "memory_read_word"; +static const char __pyx_k_src_pylibemu_pyx[] = "src/pylibemu.pyx"; +static const char __pyx_k_Emulator_cpu_step[] = "Emulator.cpu_step"; static const char __pyx_k_cpu_debugflag_set[] = "cpu_debugflag_set"; +static const char __pyx_k_memory_read_block[] = "memory_read_block"; +static const char __pyx_k_memory_read_dword[] = "memory_read_dword"; +static const char __pyx_k_memory_write_byte[] = "memory_write_byte"; +static const char __pyx_k_memory_write_word[] = "memory_write_word"; +static const char __pyx_k_Emulator_cpu_parse[] = "Emulator.cpu_parse"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_env_w32_hook_check[] = "env_w32_hook_check"; +static const char __pyx_k_memory_read_string[] = "memory_read_string"; +static const char __pyx_k_memory_segment_get[] = "memory_segment_get"; +static const char __pyx_k_memory_write_block[] = "memory_write_block"; +static const char __pyx_k_memory_write_dword[] = "memory_write_dword"; static const char __pyx_k_asctime_s_message_s[] = "%(asctime)s %(message)s"; static const char __pyx_k_cpu_debugflag_unset[] = "cpu_debugflag_unset"; +static const char __pyx_k_Emulator_cpu_eip_get[] = "Emulator.cpu_eip_get"; +static const char __pyx_k_Emulator_cpu_eip_set[] = "Emulator.cpu_eip_set"; static const char __pyx_k_shellcode_getpc_test[] = "shellcode_getpc_test"; +static const char __pyx_k_Emulator_cpu_reg8_get[] = "Emulator.cpu_reg8_get"; +static const char __pyx_k_Emulator_cpu_reg8_set[] = "Emulator.cpu_reg8_set"; +static const char __pyx_k_memory_segment_select[] = "memory_segment_select"; +static const char __pyx_k_Emulator_cpu_reg16_get[] = "Emulator.cpu_reg16_get"; +static const char __pyx_k_Emulator_cpu_reg16_set[] = "Emulator.cpu_reg16_set"; +static const char __pyx_k_Emulator_cpu_reg32_get[] = "Emulator.cpu_reg32_get"; +static const char __pyx_k_Emulator_cpu_reg32_set[] = "Emulator.cpu_reg32_set"; +static const char __pyx_k_Emulator_cpu_eflags_get[] = "Emulator.cpu_eflags_get"; +static const char __pyx_k_Emulator_cpu_eflags_set[] = "Emulator.cpu_eflags_set"; static const char __pyx_k_Memory_allocation_error[] = "Memory allocation error"; +static const char __pyx_k_Emulator___reduce_cython[] = "Emulator.__reduce_cython__"; static const char __pyx_k_Emulator_not_initialized[] = "Emulator not initialized"; +static const char __pyx_k_Emulator_set_output_size[] = "Emulator.set_output_size"; +static const char __pyx_k_Emulator_memory_read_byte[] = "Emulator.memory_read_byte"; +static const char __pyx_k_Emulator_memory_read_word[] = "Emulator.memory_read_word"; +static const char __pyx_k_EmuProfile___reduce_cython[] = "EmuProfile.__reduce_cython__"; +static const char __pyx_k_Emulator___setstate_cython[] = "Emulator.__setstate_cython__"; +static const char __pyx_k_Emulator_cpu_debugflag_set[] = "Emulator.cpu_debugflag_set"; static const char __pyx_k_Emulator_environment_error[] = "Emulator environment error"; +static const char __pyx_k_Emulator_memory_read_block[] = "Emulator.memory_read_block"; +static const char __pyx_k_Emulator_memory_read_dword[] = "Emulator.memory_read_dword"; +static const char __pyx_k_Emulator_memory_write_byte[] = "Emulator.memory_write_byte"; +static const char __pyx_k_Emulator_memory_write_word[] = "Emulator.memory_write_word"; +static const char __pyx_k_Emulator_env_w32_hook_check[] = "Emulator.env_w32_hook_check"; +static const char __pyx_k_Emulator_memory_read_string[] = "Emulator.memory_read_string"; +static const char __pyx_k_Emulator_memory_segment_get[] = "Emulator.memory_segment_get"; +static const char __pyx_k_Emulator_memory_write_block[] = "Emulator.memory_write_block"; +static const char __pyx_k_Emulator_memory_write_dword[] = "Emulator.memory_write_dword"; +static const char __pyx_k_cpu_get_current_instruction[] = "cpu_get_current_instruction"; +static const char __pyx_k_EmuProfile___setstate_cython[] = "EmuProfile.__setstate_cython__"; +static const char __pyx_k_Emulator_cpu_debugflag_unset[] = "Emulator.cpu_debugflag_unset"; static const char __pyx_k_Error_while_downloading_from[] = "Error while downloading from "; +static const char __pyx_k_Emulator_shellcode_getpc_test[] = "Emulator.shellcode_getpc_test"; static const char __pyx_k_Error_while_allocating_memory[] = "Error while allocating memory"; +static const char __pyx_k_Emulator_memory_segment_select[] = "Emulator.memory_segment_select"; static const char __pyx_k_Error_while_reading_a_string_at[] = "Error while reading a string at address 0x"; +static const char __pyx_k_Emulator_cpu_get_current_instruc[] = "Emulator.cpu_get_current_instruction"; static const char __pyx_k_Error_while_reading_a_byte_at_ad[] = "Error while reading a byte at address 0x"; static const char __pyx_k_Error_while_reading_a_dword_at_a[] = "Error while reading a dword at address 0x"; static const char __pyx_k_Error_while_reading_a_word_at_ad[] = "Error while reading a word at address 0x"; static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; -static PyObject *__pyx_kp_u_; -static PyObject *__pyx_kp_u_0_8; -static PyObject *__pyx_kp_u_Downloading; -static PyObject *__pyx_n_s_EMU_REGS; -static PyObject *__pyx_n_s_EmuProfile; -static PyObject *__pyx_n_s_Emulator; -static PyObject *__pyx_kp_u_Emulator_environment_error; -static PyObject *__pyx_kp_u_Emulator_not_initialized; -static PyObject *__pyx_n_u_Error; -static PyObject *__pyx_kp_u_Error_while_allocating_memory; -static PyObject *__pyx_kp_u_Error_while_downloading_from; -static PyObject *__pyx_kp_u_Error_while_reading_a_byte_at_ad; -static PyObject *__pyx_kp_u_Error_while_reading_a_dword_at_a; -static PyObject *__pyx_kp_u_Error_while_reading_a_string_at; -static PyObject *__pyx_kp_u_Error_while_reading_a_word_at_ad; -static PyObject *__pyx_n_u_ExitProcess; -static PyObject *__pyx_n_u_ExitThread; -static PyObject *__pyx_n_s_ImportError; -static PyObject *__pyx_kp_u_Memory_allocation_error; -static PyObject *__pyx_n_s_RuntimeError; -static PyObject *__pyx_n_s_TypeError; -static PyObject *__pyx_kp_u_Unhooked_call_to; -static PyObject *__pyx_kp_u_Y_m_d_H_M_S; -static PyObject *__pyx_n_s__12; -static PyObject *__pyx_kp_u__2; -static PyObject *__pyx_kp_u__6; -static PyObject *__pyx_n_s_addr; -static PyObject *__pyx_kp_u_asctime_s_message_s; -static PyObject *__pyx_n_s_basicConfig; -static PyObject *__pyx_n_s_byte; -static PyObject *__pyx_n_s_cline_in_traceback; -static PyObject *__pyx_n_s_cpu_debugflag_set; -static PyObject *__pyx_n_s_cpu_debugflag_unset; -static PyObject *__pyx_n_s_cpu_parse; -static PyObject *__pyx_n_s_datefmt; -static PyObject *__pyx_n_s_doc; -static PyObject *__pyx_n_s_dword; -static PyObject *__pyx_n_s_eax; -static PyObject *__pyx_n_s_ebp; -static PyObject *__pyx_n_s_ebx; -static PyObject *__pyx_n_s_ecx; -static PyObject *__pyx_n_s_edi; -static PyObject *__pyx_n_s_edx; -static PyObject *__pyx_n_s_enable_hooks; -static PyObject *__pyx_n_s_enter; -static PyObject *__pyx_n_s_esi; -static PyObject *__pyx_n_s_esp; -static PyObject *__pyx_n_s_exit; -static PyObject *__pyx_n_s_exit_2; -static PyObject *__pyx_n_u_exit_3; -static PyObject *__pyx_n_s_format; -static PyObject *__pyx_n_s_free; -static PyObject *__pyx_n_s_getstate; -static PyObject *__pyx_n_s_hashlib; -static PyObject *__pyx_n_s_hexdigest; -static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_len; -static PyObject *__pyx_n_s_logging; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_maxsize; -static PyObject *__pyx_n_s_md5; -static PyObject *__pyx_n_s_metaclass; -static PyObject *__pyx_n_s_mode; -static PyObject *__pyx_n_s_module; -static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_new; -static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; -static PyObject *__pyx_n_s_offset; -static PyObject *__pyx_n_s_open; -static PyObject *__pyx_n_s_output_size; -static PyObject *__pyx_n_s_prepare; -static PyObject *__pyx_n_s_prepare_2; -static PyObject *__pyx_n_s_print; -static PyObject *__pyx_n_s_pylibemu; -static PyObject *__pyx_n_s_pyx_vtable; -static PyObject *__pyx_n_s_qualname; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_read; -static PyObject *__pyx_n_s_reduce; -static PyObject *__pyx_n_s_reduce_cython; -static PyObject *__pyx_n_s_reduce_ex; -static PyObject *__pyx_n_s_reg; -static PyObject *__pyx_n_s_run; -static PyObject *__pyx_n_s_setstate; -static PyObject *__pyx_n_s_setstate_cython; -static PyObject *__pyx_n_s_shellcode; -static PyObject *__pyx_n_s_shellcode_getpc_test; -static PyObject *__pyx_n_s_src; -static PyObject *__pyx_n_s_steps; -static PyObject *__pyx_n_s_sys; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_test_2; -static PyObject *__pyx_n_s_timeout; -static PyObject *__pyx_n_s_urllib2; -static PyObject *__pyx_n_s_urllib_request; -static PyObject *__pyx_n_s_urlopen; -static PyObject *__pyx_n_s_val; -static PyObject *__pyx_n_s_version; -static PyObject *__pyx_n_s_warning; -static PyObject *__pyx_n_u_wb; -static PyObject *__pyx_n_s_word; -static PyObject *__pyx_n_s_write; -static PyObject *__pyx_n_u_x; +/* #### Code section: decls ### */ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, size_t __pyx_v_output_size); /* proto */ static PyObject *__pyx_pf_8pylibemu_10EmuProfile_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_8pylibemu_10EmuProfile_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ @@ -1979,278 +2823,1996 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72__reduce_cython__(CYTHON_UNUSED static PyObject *__pyx_pf_8pylibemu_8Emulator_74__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_tp_new_8pylibemu_EmuProfile(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_8pylibemu_Emulator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_2; -static PyObject *__pyx_int_3; -static PyObject *__pyx_int_4; -static PyObject *__pyx_int_5; -static PyObject *__pyx_int_6; -static PyObject *__pyx_int_7; -static PyObject *__pyx_int_10; -static PyObject *__pyx_int_1000000; -static PyObject *__pyx_int_1048576; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -/* Late includes */ - -/* "pylibemu.pyx":52 - * - * # User hooks - * cdef uint32_t ExitProcess(c_emu_env *env, c_emu_env_hook *hook...): # <<<<<<<<<<<<<< - * cdef va_list args - * cdef int exitcode - */ - -static uint32_t __pyx_f_8pylibemu_ExitProcess(CYTHON_UNUSED struct emu_env *__pyx_v_env, struct emu_env_hook *__pyx_v_hook, ...) { - va_list __pyx_v_args; - CYTHON_UNUSED int __pyx_v_exitcode; - uint32_t __pyx_r; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("ExitProcess", 0); - - /* "pylibemu.pyx":56 - * cdef int exitcode - * - * va_start(args, hook) # <<<<<<<<<<<<<< - * exitcode = va_arg(args, int_type) - * va_end(args) - */ - va_start(__pyx_v_args, ((void *)__pyx_v_hook)); +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4type_type; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_4bool_bool; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_7cpython_7complex_complex; + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #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_8pylibemu_EmuProfile; + PyObject *__pyx_type_8pylibemu_Emulator; + #endif + PyTypeObject *__pyx_ptype_8pylibemu_EmuProfile; + PyTypeObject *__pyx_ptype_8pylibemu_Emulator; + PyObject *__pyx_kp_u_; + PyObject *__pyx_kp_u_0_8; + PyObject *__pyx_kp_u_Downloading; + PyObject *__pyx_n_s_EMU_REGS; + PyObject *__pyx_n_s_EmuProfile; + PyObject *__pyx_n_s_EmuProfile___reduce_cython; + PyObject *__pyx_n_s_EmuProfile___setstate_cython; + PyObject *__pyx_n_s_Emulator; + PyObject *__pyx_n_s_Emulator___reduce_cython; + PyObject *__pyx_n_s_Emulator___setstate_cython; + PyObject *__pyx_n_s_Emulator_cpu_debugflag_set; + PyObject *__pyx_n_s_Emulator_cpu_debugflag_unset; + PyObject *__pyx_n_s_Emulator_cpu_eflags_get; + PyObject *__pyx_n_s_Emulator_cpu_eflags_set; + PyObject *__pyx_n_s_Emulator_cpu_eip_get; + PyObject *__pyx_n_s_Emulator_cpu_eip_set; + PyObject *__pyx_n_s_Emulator_cpu_get_current_instruc; + PyObject *__pyx_n_s_Emulator_cpu_parse; + PyObject *__pyx_n_s_Emulator_cpu_reg16_get; + PyObject *__pyx_n_s_Emulator_cpu_reg16_set; + PyObject *__pyx_n_s_Emulator_cpu_reg32_get; + PyObject *__pyx_n_s_Emulator_cpu_reg32_set; + PyObject *__pyx_n_s_Emulator_cpu_reg8_get; + PyObject *__pyx_n_s_Emulator_cpu_reg8_set; + PyObject *__pyx_n_s_Emulator_cpu_step; + PyObject *__pyx_n_s_Emulator_env_w32_hook_check; + PyObject *__pyx_kp_u_Emulator_environment_error; + PyObject *__pyx_n_s_Emulator_free; + PyObject *__pyx_n_s_Emulator_memory_read_block; + PyObject *__pyx_n_s_Emulator_memory_read_byte; + PyObject *__pyx_n_s_Emulator_memory_read_dword; + PyObject *__pyx_n_s_Emulator_memory_read_string; + PyObject *__pyx_n_s_Emulator_memory_read_word; + PyObject *__pyx_n_s_Emulator_memory_segment_get; + PyObject *__pyx_n_s_Emulator_memory_segment_select; + PyObject *__pyx_n_s_Emulator_memory_write_block; + PyObject *__pyx_n_s_Emulator_memory_write_byte; + PyObject *__pyx_n_s_Emulator_memory_write_dword; + PyObject *__pyx_n_s_Emulator_memory_write_word; + PyObject *__pyx_n_s_Emulator_new; + PyObject *__pyx_kp_u_Emulator_not_initialized; + PyObject *__pyx_n_s_Emulator_prepare; + PyObject *__pyx_n_s_Emulator_run; + PyObject *__pyx_n_s_Emulator_set_output_size; + PyObject *__pyx_n_s_Emulator_shellcode_getpc_test; + PyObject *__pyx_n_s_Emulator_test; + PyObject *__pyx_n_u_Error; + PyObject *__pyx_kp_u_Error_while_allocating_memory; + PyObject *__pyx_kp_u_Error_while_downloading_from; + PyObject *__pyx_kp_u_Error_while_reading_a_byte_at_ad; + PyObject *__pyx_kp_u_Error_while_reading_a_dword_at_a; + PyObject *__pyx_kp_u_Error_while_reading_a_string_at; + PyObject *__pyx_kp_u_Error_while_reading_a_word_at_ad; + PyObject *__pyx_n_u_ExitProcess; + PyObject *__pyx_n_u_ExitThread; + PyObject *__pyx_n_s_ImportError; + PyObject *__pyx_kp_u_Memory_allocation_error; + PyObject *__pyx_n_s_RuntimeError; + PyObject *__pyx_n_s_TypeError; + PyObject *__pyx_kp_u_Unhooked_call_to; + PyObject *__pyx_kp_u_Y_m_d_H_M_S; + PyObject *__pyx_kp_u__2; + PyObject *__pyx_kp_u__4; + PyObject *__pyx_n_s__75; + PyObject *__pyx_n_s__8; + PyObject *__pyx_n_s_addr; + PyObject *__pyx_kp_u_asctime_s_message_s; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_basicConfig; + PyObject *__pyx_n_s_block; + PyObject *__pyx_n_s_buffer; + PyObject *__pyx_n_s_byte; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_cpu; + PyObject *__pyx_n_s_cpu_debugflag_set; + PyObject *__pyx_n_s_cpu_debugflag_unset; + PyObject *__pyx_n_s_cpu_eflags_get; + PyObject *__pyx_n_s_cpu_eflags_set; + PyObject *__pyx_n_s_cpu_eip_get; + PyObject *__pyx_n_s_cpu_eip_set; + PyObject *__pyx_n_s_cpu_get_current_instruction; + PyObject *__pyx_n_s_cpu_parse; + PyObject *__pyx_n_s_cpu_reg16_get; + PyObject *__pyx_n_s_cpu_reg16_set; + PyObject *__pyx_n_s_cpu_reg32_get; + PyObject *__pyx_n_s_cpu_reg32_set; + PyObject *__pyx_n_s_cpu_reg8_get; + PyObject *__pyx_n_s_cpu_reg8_set; + PyObject *__pyx_n_s_cpu_step; + PyObject *__pyx_n_s_datefmt; + PyObject *__pyx_n_s_dict; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_n_s_doc; + PyObject *__pyx_n_s_dword; + PyObject *__pyx_n_s_eax; + PyObject *__pyx_n_s_ebp; + PyObject *__pyx_n_s_ebx; + PyObject *__pyx_n_s_ecx; + PyObject *__pyx_n_s_edi; + PyObject *__pyx_n_s_edx; + PyObject *__pyx_n_s_eip; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_enable_hooks; + PyObject *__pyx_n_s_enter; + PyObject *__pyx_n_s_env; + PyObject *__pyx_n_s_env_w32_hook_check; + PyObject *__pyx_n_s_esi; + PyObject *__pyx_n_s_esp; + PyObject *__pyx_n_s_exit; + PyObject *__pyx_n_s_exit_2; + PyObject *__pyx_n_u_exit_3; + PyObject *__pyx_n_s_flag; + PyObject *__pyx_n_s_format; + PyObject *__pyx_n_s_free; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_getstate; + PyObject *__pyx_n_s_hashlib; + PyObject *__pyx_n_s_hexdigest; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_init_subclass; + PyObject *__pyx_n_s_initializing; + PyObject *__pyx_n_s_instr_string; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_j; + PyObject *__pyx_n_s_len; + PyObject *__pyx_n_s_logging; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_maxsize; + PyObject *__pyx_n_s_md5; + PyObject *__pyx_n_s_mem; + PyObject *__pyx_n_s_memory_read_block; + PyObject *__pyx_n_s_memory_read_byte; + PyObject *__pyx_n_s_memory_read_dword; + PyObject *__pyx_n_s_memory_read_string; + PyObject *__pyx_n_s_memory_read_word; + PyObject *__pyx_n_s_memory_segment_get; + PyObject *__pyx_n_s_memory_segment_select; + PyObject *__pyx_n_s_memory_write_block; + PyObject *__pyx_n_s_memory_write_byte; + PyObject *__pyx_n_s_memory_write_dword; + PyObject *__pyx_n_s_memory_write_word; + PyObject *__pyx_n_s_metaclass; + PyObject *__pyx_n_s_mode; + PyObject *__pyx_n_s_module; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_new; + PyObject *__pyx_kp_s_no_default___reduce___due_to_non; + PyObject *__pyx_n_s_offset; + PyObject *__pyx_n_s_open; + PyObject *__pyx_n_s_output_size; + PyObject *__pyx_n_s_prepare; + PyObject *__pyx_n_s_prepare_2; + PyObject *__pyx_n_s_print; + PyObject *__pyx_n_s_pylibemu; + PyObject *__pyx_n_s_pyx_state; + PyObject *__pyx_n_s_pyx_vtable; + PyObject *__pyx_n_s_qualname; + PyObject *__pyx_n_s_range; + PyObject *__pyx_n_s_read; + PyObject *__pyx_n_s_reduce; + PyObject *__pyx_n_s_reduce_cython; + PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_reg; + PyObject *__pyx_n_s_request; + PyObject *__pyx_n_s_run; + PyObject *__pyx_n_s_s; + PyObject *__pyx_n_s_sclen; + PyObject *__pyx_n_s_scode; + PyObject *__pyx_n_s_segment; + PyObject *__pyx_n_s_self; + PyObject *__pyx_n_s_set_name; + PyObject *__pyx_n_s_set_output_size; + PyObject *__pyx_n_s_setstate; + PyObject *__pyx_n_s_setstate_cython; + PyObject *__pyx_n_s_shellcode; + PyObject *__pyx_n_s_shellcode_getpc_test; + PyObject *__pyx_n_s_spec; + PyObject *__pyx_n_s_src; + PyObject *__pyx_kp_s_src_pylibemu_pyx; + PyObject *__pyx_n_s_static_offset; + PyObject *__pyx_n_s_steps; + PyObject *__pyx_kp_s_stringsource; + PyObject *__pyx_n_s_super; + PyObject *__pyx_n_s_sys; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_test_2; + PyObject *__pyx_n_s_timeout; + PyObject *__pyx_n_s_urllib; + PyObject *__pyx_n_s_urllib2; + PyObject *__pyx_n_s_urllib_request; + PyObject *__pyx_n_s_urlopen; + PyObject *__pyx_n_s_val; + PyObject *__pyx_n_s_version; + PyObject *__pyx_n_s_warning; + PyObject *__pyx_n_u_wb; + PyObject *__pyx_n_s_word; + PyObject *__pyx_n_s_write; + PyObject *__pyx_n_u_x; + 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_10; + PyObject *__pyx_int_1000000; + PyObject *__pyx_int_1048576; + PyObject *__pyx_int_neg_1; + PyObject *__pyx_tuple__3; + PyObject *__pyx_tuple__5; + PyObject *__pyx_tuple__6; + PyObject *__pyx_tuple__7; + PyObject *__pyx_tuple__9; + PyObject *__pyx_tuple__10; + PyObject *__pyx_tuple__12; + PyObject *__pyx_tuple__16; + PyObject *__pyx_tuple__18; + PyObject *__pyx_tuple__20; + PyObject *__pyx_tuple__22; + PyObject *__pyx_tuple__24; + PyObject *__pyx_tuple__25; + PyObject *__pyx_tuple__27; + PyObject *__pyx_tuple__29; + PyObject *__pyx_tuple__35; + PyObject *__pyx_tuple__37; + PyObject *__pyx_tuple__39; + PyObject *__pyx_tuple__44; + PyObject *__pyx_tuple__47; + PyObject *__pyx_tuple__49; + PyObject *__pyx_tuple__51; + PyObject *__pyx_tuple__53; + PyObject *__pyx_tuple__55; + PyObject *__pyx_tuple__57; + PyObject *__pyx_tuple__59; + PyObject *__pyx_tuple__61; + PyObject *__pyx_tuple__63; + PyObject *__pyx_tuple__65; + PyObject *__pyx_tuple__67; + PyObject *__pyx_tuple__69; + PyObject *__pyx_tuple__71; + PyObject *__pyx_codeobj__11; + PyObject *__pyx_codeobj__13; + PyObject *__pyx_codeobj__14; + PyObject *__pyx_codeobj__15; + PyObject *__pyx_codeobj__17; + PyObject *__pyx_codeobj__19; + PyObject *__pyx_codeobj__21; + PyObject *__pyx_codeobj__23; + PyObject *__pyx_codeobj__26; + PyObject *__pyx_codeobj__28; + PyObject *__pyx_codeobj__30; + PyObject *__pyx_codeobj__31; + PyObject *__pyx_codeobj__32; + PyObject *__pyx_codeobj__33; + PyObject *__pyx_codeobj__34; + PyObject *__pyx_codeobj__36; + PyObject *__pyx_codeobj__38; + PyObject *__pyx_codeobj__40; + PyObject *__pyx_codeobj__41; + PyObject *__pyx_codeobj__42; + PyObject *__pyx_codeobj__43; + PyObject *__pyx_codeobj__45; + PyObject *__pyx_codeobj__46; + PyObject *__pyx_codeobj__48; + PyObject *__pyx_codeobj__50; + PyObject *__pyx_codeobj__52; + PyObject *__pyx_codeobj__54; + PyObject *__pyx_codeobj__56; + PyObject *__pyx_codeobj__58; + PyObject *__pyx_codeobj__60; + PyObject *__pyx_codeobj__62; + PyObject *__pyx_codeobj__64; + PyObject *__pyx_codeobj__66; + PyObject *__pyx_codeobj__68; + PyObject *__pyx_codeobj__70; + PyObject *__pyx_codeobj__72; + PyObject *__pyx_codeobj__73; + PyObject *__pyx_codeobj__74; +} __pyx_mstate; + +#if CYTHON_USE_MODULE_STATE +#ifdef __cplusplus +namespace { + extern struct PyModuleDef __pyx_moduledef; +} /* anonymous namespace */ +#else +static struct PyModuleDef __pyx_moduledef; +#endif - /* "pylibemu.pyx":57 +#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) + +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(m); + if (!clear_module_state) return 0; + Py_CLEAR(clear_module_state->__pyx_d); + Py_CLEAR(clear_module_state->__pyx_b); + Py_CLEAR(clear_module_state->__pyx_cython_runtime); + Py_CLEAR(clear_module_state->__pyx_empty_tuple); + Py_CLEAR(clear_module_state->__pyx_empty_bytes); + Py_CLEAR(clear_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool); + Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex); + Py_CLEAR(clear_module_state->__pyx_ptype_8pylibemu_EmuProfile); + Py_CLEAR(clear_module_state->__pyx_type_8pylibemu_EmuProfile); + Py_CLEAR(clear_module_state->__pyx_ptype_8pylibemu_Emulator); + Py_CLEAR(clear_module_state->__pyx_type_8pylibemu_Emulator); + Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_kp_u_0_8); + Py_CLEAR(clear_module_state->__pyx_kp_u_Downloading); + Py_CLEAR(clear_module_state->__pyx_n_s_EMU_REGS); + Py_CLEAR(clear_module_state->__pyx_n_s_EmuProfile); + Py_CLEAR(clear_module_state->__pyx_n_s_EmuProfile___reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_EmuProfile___setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator___reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator___setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_debugflag_set); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_debugflag_unset); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_eflags_get); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_eflags_set); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_eip_get); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_eip_set); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_get_current_instruc); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_parse); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_reg16_get); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_reg16_set); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_reg32_get); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_reg32_set); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_reg8_get); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_reg8_set); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_cpu_step); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_env_w32_hook_check); + Py_CLEAR(clear_module_state->__pyx_kp_u_Emulator_environment_error); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_free); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_memory_read_block); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_memory_read_byte); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_memory_read_dword); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_memory_read_string); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_memory_read_word); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_memory_segment_get); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_memory_segment_select); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_memory_write_block); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_memory_write_byte); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_memory_write_dword); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_memory_write_word); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_new); + Py_CLEAR(clear_module_state->__pyx_kp_u_Emulator_not_initialized); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_prepare); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_run); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_set_output_size); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_shellcode_getpc_test); + Py_CLEAR(clear_module_state->__pyx_n_s_Emulator_test); + Py_CLEAR(clear_module_state->__pyx_n_u_Error); + Py_CLEAR(clear_module_state->__pyx_kp_u_Error_while_allocating_memory); + Py_CLEAR(clear_module_state->__pyx_kp_u_Error_while_downloading_from); + Py_CLEAR(clear_module_state->__pyx_kp_u_Error_while_reading_a_byte_at_ad); + Py_CLEAR(clear_module_state->__pyx_kp_u_Error_while_reading_a_dword_at_a); + Py_CLEAR(clear_module_state->__pyx_kp_u_Error_while_reading_a_string_at); + Py_CLEAR(clear_module_state->__pyx_kp_u_Error_while_reading_a_word_at_ad); + Py_CLEAR(clear_module_state->__pyx_n_u_ExitProcess); + Py_CLEAR(clear_module_state->__pyx_n_u_ExitThread); + Py_CLEAR(clear_module_state->__pyx_n_s_ImportError); + Py_CLEAR(clear_module_state->__pyx_kp_u_Memory_allocation_error); + Py_CLEAR(clear_module_state->__pyx_n_s_RuntimeError); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_kp_u_Unhooked_call_to); + Py_CLEAR(clear_module_state->__pyx_kp_u_Y_m_d_H_M_S); + Py_CLEAR(clear_module_state->__pyx_kp_u__2); + Py_CLEAR(clear_module_state->__pyx_kp_u__4); + Py_CLEAR(clear_module_state->__pyx_n_s__75); + Py_CLEAR(clear_module_state->__pyx_n_s__8); + Py_CLEAR(clear_module_state->__pyx_n_s_addr); + Py_CLEAR(clear_module_state->__pyx_kp_u_asctime_s_message_s); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_basicConfig); + Py_CLEAR(clear_module_state->__pyx_n_s_block); + Py_CLEAR(clear_module_state->__pyx_n_s_buffer); + Py_CLEAR(clear_module_state->__pyx_n_s_byte); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_debugflag_set); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_debugflag_unset); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_eflags_get); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_eflags_set); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_eip_get); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_eip_set); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_get_current_instruction); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_parse); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_reg16_get); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_reg16_set); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_reg32_get); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_reg32_set); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_reg8_get); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_reg8_set); + Py_CLEAR(clear_module_state->__pyx_n_s_cpu_step); + Py_CLEAR(clear_module_state->__pyx_n_s_datefmt); + Py_CLEAR(clear_module_state->__pyx_n_s_dict); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_n_s_doc); + Py_CLEAR(clear_module_state->__pyx_n_s_dword); + Py_CLEAR(clear_module_state->__pyx_n_s_eax); + Py_CLEAR(clear_module_state->__pyx_n_s_ebp); + Py_CLEAR(clear_module_state->__pyx_n_s_ebx); + Py_CLEAR(clear_module_state->__pyx_n_s_ecx); + Py_CLEAR(clear_module_state->__pyx_n_s_edi); + Py_CLEAR(clear_module_state->__pyx_n_s_edx); + Py_CLEAR(clear_module_state->__pyx_n_s_eip); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_enable_hooks); + Py_CLEAR(clear_module_state->__pyx_n_s_enter); + Py_CLEAR(clear_module_state->__pyx_n_s_env); + Py_CLEAR(clear_module_state->__pyx_n_s_env_w32_hook_check); + Py_CLEAR(clear_module_state->__pyx_n_s_esi); + Py_CLEAR(clear_module_state->__pyx_n_s_esp); + Py_CLEAR(clear_module_state->__pyx_n_s_exit); + Py_CLEAR(clear_module_state->__pyx_n_s_exit_2); + Py_CLEAR(clear_module_state->__pyx_n_u_exit_3); + Py_CLEAR(clear_module_state->__pyx_n_s_flag); + Py_CLEAR(clear_module_state->__pyx_n_s_format); + Py_CLEAR(clear_module_state->__pyx_n_s_free); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_n_s_hashlib); + Py_CLEAR(clear_module_state->__pyx_n_s_hexdigest); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_init_subclass); + Py_CLEAR(clear_module_state->__pyx_n_s_initializing); + Py_CLEAR(clear_module_state->__pyx_n_s_instr_string); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_j); + Py_CLEAR(clear_module_state->__pyx_n_s_len); + Py_CLEAR(clear_module_state->__pyx_n_s_logging); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_maxsize); + Py_CLEAR(clear_module_state->__pyx_n_s_md5); + Py_CLEAR(clear_module_state->__pyx_n_s_mem); + Py_CLEAR(clear_module_state->__pyx_n_s_memory_read_block); + Py_CLEAR(clear_module_state->__pyx_n_s_memory_read_byte); + Py_CLEAR(clear_module_state->__pyx_n_s_memory_read_dword); + Py_CLEAR(clear_module_state->__pyx_n_s_memory_read_string); + Py_CLEAR(clear_module_state->__pyx_n_s_memory_read_word); + Py_CLEAR(clear_module_state->__pyx_n_s_memory_segment_get); + Py_CLEAR(clear_module_state->__pyx_n_s_memory_segment_select); + Py_CLEAR(clear_module_state->__pyx_n_s_memory_write_block); + Py_CLEAR(clear_module_state->__pyx_n_s_memory_write_byte); + Py_CLEAR(clear_module_state->__pyx_n_s_memory_write_dword); + Py_CLEAR(clear_module_state->__pyx_n_s_memory_write_word); + Py_CLEAR(clear_module_state->__pyx_n_s_metaclass); + Py_CLEAR(clear_module_state->__pyx_n_s_mode); + Py_CLEAR(clear_module_state->__pyx_n_s_module); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + 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_offset); + Py_CLEAR(clear_module_state->__pyx_n_s_open); + Py_CLEAR(clear_module_state->__pyx_n_s_output_size); + Py_CLEAR(clear_module_state->__pyx_n_s_prepare); + Py_CLEAR(clear_module_state->__pyx_n_s_prepare_2); + Py_CLEAR(clear_module_state->__pyx_n_s_print); + Py_CLEAR(clear_module_state->__pyx_n_s_pylibemu); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable); + Py_CLEAR(clear_module_state->__pyx_n_s_qualname); + 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_reduce); + 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_reg); + Py_CLEAR(clear_module_state->__pyx_n_s_request); + Py_CLEAR(clear_module_state->__pyx_n_s_run); + Py_CLEAR(clear_module_state->__pyx_n_s_s); + Py_CLEAR(clear_module_state->__pyx_n_s_sclen); + Py_CLEAR(clear_module_state->__pyx_n_s_scode); + Py_CLEAR(clear_module_state->__pyx_n_s_segment); + Py_CLEAR(clear_module_state->__pyx_n_s_self); + Py_CLEAR(clear_module_state->__pyx_n_s_set_name); + Py_CLEAR(clear_module_state->__pyx_n_s_set_output_size); + 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_shellcode); + Py_CLEAR(clear_module_state->__pyx_n_s_shellcode_getpc_test); + Py_CLEAR(clear_module_state->__pyx_n_s_spec); + Py_CLEAR(clear_module_state->__pyx_n_s_src); + Py_CLEAR(clear_module_state->__pyx_kp_s_src_pylibemu_pyx); + Py_CLEAR(clear_module_state->__pyx_n_s_static_offset); + Py_CLEAR(clear_module_state->__pyx_n_s_steps); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_super); + Py_CLEAR(clear_module_state->__pyx_n_s_sys); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_test_2); + Py_CLEAR(clear_module_state->__pyx_n_s_timeout); + Py_CLEAR(clear_module_state->__pyx_n_s_urllib); + Py_CLEAR(clear_module_state->__pyx_n_s_urllib2); + Py_CLEAR(clear_module_state->__pyx_n_s_urllib_request); + Py_CLEAR(clear_module_state->__pyx_n_s_urlopen); + Py_CLEAR(clear_module_state->__pyx_n_s_val); + Py_CLEAR(clear_module_state->__pyx_n_s_version); + Py_CLEAR(clear_module_state->__pyx_n_s_warning); + Py_CLEAR(clear_module_state->__pyx_n_u_wb); + Py_CLEAR(clear_module_state->__pyx_n_s_word); + Py_CLEAR(clear_module_state->__pyx_n_s_write); + Py_CLEAR(clear_module_state->__pyx_n_u_x); + 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_10); + Py_CLEAR(clear_module_state->__pyx_int_1000000); + Py_CLEAR(clear_module_state->__pyx_int_1048576); + Py_CLEAR(clear_module_state->__pyx_int_neg_1); + Py_CLEAR(clear_module_state->__pyx_tuple__3); + Py_CLEAR(clear_module_state->__pyx_tuple__5); + Py_CLEAR(clear_module_state->__pyx_tuple__6); + Py_CLEAR(clear_module_state->__pyx_tuple__7); + 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__16); + Py_CLEAR(clear_module_state->__pyx_tuple__18); + Py_CLEAR(clear_module_state->__pyx_tuple__20); + Py_CLEAR(clear_module_state->__pyx_tuple__22); + Py_CLEAR(clear_module_state->__pyx_tuple__24); + Py_CLEAR(clear_module_state->__pyx_tuple__25); + Py_CLEAR(clear_module_state->__pyx_tuple__27); + Py_CLEAR(clear_module_state->__pyx_tuple__29); + Py_CLEAR(clear_module_state->__pyx_tuple__35); + Py_CLEAR(clear_module_state->__pyx_tuple__37); + Py_CLEAR(clear_module_state->__pyx_tuple__39); + Py_CLEAR(clear_module_state->__pyx_tuple__44); + Py_CLEAR(clear_module_state->__pyx_tuple__47); + Py_CLEAR(clear_module_state->__pyx_tuple__49); + Py_CLEAR(clear_module_state->__pyx_tuple__51); + Py_CLEAR(clear_module_state->__pyx_tuple__53); + Py_CLEAR(clear_module_state->__pyx_tuple__55); + Py_CLEAR(clear_module_state->__pyx_tuple__57); + Py_CLEAR(clear_module_state->__pyx_tuple__59); + Py_CLEAR(clear_module_state->__pyx_tuple__61); + Py_CLEAR(clear_module_state->__pyx_tuple__63); + Py_CLEAR(clear_module_state->__pyx_tuple__65); + Py_CLEAR(clear_module_state->__pyx_tuple__67); + Py_CLEAR(clear_module_state->__pyx_tuple__69); + Py_CLEAR(clear_module_state->__pyx_tuple__71); + Py_CLEAR(clear_module_state->__pyx_codeobj__11); + Py_CLEAR(clear_module_state->__pyx_codeobj__13); + Py_CLEAR(clear_module_state->__pyx_codeobj__14); + Py_CLEAR(clear_module_state->__pyx_codeobj__15); + Py_CLEAR(clear_module_state->__pyx_codeobj__17); + Py_CLEAR(clear_module_state->__pyx_codeobj__19); + Py_CLEAR(clear_module_state->__pyx_codeobj__21); + Py_CLEAR(clear_module_state->__pyx_codeobj__23); + Py_CLEAR(clear_module_state->__pyx_codeobj__26); + Py_CLEAR(clear_module_state->__pyx_codeobj__28); + Py_CLEAR(clear_module_state->__pyx_codeobj__30); + Py_CLEAR(clear_module_state->__pyx_codeobj__31); + Py_CLEAR(clear_module_state->__pyx_codeobj__32); + Py_CLEAR(clear_module_state->__pyx_codeobj__33); + Py_CLEAR(clear_module_state->__pyx_codeobj__34); + Py_CLEAR(clear_module_state->__pyx_codeobj__36); + Py_CLEAR(clear_module_state->__pyx_codeobj__38); + Py_CLEAR(clear_module_state->__pyx_codeobj__40); + Py_CLEAR(clear_module_state->__pyx_codeobj__41); + Py_CLEAR(clear_module_state->__pyx_codeobj__42); + Py_CLEAR(clear_module_state->__pyx_codeobj__43); + Py_CLEAR(clear_module_state->__pyx_codeobj__45); + Py_CLEAR(clear_module_state->__pyx_codeobj__46); + Py_CLEAR(clear_module_state->__pyx_codeobj__48); + Py_CLEAR(clear_module_state->__pyx_codeobj__50); + Py_CLEAR(clear_module_state->__pyx_codeobj__52); + Py_CLEAR(clear_module_state->__pyx_codeobj__54); + Py_CLEAR(clear_module_state->__pyx_codeobj__56); + Py_CLEAR(clear_module_state->__pyx_codeobj__58); + Py_CLEAR(clear_module_state->__pyx_codeobj__60); + Py_CLEAR(clear_module_state->__pyx_codeobj__62); + Py_CLEAR(clear_module_state->__pyx_codeobj__64); + Py_CLEAR(clear_module_state->__pyx_codeobj__66); + Py_CLEAR(clear_module_state->__pyx_codeobj__68); + Py_CLEAR(clear_module_state->__pyx_codeobj__70); + Py_CLEAR(clear_module_state->__pyx_codeobj__72); + Py_CLEAR(clear_module_state->__pyx_codeobj__73); + Py_CLEAR(clear_module_state->__pyx_codeobj__74); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(m); + if (!traverse_module_state) return 0; + Py_VISIT(traverse_module_state->__pyx_d); + Py_VISIT(traverse_module_state->__pyx_b); + Py_VISIT(traverse_module_state->__pyx_cython_runtime); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool); + Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex); + Py_VISIT(traverse_module_state->__pyx_ptype_8pylibemu_EmuProfile); + Py_VISIT(traverse_module_state->__pyx_type_8pylibemu_EmuProfile); + Py_VISIT(traverse_module_state->__pyx_ptype_8pylibemu_Emulator); + Py_VISIT(traverse_module_state->__pyx_type_8pylibemu_Emulator); + Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_kp_u_0_8); + Py_VISIT(traverse_module_state->__pyx_kp_u_Downloading); + Py_VISIT(traverse_module_state->__pyx_n_s_EMU_REGS); + Py_VISIT(traverse_module_state->__pyx_n_s_EmuProfile); + Py_VISIT(traverse_module_state->__pyx_n_s_EmuProfile___reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_EmuProfile___setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator___reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator___setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_debugflag_set); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_debugflag_unset); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_eflags_get); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_eflags_set); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_eip_get); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_eip_set); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_get_current_instruc); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_parse); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_reg16_get); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_reg16_set); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_reg32_get); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_reg32_set); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_reg8_get); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_reg8_set); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_cpu_step); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_env_w32_hook_check); + Py_VISIT(traverse_module_state->__pyx_kp_u_Emulator_environment_error); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_free); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_memory_read_block); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_memory_read_byte); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_memory_read_dword); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_memory_read_string); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_memory_read_word); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_memory_segment_get); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_memory_segment_select); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_memory_write_block); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_memory_write_byte); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_memory_write_dword); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_memory_write_word); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_new); + Py_VISIT(traverse_module_state->__pyx_kp_u_Emulator_not_initialized); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_prepare); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_run); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_set_output_size); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_shellcode_getpc_test); + Py_VISIT(traverse_module_state->__pyx_n_s_Emulator_test); + Py_VISIT(traverse_module_state->__pyx_n_u_Error); + Py_VISIT(traverse_module_state->__pyx_kp_u_Error_while_allocating_memory); + Py_VISIT(traverse_module_state->__pyx_kp_u_Error_while_downloading_from); + Py_VISIT(traverse_module_state->__pyx_kp_u_Error_while_reading_a_byte_at_ad); + Py_VISIT(traverse_module_state->__pyx_kp_u_Error_while_reading_a_dword_at_a); + Py_VISIT(traverse_module_state->__pyx_kp_u_Error_while_reading_a_string_at); + Py_VISIT(traverse_module_state->__pyx_kp_u_Error_while_reading_a_word_at_ad); + Py_VISIT(traverse_module_state->__pyx_n_u_ExitProcess); + Py_VISIT(traverse_module_state->__pyx_n_u_ExitThread); + Py_VISIT(traverse_module_state->__pyx_n_s_ImportError); + Py_VISIT(traverse_module_state->__pyx_kp_u_Memory_allocation_error); + Py_VISIT(traverse_module_state->__pyx_n_s_RuntimeError); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_kp_u_Unhooked_call_to); + Py_VISIT(traverse_module_state->__pyx_kp_u_Y_m_d_H_M_S); + Py_VISIT(traverse_module_state->__pyx_kp_u__2); + Py_VISIT(traverse_module_state->__pyx_kp_u__4); + Py_VISIT(traverse_module_state->__pyx_n_s__75); + Py_VISIT(traverse_module_state->__pyx_n_s__8); + Py_VISIT(traverse_module_state->__pyx_n_s_addr); + Py_VISIT(traverse_module_state->__pyx_kp_u_asctime_s_message_s); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_basicConfig); + Py_VISIT(traverse_module_state->__pyx_n_s_block); + Py_VISIT(traverse_module_state->__pyx_n_s_buffer); + Py_VISIT(traverse_module_state->__pyx_n_s_byte); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_debugflag_set); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_debugflag_unset); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_eflags_get); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_eflags_set); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_eip_get); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_eip_set); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_get_current_instruction); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_parse); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_reg16_get); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_reg16_set); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_reg32_get); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_reg32_set); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_reg8_get); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_reg8_set); + Py_VISIT(traverse_module_state->__pyx_n_s_cpu_step); + Py_VISIT(traverse_module_state->__pyx_n_s_datefmt); + Py_VISIT(traverse_module_state->__pyx_n_s_dict); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_n_s_doc); + Py_VISIT(traverse_module_state->__pyx_n_s_dword); + Py_VISIT(traverse_module_state->__pyx_n_s_eax); + Py_VISIT(traverse_module_state->__pyx_n_s_ebp); + Py_VISIT(traverse_module_state->__pyx_n_s_ebx); + Py_VISIT(traverse_module_state->__pyx_n_s_ecx); + Py_VISIT(traverse_module_state->__pyx_n_s_edi); + Py_VISIT(traverse_module_state->__pyx_n_s_edx); + Py_VISIT(traverse_module_state->__pyx_n_s_eip); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_enable_hooks); + Py_VISIT(traverse_module_state->__pyx_n_s_enter); + Py_VISIT(traverse_module_state->__pyx_n_s_env); + Py_VISIT(traverse_module_state->__pyx_n_s_env_w32_hook_check); + Py_VISIT(traverse_module_state->__pyx_n_s_esi); + Py_VISIT(traverse_module_state->__pyx_n_s_esp); + Py_VISIT(traverse_module_state->__pyx_n_s_exit); + Py_VISIT(traverse_module_state->__pyx_n_s_exit_2); + Py_VISIT(traverse_module_state->__pyx_n_u_exit_3); + Py_VISIT(traverse_module_state->__pyx_n_s_flag); + Py_VISIT(traverse_module_state->__pyx_n_s_format); + Py_VISIT(traverse_module_state->__pyx_n_s_free); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_n_s_hashlib); + Py_VISIT(traverse_module_state->__pyx_n_s_hexdigest); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_init_subclass); + Py_VISIT(traverse_module_state->__pyx_n_s_initializing); + Py_VISIT(traverse_module_state->__pyx_n_s_instr_string); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_j); + Py_VISIT(traverse_module_state->__pyx_n_s_len); + Py_VISIT(traverse_module_state->__pyx_n_s_logging); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_maxsize); + Py_VISIT(traverse_module_state->__pyx_n_s_md5); + Py_VISIT(traverse_module_state->__pyx_n_s_mem); + Py_VISIT(traverse_module_state->__pyx_n_s_memory_read_block); + Py_VISIT(traverse_module_state->__pyx_n_s_memory_read_byte); + Py_VISIT(traverse_module_state->__pyx_n_s_memory_read_dword); + Py_VISIT(traverse_module_state->__pyx_n_s_memory_read_string); + Py_VISIT(traverse_module_state->__pyx_n_s_memory_read_word); + Py_VISIT(traverse_module_state->__pyx_n_s_memory_segment_get); + Py_VISIT(traverse_module_state->__pyx_n_s_memory_segment_select); + Py_VISIT(traverse_module_state->__pyx_n_s_memory_write_block); + Py_VISIT(traverse_module_state->__pyx_n_s_memory_write_byte); + Py_VISIT(traverse_module_state->__pyx_n_s_memory_write_dword); + Py_VISIT(traverse_module_state->__pyx_n_s_memory_write_word); + Py_VISIT(traverse_module_state->__pyx_n_s_metaclass); + Py_VISIT(traverse_module_state->__pyx_n_s_mode); + Py_VISIT(traverse_module_state->__pyx_n_s_module); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + 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_offset); + Py_VISIT(traverse_module_state->__pyx_n_s_open); + Py_VISIT(traverse_module_state->__pyx_n_s_output_size); + Py_VISIT(traverse_module_state->__pyx_n_s_prepare); + Py_VISIT(traverse_module_state->__pyx_n_s_prepare_2); + Py_VISIT(traverse_module_state->__pyx_n_s_print); + Py_VISIT(traverse_module_state->__pyx_n_s_pylibemu); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable); + Py_VISIT(traverse_module_state->__pyx_n_s_qualname); + 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_reduce); + 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_reg); + Py_VISIT(traverse_module_state->__pyx_n_s_request); + Py_VISIT(traverse_module_state->__pyx_n_s_run); + Py_VISIT(traverse_module_state->__pyx_n_s_s); + Py_VISIT(traverse_module_state->__pyx_n_s_sclen); + Py_VISIT(traverse_module_state->__pyx_n_s_scode); + Py_VISIT(traverse_module_state->__pyx_n_s_segment); + Py_VISIT(traverse_module_state->__pyx_n_s_self); + Py_VISIT(traverse_module_state->__pyx_n_s_set_name); + Py_VISIT(traverse_module_state->__pyx_n_s_set_output_size); + 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_shellcode); + Py_VISIT(traverse_module_state->__pyx_n_s_shellcode_getpc_test); + Py_VISIT(traverse_module_state->__pyx_n_s_spec); + Py_VISIT(traverse_module_state->__pyx_n_s_src); + Py_VISIT(traverse_module_state->__pyx_kp_s_src_pylibemu_pyx); + Py_VISIT(traverse_module_state->__pyx_n_s_static_offset); + Py_VISIT(traverse_module_state->__pyx_n_s_steps); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_super); + Py_VISIT(traverse_module_state->__pyx_n_s_sys); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_test_2); + Py_VISIT(traverse_module_state->__pyx_n_s_timeout); + Py_VISIT(traverse_module_state->__pyx_n_s_urllib); + Py_VISIT(traverse_module_state->__pyx_n_s_urllib2); + Py_VISIT(traverse_module_state->__pyx_n_s_urllib_request); + Py_VISIT(traverse_module_state->__pyx_n_s_urlopen); + Py_VISIT(traverse_module_state->__pyx_n_s_val); + Py_VISIT(traverse_module_state->__pyx_n_s_version); + Py_VISIT(traverse_module_state->__pyx_n_s_warning); + Py_VISIT(traverse_module_state->__pyx_n_u_wb); + Py_VISIT(traverse_module_state->__pyx_n_s_word); + Py_VISIT(traverse_module_state->__pyx_n_s_write); + Py_VISIT(traverse_module_state->__pyx_n_u_x); + 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_10); + Py_VISIT(traverse_module_state->__pyx_int_1000000); + Py_VISIT(traverse_module_state->__pyx_int_1048576); + Py_VISIT(traverse_module_state->__pyx_int_neg_1); + Py_VISIT(traverse_module_state->__pyx_tuple__3); + Py_VISIT(traverse_module_state->__pyx_tuple__5); + Py_VISIT(traverse_module_state->__pyx_tuple__6); + Py_VISIT(traverse_module_state->__pyx_tuple__7); + 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__16); + Py_VISIT(traverse_module_state->__pyx_tuple__18); + Py_VISIT(traverse_module_state->__pyx_tuple__20); + Py_VISIT(traverse_module_state->__pyx_tuple__22); + Py_VISIT(traverse_module_state->__pyx_tuple__24); + Py_VISIT(traverse_module_state->__pyx_tuple__25); + Py_VISIT(traverse_module_state->__pyx_tuple__27); + Py_VISIT(traverse_module_state->__pyx_tuple__29); + Py_VISIT(traverse_module_state->__pyx_tuple__35); + Py_VISIT(traverse_module_state->__pyx_tuple__37); + Py_VISIT(traverse_module_state->__pyx_tuple__39); + Py_VISIT(traverse_module_state->__pyx_tuple__44); + Py_VISIT(traverse_module_state->__pyx_tuple__47); + Py_VISIT(traverse_module_state->__pyx_tuple__49); + Py_VISIT(traverse_module_state->__pyx_tuple__51); + Py_VISIT(traverse_module_state->__pyx_tuple__53); + Py_VISIT(traverse_module_state->__pyx_tuple__55); + Py_VISIT(traverse_module_state->__pyx_tuple__57); + Py_VISIT(traverse_module_state->__pyx_tuple__59); + Py_VISIT(traverse_module_state->__pyx_tuple__61); + Py_VISIT(traverse_module_state->__pyx_tuple__63); + Py_VISIT(traverse_module_state->__pyx_tuple__65); + Py_VISIT(traverse_module_state->__pyx_tuple__67); + Py_VISIT(traverse_module_state->__pyx_tuple__69); + Py_VISIT(traverse_module_state->__pyx_tuple__71); + Py_VISIT(traverse_module_state->__pyx_codeobj__11); + Py_VISIT(traverse_module_state->__pyx_codeobj__13); + Py_VISIT(traverse_module_state->__pyx_codeobj__14); + Py_VISIT(traverse_module_state->__pyx_codeobj__15); + Py_VISIT(traverse_module_state->__pyx_codeobj__17); + Py_VISIT(traverse_module_state->__pyx_codeobj__19); + Py_VISIT(traverse_module_state->__pyx_codeobj__21); + Py_VISIT(traverse_module_state->__pyx_codeobj__23); + Py_VISIT(traverse_module_state->__pyx_codeobj__26); + Py_VISIT(traverse_module_state->__pyx_codeobj__28); + Py_VISIT(traverse_module_state->__pyx_codeobj__30); + Py_VISIT(traverse_module_state->__pyx_codeobj__31); + Py_VISIT(traverse_module_state->__pyx_codeobj__32); + Py_VISIT(traverse_module_state->__pyx_codeobj__33); + Py_VISIT(traverse_module_state->__pyx_codeobj__34); + Py_VISIT(traverse_module_state->__pyx_codeobj__36); + Py_VISIT(traverse_module_state->__pyx_codeobj__38); + Py_VISIT(traverse_module_state->__pyx_codeobj__40); + Py_VISIT(traverse_module_state->__pyx_codeobj__41); + Py_VISIT(traverse_module_state->__pyx_codeobj__42); + Py_VISIT(traverse_module_state->__pyx_codeobj__43); + Py_VISIT(traverse_module_state->__pyx_codeobj__45); + Py_VISIT(traverse_module_state->__pyx_codeobj__46); + Py_VISIT(traverse_module_state->__pyx_codeobj__48); + Py_VISIT(traverse_module_state->__pyx_codeobj__50); + Py_VISIT(traverse_module_state->__pyx_codeobj__52); + Py_VISIT(traverse_module_state->__pyx_codeobj__54); + Py_VISIT(traverse_module_state->__pyx_codeobj__56); + Py_VISIT(traverse_module_state->__pyx_codeobj__58); + Py_VISIT(traverse_module_state->__pyx_codeobj__60); + Py_VISIT(traverse_module_state->__pyx_codeobj__62); + Py_VISIT(traverse_module_state->__pyx_codeobj__64); + Py_VISIT(traverse_module_state->__pyx_codeobj__66); + Py_VISIT(traverse_module_state->__pyx_codeobj__68); + Py_VISIT(traverse_module_state->__pyx_codeobj__70); + Py_VISIT(traverse_module_state->__pyx_codeobj__72); + Py_VISIT(traverse_module_state->__pyx_codeobj__73); + Py_VISIT(traverse_module_state->__pyx_codeobj__74); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_4bool_bool __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_7cpython_7complex_complex __pyx_mstate_global->__pyx_ptype_7cpython_7complex_complex +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#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_8pylibemu_EmuProfile __pyx_mstate_global->__pyx_type_8pylibemu_EmuProfile +#define __pyx_type_8pylibemu_Emulator __pyx_mstate_global->__pyx_type_8pylibemu_Emulator +#endif +#define __pyx_ptype_8pylibemu_EmuProfile __pyx_mstate_global->__pyx_ptype_8pylibemu_EmuProfile +#define __pyx_ptype_8pylibemu_Emulator __pyx_mstate_global->__pyx_ptype_8pylibemu_Emulator +#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_kp_u_0_8 __pyx_mstate_global->__pyx_kp_u_0_8 +#define __pyx_kp_u_Downloading __pyx_mstate_global->__pyx_kp_u_Downloading +#define __pyx_n_s_EMU_REGS __pyx_mstate_global->__pyx_n_s_EMU_REGS +#define __pyx_n_s_EmuProfile __pyx_mstate_global->__pyx_n_s_EmuProfile +#define __pyx_n_s_EmuProfile___reduce_cython __pyx_mstate_global->__pyx_n_s_EmuProfile___reduce_cython +#define __pyx_n_s_EmuProfile___setstate_cython __pyx_mstate_global->__pyx_n_s_EmuProfile___setstate_cython +#define __pyx_n_s_Emulator __pyx_mstate_global->__pyx_n_s_Emulator +#define __pyx_n_s_Emulator___reduce_cython __pyx_mstate_global->__pyx_n_s_Emulator___reduce_cython +#define __pyx_n_s_Emulator___setstate_cython __pyx_mstate_global->__pyx_n_s_Emulator___setstate_cython +#define __pyx_n_s_Emulator_cpu_debugflag_set __pyx_mstate_global->__pyx_n_s_Emulator_cpu_debugflag_set +#define __pyx_n_s_Emulator_cpu_debugflag_unset __pyx_mstate_global->__pyx_n_s_Emulator_cpu_debugflag_unset +#define __pyx_n_s_Emulator_cpu_eflags_get __pyx_mstate_global->__pyx_n_s_Emulator_cpu_eflags_get +#define __pyx_n_s_Emulator_cpu_eflags_set __pyx_mstate_global->__pyx_n_s_Emulator_cpu_eflags_set +#define __pyx_n_s_Emulator_cpu_eip_get __pyx_mstate_global->__pyx_n_s_Emulator_cpu_eip_get +#define __pyx_n_s_Emulator_cpu_eip_set __pyx_mstate_global->__pyx_n_s_Emulator_cpu_eip_set +#define __pyx_n_s_Emulator_cpu_get_current_instruc __pyx_mstate_global->__pyx_n_s_Emulator_cpu_get_current_instruc +#define __pyx_n_s_Emulator_cpu_parse __pyx_mstate_global->__pyx_n_s_Emulator_cpu_parse +#define __pyx_n_s_Emulator_cpu_reg16_get __pyx_mstate_global->__pyx_n_s_Emulator_cpu_reg16_get +#define __pyx_n_s_Emulator_cpu_reg16_set __pyx_mstate_global->__pyx_n_s_Emulator_cpu_reg16_set +#define __pyx_n_s_Emulator_cpu_reg32_get __pyx_mstate_global->__pyx_n_s_Emulator_cpu_reg32_get +#define __pyx_n_s_Emulator_cpu_reg32_set __pyx_mstate_global->__pyx_n_s_Emulator_cpu_reg32_set +#define __pyx_n_s_Emulator_cpu_reg8_get __pyx_mstate_global->__pyx_n_s_Emulator_cpu_reg8_get +#define __pyx_n_s_Emulator_cpu_reg8_set __pyx_mstate_global->__pyx_n_s_Emulator_cpu_reg8_set +#define __pyx_n_s_Emulator_cpu_step __pyx_mstate_global->__pyx_n_s_Emulator_cpu_step +#define __pyx_n_s_Emulator_env_w32_hook_check __pyx_mstate_global->__pyx_n_s_Emulator_env_w32_hook_check +#define __pyx_kp_u_Emulator_environment_error __pyx_mstate_global->__pyx_kp_u_Emulator_environment_error +#define __pyx_n_s_Emulator_free __pyx_mstate_global->__pyx_n_s_Emulator_free +#define __pyx_n_s_Emulator_memory_read_block __pyx_mstate_global->__pyx_n_s_Emulator_memory_read_block +#define __pyx_n_s_Emulator_memory_read_byte __pyx_mstate_global->__pyx_n_s_Emulator_memory_read_byte +#define __pyx_n_s_Emulator_memory_read_dword __pyx_mstate_global->__pyx_n_s_Emulator_memory_read_dword +#define __pyx_n_s_Emulator_memory_read_string __pyx_mstate_global->__pyx_n_s_Emulator_memory_read_string +#define __pyx_n_s_Emulator_memory_read_word __pyx_mstate_global->__pyx_n_s_Emulator_memory_read_word +#define __pyx_n_s_Emulator_memory_segment_get __pyx_mstate_global->__pyx_n_s_Emulator_memory_segment_get +#define __pyx_n_s_Emulator_memory_segment_select __pyx_mstate_global->__pyx_n_s_Emulator_memory_segment_select +#define __pyx_n_s_Emulator_memory_write_block __pyx_mstate_global->__pyx_n_s_Emulator_memory_write_block +#define __pyx_n_s_Emulator_memory_write_byte __pyx_mstate_global->__pyx_n_s_Emulator_memory_write_byte +#define __pyx_n_s_Emulator_memory_write_dword __pyx_mstate_global->__pyx_n_s_Emulator_memory_write_dword +#define __pyx_n_s_Emulator_memory_write_word __pyx_mstate_global->__pyx_n_s_Emulator_memory_write_word +#define __pyx_n_s_Emulator_new __pyx_mstate_global->__pyx_n_s_Emulator_new +#define __pyx_kp_u_Emulator_not_initialized __pyx_mstate_global->__pyx_kp_u_Emulator_not_initialized +#define __pyx_n_s_Emulator_prepare __pyx_mstate_global->__pyx_n_s_Emulator_prepare +#define __pyx_n_s_Emulator_run __pyx_mstate_global->__pyx_n_s_Emulator_run +#define __pyx_n_s_Emulator_set_output_size __pyx_mstate_global->__pyx_n_s_Emulator_set_output_size +#define __pyx_n_s_Emulator_shellcode_getpc_test __pyx_mstate_global->__pyx_n_s_Emulator_shellcode_getpc_test +#define __pyx_n_s_Emulator_test __pyx_mstate_global->__pyx_n_s_Emulator_test +#define __pyx_n_u_Error __pyx_mstate_global->__pyx_n_u_Error +#define __pyx_kp_u_Error_while_allocating_memory __pyx_mstate_global->__pyx_kp_u_Error_while_allocating_memory +#define __pyx_kp_u_Error_while_downloading_from __pyx_mstate_global->__pyx_kp_u_Error_while_downloading_from +#define __pyx_kp_u_Error_while_reading_a_byte_at_ad __pyx_mstate_global->__pyx_kp_u_Error_while_reading_a_byte_at_ad +#define __pyx_kp_u_Error_while_reading_a_dword_at_a __pyx_mstate_global->__pyx_kp_u_Error_while_reading_a_dword_at_a +#define __pyx_kp_u_Error_while_reading_a_string_at __pyx_mstate_global->__pyx_kp_u_Error_while_reading_a_string_at +#define __pyx_kp_u_Error_while_reading_a_word_at_ad __pyx_mstate_global->__pyx_kp_u_Error_while_reading_a_word_at_ad +#define __pyx_n_u_ExitProcess __pyx_mstate_global->__pyx_n_u_ExitProcess +#define __pyx_n_u_ExitThread __pyx_mstate_global->__pyx_n_u_ExitThread +#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError +#define __pyx_kp_u_Memory_allocation_error __pyx_mstate_global->__pyx_kp_u_Memory_allocation_error +#define __pyx_n_s_RuntimeError __pyx_mstate_global->__pyx_n_s_RuntimeError +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_kp_u_Unhooked_call_to __pyx_mstate_global->__pyx_kp_u_Unhooked_call_to +#define __pyx_kp_u_Y_m_d_H_M_S __pyx_mstate_global->__pyx_kp_u_Y_m_d_H_M_S +#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 +#define __pyx_kp_u__4 __pyx_mstate_global->__pyx_kp_u__4 +#define __pyx_n_s__75 __pyx_mstate_global->__pyx_n_s__75 +#define __pyx_n_s__8 __pyx_mstate_global->__pyx_n_s__8 +#define __pyx_n_s_addr __pyx_mstate_global->__pyx_n_s_addr +#define __pyx_kp_u_asctime_s_message_s __pyx_mstate_global->__pyx_kp_u_asctime_s_message_s +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_basicConfig __pyx_mstate_global->__pyx_n_s_basicConfig +#define __pyx_n_s_block __pyx_mstate_global->__pyx_n_s_block +#define __pyx_n_s_buffer __pyx_mstate_global->__pyx_n_s_buffer +#define __pyx_n_s_byte __pyx_mstate_global->__pyx_n_s_byte +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_cpu __pyx_mstate_global->__pyx_n_s_cpu +#define __pyx_n_s_cpu_debugflag_set __pyx_mstate_global->__pyx_n_s_cpu_debugflag_set +#define __pyx_n_s_cpu_debugflag_unset __pyx_mstate_global->__pyx_n_s_cpu_debugflag_unset +#define __pyx_n_s_cpu_eflags_get __pyx_mstate_global->__pyx_n_s_cpu_eflags_get +#define __pyx_n_s_cpu_eflags_set __pyx_mstate_global->__pyx_n_s_cpu_eflags_set +#define __pyx_n_s_cpu_eip_get __pyx_mstate_global->__pyx_n_s_cpu_eip_get +#define __pyx_n_s_cpu_eip_set __pyx_mstate_global->__pyx_n_s_cpu_eip_set +#define __pyx_n_s_cpu_get_current_instruction __pyx_mstate_global->__pyx_n_s_cpu_get_current_instruction +#define __pyx_n_s_cpu_parse __pyx_mstate_global->__pyx_n_s_cpu_parse +#define __pyx_n_s_cpu_reg16_get __pyx_mstate_global->__pyx_n_s_cpu_reg16_get +#define __pyx_n_s_cpu_reg16_set __pyx_mstate_global->__pyx_n_s_cpu_reg16_set +#define __pyx_n_s_cpu_reg32_get __pyx_mstate_global->__pyx_n_s_cpu_reg32_get +#define __pyx_n_s_cpu_reg32_set __pyx_mstate_global->__pyx_n_s_cpu_reg32_set +#define __pyx_n_s_cpu_reg8_get __pyx_mstate_global->__pyx_n_s_cpu_reg8_get +#define __pyx_n_s_cpu_reg8_set __pyx_mstate_global->__pyx_n_s_cpu_reg8_set +#define __pyx_n_s_cpu_step __pyx_mstate_global->__pyx_n_s_cpu_step +#define __pyx_n_s_datefmt __pyx_mstate_global->__pyx_n_s_datefmt +#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_n_s_doc __pyx_mstate_global->__pyx_n_s_doc +#define __pyx_n_s_dword __pyx_mstate_global->__pyx_n_s_dword +#define __pyx_n_s_eax __pyx_mstate_global->__pyx_n_s_eax +#define __pyx_n_s_ebp __pyx_mstate_global->__pyx_n_s_ebp +#define __pyx_n_s_ebx __pyx_mstate_global->__pyx_n_s_ebx +#define __pyx_n_s_ecx __pyx_mstate_global->__pyx_n_s_ecx +#define __pyx_n_s_edi __pyx_mstate_global->__pyx_n_s_edi +#define __pyx_n_s_edx __pyx_mstate_global->__pyx_n_s_edx +#define __pyx_n_s_eip __pyx_mstate_global->__pyx_n_s_eip +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_enable_hooks __pyx_mstate_global->__pyx_n_s_enable_hooks +#define __pyx_n_s_enter __pyx_mstate_global->__pyx_n_s_enter +#define __pyx_n_s_env __pyx_mstate_global->__pyx_n_s_env +#define __pyx_n_s_env_w32_hook_check __pyx_mstate_global->__pyx_n_s_env_w32_hook_check +#define __pyx_n_s_esi __pyx_mstate_global->__pyx_n_s_esi +#define __pyx_n_s_esp __pyx_mstate_global->__pyx_n_s_esp +#define __pyx_n_s_exit __pyx_mstate_global->__pyx_n_s_exit +#define __pyx_n_s_exit_2 __pyx_mstate_global->__pyx_n_s_exit_2 +#define __pyx_n_u_exit_3 __pyx_mstate_global->__pyx_n_u_exit_3 +#define __pyx_n_s_flag __pyx_mstate_global->__pyx_n_s_flag +#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format +#define __pyx_n_s_free __pyx_mstate_global->__pyx_n_s_free +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_n_s_hashlib __pyx_mstate_global->__pyx_n_s_hashlib +#define __pyx_n_s_hexdigest __pyx_mstate_global->__pyx_n_s_hexdigest +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_init_subclass __pyx_mstate_global->__pyx_n_s_init_subclass +#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing +#define __pyx_n_s_instr_string __pyx_mstate_global->__pyx_n_s_instr_string +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_j __pyx_mstate_global->__pyx_n_s_j +#define __pyx_n_s_len __pyx_mstate_global->__pyx_n_s_len +#define __pyx_n_s_logging __pyx_mstate_global->__pyx_n_s_logging +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_maxsize __pyx_mstate_global->__pyx_n_s_maxsize +#define __pyx_n_s_md5 __pyx_mstate_global->__pyx_n_s_md5 +#define __pyx_n_s_mem __pyx_mstate_global->__pyx_n_s_mem +#define __pyx_n_s_memory_read_block __pyx_mstate_global->__pyx_n_s_memory_read_block +#define __pyx_n_s_memory_read_byte __pyx_mstate_global->__pyx_n_s_memory_read_byte +#define __pyx_n_s_memory_read_dword __pyx_mstate_global->__pyx_n_s_memory_read_dword +#define __pyx_n_s_memory_read_string __pyx_mstate_global->__pyx_n_s_memory_read_string +#define __pyx_n_s_memory_read_word __pyx_mstate_global->__pyx_n_s_memory_read_word +#define __pyx_n_s_memory_segment_get __pyx_mstate_global->__pyx_n_s_memory_segment_get +#define __pyx_n_s_memory_segment_select __pyx_mstate_global->__pyx_n_s_memory_segment_select +#define __pyx_n_s_memory_write_block __pyx_mstate_global->__pyx_n_s_memory_write_block +#define __pyx_n_s_memory_write_byte __pyx_mstate_global->__pyx_n_s_memory_write_byte +#define __pyx_n_s_memory_write_dword __pyx_mstate_global->__pyx_n_s_memory_write_dword +#define __pyx_n_s_memory_write_word __pyx_mstate_global->__pyx_n_s_memory_write_word +#define __pyx_n_s_metaclass __pyx_mstate_global->__pyx_n_s_metaclass +#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode +#define __pyx_n_s_module __pyx_mstate_global->__pyx_n_s_module +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#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_offset __pyx_mstate_global->__pyx_n_s_offset +#define __pyx_n_s_open __pyx_mstate_global->__pyx_n_s_open +#define __pyx_n_s_output_size __pyx_mstate_global->__pyx_n_s_output_size +#define __pyx_n_s_prepare __pyx_mstate_global->__pyx_n_s_prepare +#define __pyx_n_s_prepare_2 __pyx_mstate_global->__pyx_n_s_prepare_2 +#define __pyx_n_s_print __pyx_mstate_global->__pyx_n_s_print +#define __pyx_n_s_pylibemu __pyx_mstate_global->__pyx_n_s_pylibemu +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable +#define __pyx_n_s_qualname __pyx_mstate_global->__pyx_n_s_qualname +#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_reduce __pyx_mstate_global->__pyx_n_s_reduce +#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_reg __pyx_mstate_global->__pyx_n_s_reg +#define __pyx_n_s_request __pyx_mstate_global->__pyx_n_s_request +#define __pyx_n_s_run __pyx_mstate_global->__pyx_n_s_run +#define __pyx_n_s_s __pyx_mstate_global->__pyx_n_s_s +#define __pyx_n_s_sclen __pyx_mstate_global->__pyx_n_s_sclen +#define __pyx_n_s_scode __pyx_mstate_global->__pyx_n_s_scode +#define __pyx_n_s_segment __pyx_mstate_global->__pyx_n_s_segment +#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self +#define __pyx_n_s_set_name __pyx_mstate_global->__pyx_n_s_set_name +#define __pyx_n_s_set_output_size __pyx_mstate_global->__pyx_n_s_set_output_size +#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_shellcode __pyx_mstate_global->__pyx_n_s_shellcode +#define __pyx_n_s_shellcode_getpc_test __pyx_mstate_global->__pyx_n_s_shellcode_getpc_test +#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec +#define __pyx_n_s_src __pyx_mstate_global->__pyx_n_s_src +#define __pyx_kp_s_src_pylibemu_pyx __pyx_mstate_global->__pyx_kp_s_src_pylibemu_pyx +#define __pyx_n_s_static_offset __pyx_mstate_global->__pyx_n_s_static_offset +#define __pyx_n_s_steps __pyx_mstate_global->__pyx_n_s_steps +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_super __pyx_mstate_global->__pyx_n_s_super +#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_test_2 __pyx_mstate_global->__pyx_n_s_test_2 +#define __pyx_n_s_timeout __pyx_mstate_global->__pyx_n_s_timeout +#define __pyx_n_s_urllib __pyx_mstate_global->__pyx_n_s_urllib +#define __pyx_n_s_urllib2 __pyx_mstate_global->__pyx_n_s_urllib2 +#define __pyx_n_s_urllib_request __pyx_mstate_global->__pyx_n_s_urllib_request +#define __pyx_n_s_urlopen __pyx_mstate_global->__pyx_n_s_urlopen +#define __pyx_n_s_val __pyx_mstate_global->__pyx_n_s_val +#define __pyx_n_s_version __pyx_mstate_global->__pyx_n_s_version +#define __pyx_n_s_warning __pyx_mstate_global->__pyx_n_s_warning +#define __pyx_n_u_wb __pyx_mstate_global->__pyx_n_u_wb +#define __pyx_n_s_word __pyx_mstate_global->__pyx_n_s_word +#define __pyx_n_s_write __pyx_mstate_global->__pyx_n_s_write +#define __pyx_n_u_x __pyx_mstate_global->__pyx_n_u_x +#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_10 __pyx_mstate_global->__pyx_int_10 +#define __pyx_int_1000000 __pyx_mstate_global->__pyx_int_1000000 +#define __pyx_int_1048576 __pyx_mstate_global->__pyx_int_1048576 +#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 +#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3 +#define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5 +#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 +#define __pyx_tuple__7 __pyx_mstate_global->__pyx_tuple__7 +#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__16 __pyx_mstate_global->__pyx_tuple__16 +#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18 +#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20 +#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22 +#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24 +#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25 +#define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27 +#define __pyx_tuple__29 __pyx_mstate_global->__pyx_tuple__29 +#define __pyx_tuple__35 __pyx_mstate_global->__pyx_tuple__35 +#define __pyx_tuple__37 __pyx_mstate_global->__pyx_tuple__37 +#define __pyx_tuple__39 __pyx_mstate_global->__pyx_tuple__39 +#define __pyx_tuple__44 __pyx_mstate_global->__pyx_tuple__44 +#define __pyx_tuple__47 __pyx_mstate_global->__pyx_tuple__47 +#define __pyx_tuple__49 __pyx_mstate_global->__pyx_tuple__49 +#define __pyx_tuple__51 __pyx_mstate_global->__pyx_tuple__51 +#define __pyx_tuple__53 __pyx_mstate_global->__pyx_tuple__53 +#define __pyx_tuple__55 __pyx_mstate_global->__pyx_tuple__55 +#define __pyx_tuple__57 __pyx_mstate_global->__pyx_tuple__57 +#define __pyx_tuple__59 __pyx_mstate_global->__pyx_tuple__59 +#define __pyx_tuple__61 __pyx_mstate_global->__pyx_tuple__61 +#define __pyx_tuple__63 __pyx_mstate_global->__pyx_tuple__63 +#define __pyx_tuple__65 __pyx_mstate_global->__pyx_tuple__65 +#define __pyx_tuple__67 __pyx_mstate_global->__pyx_tuple__67 +#define __pyx_tuple__69 __pyx_mstate_global->__pyx_tuple__69 +#define __pyx_tuple__71 __pyx_mstate_global->__pyx_tuple__71 +#define __pyx_codeobj__11 __pyx_mstate_global->__pyx_codeobj__11 +#define __pyx_codeobj__13 __pyx_mstate_global->__pyx_codeobj__13 +#define __pyx_codeobj__14 __pyx_mstate_global->__pyx_codeobj__14 +#define __pyx_codeobj__15 __pyx_mstate_global->__pyx_codeobj__15 +#define __pyx_codeobj__17 __pyx_mstate_global->__pyx_codeobj__17 +#define __pyx_codeobj__19 __pyx_mstate_global->__pyx_codeobj__19 +#define __pyx_codeobj__21 __pyx_mstate_global->__pyx_codeobj__21 +#define __pyx_codeobj__23 __pyx_mstate_global->__pyx_codeobj__23 +#define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26 +#define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28 +#define __pyx_codeobj__30 __pyx_mstate_global->__pyx_codeobj__30 +#define __pyx_codeobj__31 __pyx_mstate_global->__pyx_codeobj__31 +#define __pyx_codeobj__32 __pyx_mstate_global->__pyx_codeobj__32 +#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33 +#define __pyx_codeobj__34 __pyx_mstate_global->__pyx_codeobj__34 +#define __pyx_codeobj__36 __pyx_mstate_global->__pyx_codeobj__36 +#define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38 +#define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40 +#define __pyx_codeobj__41 __pyx_mstate_global->__pyx_codeobj__41 +#define __pyx_codeobj__42 __pyx_mstate_global->__pyx_codeobj__42 +#define __pyx_codeobj__43 __pyx_mstate_global->__pyx_codeobj__43 +#define __pyx_codeobj__45 __pyx_mstate_global->__pyx_codeobj__45 +#define __pyx_codeobj__46 __pyx_mstate_global->__pyx_codeobj__46 +#define __pyx_codeobj__48 __pyx_mstate_global->__pyx_codeobj__48 +#define __pyx_codeobj__50 __pyx_mstate_global->__pyx_codeobj__50 +#define __pyx_codeobj__52 __pyx_mstate_global->__pyx_codeobj__52 +#define __pyx_codeobj__54 __pyx_mstate_global->__pyx_codeobj__54 +#define __pyx_codeobj__56 __pyx_mstate_global->__pyx_codeobj__56 +#define __pyx_codeobj__58 __pyx_mstate_global->__pyx_codeobj__58 +#define __pyx_codeobj__60 __pyx_mstate_global->__pyx_codeobj__60 +#define __pyx_codeobj__62 __pyx_mstate_global->__pyx_codeobj__62 +#define __pyx_codeobj__64 __pyx_mstate_global->__pyx_codeobj__64 +#define __pyx_codeobj__66 __pyx_mstate_global->__pyx_codeobj__66 +#define __pyx_codeobj__68 __pyx_mstate_global->__pyx_codeobj__68 +#define __pyx_codeobj__70 __pyx_mstate_global->__pyx_codeobj__70 +#define __pyx_codeobj__72 __pyx_mstate_global->__pyx_codeobj__72 +#define __pyx_codeobj__73 __pyx_mstate_global->__pyx_codeobj__73 +#define __pyx_codeobj__74 __pyx_mstate_global->__pyx_codeobj__74 +/* #### Code section: module_code ### */ + +/* "cpython/complex.pxd":19 + * + * @property + * cdef inline double real(self): # <<<<<<<<<<<<<< + * return self.cval.real + * + */ + +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) { + double __pyx_r; + + /* "cpython/complex.pxd":20 + * @property + * cdef inline double real(self): + * return self.cval.real # <<<<<<<<<<<<<< + * + * @property + */ + __pyx_r = __pyx_v_self->cval.real; + goto __pyx_L0; + + /* "cpython/complex.pxd":19 + * + * @property + * cdef inline double real(self): # <<<<<<<<<<<<<< + * return self.cval.real * - * va_start(args, hook) - * exitcode = va_arg(args, int_type) # <<<<<<<<<<<<<< - * va_end(args) - * return 0 */ - __pyx_v_exitcode = ((int)va_arg(__pyx_v_args, int)); - /* "pylibemu.pyx":58 - * va_start(args, hook) - * exitcode = va_arg(args, int_type) - * va_end(args) # <<<<<<<<<<<<<< - * return 0 + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "cpython/complex.pxd":23 + * + * @property + * cdef inline double imag(self): # <<<<<<<<<<<<<< + * return self.cval.imag * */ - va_end(__pyx_v_args); - /* "pylibemu.pyx":59 - * exitcode = va_arg(args, int_type) - * va_end(args) - * return 0 # <<<<<<<<<<<<<< +static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) { + double __pyx_r; + + /* "cpython/complex.pxd":24 + * @property + * cdef inline double imag(self): + * return self.cval.imag # <<<<<<<<<<<<<< * - * cdef uint32_t ExitThread(c_emu_env *env, c_emu_env_hook *hook...): + * # PyTypeObject PyComplex_Type */ - __pyx_r = 0; + __pyx_r = __pyx_v_self->cval.imag; goto __pyx_L0; - /* "pylibemu.pyx":52 + /* "cpython/complex.pxd":23 + * + * @property + * cdef inline double imag(self): # <<<<<<<<<<<<<< + * return self.cval.imag * - * # User hooks - * cdef uint32_t ExitProcess(c_emu_env *env, c_emu_env_hook *hook...): # <<<<<<<<<<<<<< - * cdef va_list args - * cdef int exitcode */ /* function exit code */ __pyx_L0:; - __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pylibemu.pyx":61 - * return 0 +/* "cpython/contextvars.pxd":112 * - * cdef uint32_t ExitThread(c_emu_env *env, c_emu_env_hook *hook...): # <<<<<<<<<<<<<< - * cdef va_list args - * cdef int exitcode + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, */ -static uint32_t __pyx_f_8pylibemu_ExitThread(CYTHON_UNUSED struct emu_env *__pyx_v_env, struct emu_env_hook *__pyx_v_hook, ...) { - va_list __pyx_v_args; - CYTHON_UNUSED int __pyx_v_exitcode; - uint32_t __pyx_r; +static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value *__pyx_optional_args) { + PyObject *__pyx_v_default_value = ((PyObject *)Py_None); + PyObject *__pyx_v_value; + PyObject *__pyx_v_pyvalue = NULL; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("ExitThread", 0); + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_value", 1); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_default_value = __pyx_optional_args->default_value; + } + } - /* "pylibemu.pyx":65 - * cdef int exitcode - * - * va_start(args, hook) # <<<<<<<<<<<<<< - * exitcode = va_arg(args, int_type) - * va_end(args) + /* "cpython/contextvars.pxd":117 + * or None if no such value or default was found. + * """ + * cdef PyObject *value = NULL # <<<<<<<<<<<<<< + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: */ - va_start(__pyx_v_args, ((void *)__pyx_v_hook)); + __pyx_v_value = NULL; - /* "pylibemu.pyx":66 - * - * va_start(args, hook) - * exitcode = va_arg(args, int_type) # <<<<<<<<<<<<<< - * va_end(args) - * return 0 + /* "cpython/contextvars.pxd":118 + * """ + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) # <<<<<<<<<<<<<< + * if value is NULL: + * # context variable does not have a default */ - __pyx_v_exitcode = ((int)va_arg(__pyx_v_args, int)); + __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 118, __pyx_L1_error) - /* "pylibemu.pyx":67 - * va_start(args, hook) - * exitcode = va_arg(args, int_type) - * va_end(args) # <<<<<<<<<<<<<< - * return 0 + /* "cpython/contextvars.pxd":119 + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: # <<<<<<<<<<<<<< + * # context variable does not have a default + * pyvalue = default_value + */ + __pyx_t_2 = (__pyx_v_value == NULL); + if (__pyx_t_2) { + + /* "cpython/contextvars.pxd":121 + * if value is NULL: + * # context variable does not have a default + * pyvalue = default_value # <<<<<<<<<<<<<< + * else: + * # value or default value of context variable + */ + __Pyx_INCREF(__pyx_v_default_value); + __pyx_v_pyvalue = __pyx_v_default_value; + + /* "cpython/contextvars.pxd":119 + * cdef PyObject *value = NULL + * PyContextVar_Get(var, NULL, &value) + * if value is NULL: # <<<<<<<<<<<<<< + * # context variable does not have a default + * pyvalue = default_value + */ + goto __pyx_L3; + } + + /* "cpython/contextvars.pxd":124 + * else: + * # value or default value of context variable + * pyvalue = value # <<<<<<<<<<<<<< + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue + */ + /*else*/ { + __pyx_t_3 = ((PyObject *)__pyx_v_value); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_pyvalue = __pyx_t_3; + __pyx_t_3 = 0; + + /* "cpython/contextvars.pxd":125 + * # value or default value of context variable + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<< + * return pyvalue * */ - va_end(__pyx_v_args); + Py_XDECREF(__pyx_v_value); + } + __pyx_L3:; - /* "pylibemu.pyx":68 - * exitcode = va_arg(args, int_type) - * va_end(args) - * return 0 # <<<<<<<<<<<<<< + /* "cpython/contextvars.pxd":126 + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue # <<<<<<<<<<<<<< + * * - * cdef uint32_t URLDownloadToFile(c_emu_env *env, c_emu_env_hook *hook...): */ - __pyx_r = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_pyvalue); + __pyx_r = __pyx_v_pyvalue; goto __pyx_L0; - /* "pylibemu.pyx":61 - * return 0 + /* "cpython/contextvars.pxd":112 * - * cdef uint32_t ExitThread(c_emu_env *env, c_emu_env_hook *hook...): # <<<<<<<<<<<<<< - * cdef va_list args - * cdef int exitcode + * + * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the default value of the context variable, */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_pyvalue); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pylibemu.pyx":70 - * return 0 +/* "cpython/contextvars.pxd":129 * - * cdef uint32_t URLDownloadToFile(c_emu_env *env, c_emu_env_hook *hook...): # <<<<<<<<<<<<<< - * cdef va_list args - * cdef void *pCaller + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. */ -static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env *__pyx_v_env, struct emu_env_hook *__pyx_v_hook, ...) { - va_list __pyx_v_args; - CYTHON_UNUSED void *__pyx_v_pCaller; - char *__pyx_v_szURL; - char *__pyx_v_szFileName; - CYTHON_UNUSED int __pyx_v_dwReserved; - CYTHON_UNUSED void *__pyx_v_lpfnCB; - PyObject *__pyx_v_url = NULL; - PyObject *__pyx_v_content = NULL; - PyObject *__pyx_v_m = NULL; - PyObject *__pyx_v_fd = NULL; - uint32_t __pyx_r; +static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_default(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default *__pyx_optional_args) { + PyObject *__pyx_v_default_value = ((PyObject *)Py_None); + PyObject *__pyx_v_value; + PyObject *__pyx_v_pyvalue = NULL; + 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; - Py_ssize_t __pyx_t_4; - Py_UCS4 __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - 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_t_15; - int __pyx_t_16; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("URLDownloadToFile", 0); + __Pyx_RefNannySetupContext("get_value_no_default", 1); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_default_value = __pyx_optional_args->default_value; + } + } - /* "pylibemu.pyx":79 - * cdef void *p + /* "cpython/contextvars.pxd":135 + * Ignores the default value of the context variable, if any. + * """ + * cdef PyObject *value = NULL # <<<<<<<<<<<<<< + * PyContextVar_Get(var, default_value, &value) + * # value of context variable or 'default_value' + */ + __pyx_v_value = NULL; + + /* "cpython/contextvars.pxd":136 + * """ + * cdef PyObject *value = NULL + * PyContextVar_Get(var, default_value, &value) # <<<<<<<<<<<<<< + * # value of context variable or 'default_value' + * pyvalue = value + */ + __pyx_t_1 = PyContextVar_Get(__pyx_v_var, ((PyObject *)__pyx_v_default_value), (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 136, __pyx_L1_error) + + /* "cpython/contextvars.pxd":138 + * PyContextVar_Get(var, default_value, &value) + * # value of context variable or 'default_value' + * pyvalue = value # <<<<<<<<<<<<<< + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue + */ + __pyx_t_2 = ((PyObject *)__pyx_v_value); + __Pyx_INCREF(__pyx_t_2); + __pyx_v_pyvalue = __pyx_t_2; + __pyx_t_2 = 0; + + /* "cpython/contextvars.pxd":139 + * # value of context variable or 'default_value' + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<< + * return pyvalue + */ + Py_XDECREF(__pyx_v_value); + + /* "cpython/contextvars.pxd":140 + * pyvalue = value + * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' + * return pyvalue # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_pyvalue); + __pyx_r = __pyx_v_pyvalue; + goto __pyx_L0; + + /* "cpython/contextvars.pxd":129 + * + * + * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<< + * """Return a new reference to the value of the context variable, + * or the provided default value if no such value was found. + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_pyvalue); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pylibemu.pyx":52 + * + * # User hooks + * cdef uint32_t ExitProcess(c_emu_env *env, c_emu_env_hook *hook...) noexcept: # <<<<<<<<<<<<<< + * cdef va_list args + * cdef int _exitcode + */ + +static uint32_t __pyx_f_8pylibemu_ExitProcess(CYTHON_UNUSED struct emu_env *__pyx_v_env, struct emu_env_hook *__pyx_v_hook, ...) { + va_list __pyx_v_args; + CYTHON_UNUSED int __pyx_v__exitcode; + uint32_t __pyx_r; + + /* "pylibemu.pyx":56 + * cdef int _exitcode + * + * va_start(args, hook) # <<<<<<<<<<<<<< + * _exitcode = va_arg(args, int_type) + * va_end(args) + */ + va_start(__pyx_v_args, ((void *)__pyx_v_hook)); + + /* "pylibemu.pyx":57 + * + * va_start(args, hook) + * _exitcode = va_arg(args, int_type) # <<<<<<<<<<<<<< + * va_end(args) + * return 0 + */ + __pyx_v__exitcode = ((int)va_arg(__pyx_v_args, int)); + + /* "pylibemu.pyx":58 + * va_start(args, hook) + * _exitcode = va_arg(args, int_type) + * va_end(args) # <<<<<<<<<<<<<< + * return 0 + * + */ + va_end(__pyx_v_args); + + /* "pylibemu.pyx":59 + * _exitcode = va_arg(args, int_type) + * va_end(args) + * return 0 # <<<<<<<<<<<<<< + * + * cdef uint32_t ExitThread(c_emu_env *env, c_emu_env_hook *hook...) noexcept: + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "pylibemu.pyx":52 + * + * # User hooks + * cdef uint32_t ExitProcess(c_emu_env *env, c_emu_env_hook *hook...) noexcept: # <<<<<<<<<<<<<< + * cdef va_list args + * cdef int _exitcode + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "pylibemu.pyx":61 + * return 0 + * + * cdef uint32_t ExitThread(c_emu_env *env, c_emu_env_hook *hook...) noexcept: # <<<<<<<<<<<<<< + * cdef va_list args + * cdef int _exitcode + */ + +static uint32_t __pyx_f_8pylibemu_ExitThread(CYTHON_UNUSED struct emu_env *__pyx_v_env, struct emu_env_hook *__pyx_v_hook, ...) { + va_list __pyx_v_args; + CYTHON_UNUSED int __pyx_v__exitcode; + uint32_t __pyx_r; + + /* "pylibemu.pyx":65 + * cdef int _exitcode + * + * va_start(args, hook) # <<<<<<<<<<<<<< + * _exitcode = va_arg(args, int_type) + * va_end(args) + */ + va_start(__pyx_v_args, ((void *)__pyx_v_hook)); + + /* "pylibemu.pyx":66 + * + * va_start(args, hook) + * _exitcode = va_arg(args, int_type) # <<<<<<<<<<<<<< + * va_end(args) + * return 0 + */ + __pyx_v__exitcode = ((int)va_arg(__pyx_v_args, int)); + + /* "pylibemu.pyx":67 + * va_start(args, hook) + * _exitcode = va_arg(args, int_type) + * va_end(args) # <<<<<<<<<<<<<< + * return 0 + * + */ + va_end(__pyx_v_args); + + /* "pylibemu.pyx":68 + * _exitcode = va_arg(args, int_type) + * va_end(args) + * return 0 # <<<<<<<<<<<<<< + * + * cdef uint32_t URLDownloadToFile(c_emu_env *env, c_emu_env_hook *hook...) noexcept: + */ + __pyx_r = 0; + goto __pyx_L0; + + /* "pylibemu.pyx":61 + * return 0 + * + * cdef uint32_t ExitThread(c_emu_env *env, c_emu_env_hook *hook...) noexcept: # <<<<<<<<<<<<<< + * cdef va_list args + * cdef int _exitcode + */ + + /* function exit code */ + __pyx_L0:; + return __pyx_r; +} + +/* "pylibemu.pyx":70 + * return 0 + * + * cdef uint32_t URLDownloadToFile(c_emu_env *env, c_emu_env_hook *hook...) noexcept: # <<<<<<<<<<<<<< + * cdef va_list args + * cdef void *_pCaller + */ + +static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env *__pyx_v_env, struct emu_env_hook *__pyx_v_hook, ...) { + va_list __pyx_v_args; + CYTHON_UNUSED void *__pyx_v__pCaller; + char *__pyx_v_szURL; + char *__pyx_v_szFileName; + CYTHON_UNUSED int __pyx_v__dwReserved; + CYTHON_UNUSED void *__pyx_v__lpfnCB; + PyObject *__pyx_v_url = NULL; + PyObject *__pyx_v_content = NULL; + PyObject *__pyx_v_m = NULL; + PyObject *__pyx_v_fd = NULL; + uint32_t __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; + Py_UCS4 __pyx_t_5; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __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; + PyObject *__pyx_t_15 = NULL; + PyObject *__pyx_t_16 = NULL; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("URLDownloadToFile", 1); + + /* "pylibemu.pyx":78 + * cdef void *_lpfnCB * * va_start(args, hook) # <<<<<<<<<<<<<< - * pCaller = va_arg(args, void_ptr_type) + * _pCaller = va_arg(args, void_ptr_type) * szURL = va_arg(args, char_ptr_type) */ va_start(__pyx_v_args, ((void *)__pyx_v_hook)); - /* "pylibemu.pyx":80 + /* "pylibemu.pyx":79 * * va_start(args, hook) - * pCaller = va_arg(args, void_ptr_type) # <<<<<<<<<<<<<< + * _pCaller = va_arg(args, void_ptr_type) # <<<<<<<<<<<<<< * szURL = va_arg(args, char_ptr_type) * szFileName = va_arg(args, char_ptr_type) */ - __pyx_v_pCaller = ((void *)va_arg(__pyx_v_args, void *)); + __pyx_v__pCaller = ((void *)va_arg(__pyx_v_args, void *)); - /* "pylibemu.pyx":81 + /* "pylibemu.pyx":80 * va_start(args, hook) - * pCaller = va_arg(args, void_ptr_type) + * _pCaller = va_arg(args, void_ptr_type) * szURL = va_arg(args, char_ptr_type) # <<<<<<<<<<<<<< * szFileName = va_arg(args, char_ptr_type) - * dwReserved = va_arg(args, int_type) + * _dwReserved = va_arg(args, int_type) */ __pyx_v_szURL = ((char *)va_arg(__pyx_v_args, char *)); - /* "pylibemu.pyx":82 - * pCaller = va_arg(args, void_ptr_type) + /* "pylibemu.pyx":81 + * _pCaller = va_arg(args, void_ptr_type) * szURL = va_arg(args, char_ptr_type) * szFileName = va_arg(args, char_ptr_type) # <<<<<<<<<<<<<< - * dwReserved = va_arg(args, int_type) - * lpfnCB = va_arg(args, void_ptr_type) + * _dwReserved = va_arg(args, int_type) + * _lpfnCB = va_arg(args, void_ptr_type) */ __pyx_v_szFileName = ((char *)va_arg(__pyx_v_args, char *)); - /* "pylibemu.pyx":83 + /* "pylibemu.pyx":82 * szURL = va_arg(args, char_ptr_type) * szFileName = va_arg(args, char_ptr_type) - * dwReserved = va_arg(args, int_type) # <<<<<<<<<<<<<< - * lpfnCB = va_arg(args, void_ptr_type) + * _dwReserved = va_arg(args, int_type) # <<<<<<<<<<<<<< + * _lpfnCB = va_arg(args, void_ptr_type) * va_end(args) */ - __pyx_v_dwReserved = ((int)va_arg(__pyx_v_args, int)); + __pyx_v__dwReserved = ((int)va_arg(__pyx_v_args, int)); - /* "pylibemu.pyx":84 + /* "pylibemu.pyx":83 * szFileName = va_arg(args, char_ptr_type) - * dwReserved = va_arg(args, int_type) - * lpfnCB = va_arg(args, void_ptr_type) # <<<<<<<<<<<<<< + * _dwReserved = va_arg(args, int_type) + * _lpfnCB = va_arg(args, void_ptr_type) # <<<<<<<<<<<<<< * va_end(args) * */ - __pyx_v_lpfnCB = ((void *)va_arg(__pyx_v_args, void *)); + __pyx_v__lpfnCB = ((void *)va_arg(__pyx_v_args, void *)); - /* "pylibemu.pyx":85 - * dwReserved = va_arg(args, int_type) - * lpfnCB = va_arg(args, void_ptr_type) + /* "pylibemu.pyx":84 + * _dwReserved = va_arg(args, int_type) + * _lpfnCB = va_arg(args, void_ptr_type) * va_end(args) # <<<<<<<<<<<<<< * * logging.warning("Downloading %s (%s)" % (szURL.decode('utf-8'), */ va_end(__pyx_v_args); - /* "pylibemu.pyx":87 + /* "pylibemu.pyx":86 * va_end(args) * * logging.warning("Downloading %s (%s)" % (szURL.decode('utf-8'), # <<<<<<<<<<<<<< * szFileName.decode('utf-8'))) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_logging); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warning); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warning); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = 127; @@ -2258,66 +4820,75 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env __pyx_t_4 += 12; __Pyx_GIVEREF(__pyx_kp_u_Downloading); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_Downloading); - __pyx_t_6 = __Pyx_decode_c_string(__pyx_v_szURL, 0, strlen(__pyx_v_szURL), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_ssize_strlen(__pyx_v_szURL); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 86, __pyx_L1_error) + __pyx_t_7 = __Pyx_decode_c_string(__pyx_v_szURL, 0, __pyx_t_6, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7); + __pyx_t_7 = 0; __Pyx_INCREF(__pyx_kp_u_); __pyx_t_4 += 2; __Pyx_GIVEREF(__pyx_kp_u_); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_); - /* "pylibemu.pyx":88 + /* "pylibemu.pyx":87 * * logging.warning("Downloading %s (%s)" % (szURL.decode('utf-8'), * szFileName.decode('utf-8'))) # <<<<<<<<<<<<<< * * try: */ - __pyx_t_6 = __Pyx_decode_c_string(__pyx_v_szFileName, 0, strlen(__pyx_v_szFileName), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; - __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_ssize_strlen(__pyx_v_szFileName); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_7 = __Pyx_decode_c_string(__pyx_v_szFileName, 0, __pyx_t_6, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5; + __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_7); + __pyx_t_7 = 0; __Pyx_INCREF(__pyx_kp_u__2); __pyx_t_4 += 1; __Pyx_GIVEREF(__pyx_kp_u__2); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_kp_u__2); - /* "pylibemu.pyx":87 + /* "pylibemu.pyx":86 * va_end(args) * * logging.warning("Downloading %s (%s)" % (szURL.decode('utf-8'), # <<<<<<<<<<<<<< * szFileName.decode('utf-8'))) * */ - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_2, 5, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_8 = 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_8 = 1; } } - __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_7}; + __pyx_t_1 = __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; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":90 + /* "pylibemu.pyx":89 * szFileName.decode('utf-8'))) * * try: # <<<<<<<<<<<<<< @@ -2327,70 +4898,78 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); + __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_11); /*try:*/ { - /* "pylibemu.pyx":91 + /* "pylibemu.pyx":90 * * try: * url = urllib2.urlopen(szURL.decode('utf-8'), timeout = 10) # <<<<<<<<<<<<<< * content = url.read() - * except: + * except Exception: */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_urllib2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L3_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_urllib2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_urlopen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L3_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_urlopen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_szURL, 0, strlen(__pyx_v_szURL), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L3_error) + __pyx_t_4 = __Pyx_ssize_strlen(__pyx_v_szURL); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 90, __pyx_L3_error) + __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_szURL, 0, __pyx_t_4, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 91, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 90, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1)) __PYX_ERR(0, 90, __pyx_L3_error); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_timeout, __pyx_int_10) < 0) __PYX_ERR(0, 91, __pyx_L3_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L3_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_timeout, __pyx_int_10) < 0) __PYX_ERR(0, 90, __pyx_L3_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_url = __pyx_t_2; __pyx_t_2 = 0; - /* "pylibemu.pyx":92 + /* "pylibemu.pyx":91 * try: * url = urllib2.urlopen(szURL.decode('utf-8'), timeout = 10) * content = url.read() # <<<<<<<<<<<<<< - * except: + * except Exception: * logging.warning("Error while downloading from %s" % (szURL, )) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_8 = 1; } } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L3_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } __pyx_v_content = __pyx_t_2; __pyx_t_2 = 0; - /* "pylibemu.pyx":90 + /* "pylibemu.pyx":89 * szFileName.decode('utf-8'))) * * try: # <<<<<<<<<<<<<< @@ -2398,70 +4977,78 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env * content = url.read() */ } - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L8_try_end; __pyx_L3_error:; __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; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "pylibemu.pyx":93 + /* "pylibemu.pyx":92 * url = urllib2.urlopen(szURL.decode('utf-8'), timeout = 10) * content = url.read() - * except: # <<<<<<<<<<<<<< + * except Exception: # <<<<<<<<<<<<<< * logging.warning("Error while downloading from %s" % (szURL, )) * return 0x800C0008 # INET_E_DOWNLOAD_FAILURE */ - /*except:*/ { + __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_8) { __Pyx_AddTraceback("pylibemu.URLDownloadToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_6) < 0) __PYX_ERR(0, 93, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 92, __pyx_L5_except_error) + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_7); - /* "pylibemu.pyx":94 + /* "pylibemu.pyx":93 * content = url.read() - * except: + * except Exception: * logging.warning("Error while downloading from %s" % (szURL, )) # <<<<<<<<<<<<<< * return 0x800C0008 # INET_E_DOWNLOAD_FAILURE * */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_logging); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 94, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_warning); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 94, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyBytes_FromString(__pyx_v_szURL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 94, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_12 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_10), __pyx_empty_unicode); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 94, __pyx_L5_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_logging); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 93, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_downloading_from, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 94, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_warning); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 93, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_12); + __pyx_t_12 = __Pyx_PyBytes_FromString(__pyx_v_szURL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 93, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_14 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_12), __pyx_empty_unicode); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 93, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_downloading_from, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 93, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = NULL; + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); + __Pyx_DECREF_SET(__pyx_t_13, function); + __pyx_t_8 = 1; } } - __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_10); - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_12}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_13, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pylibemu.pyx":95 - * except: + /* "pylibemu.pyx":94 + * except Exception: * logging.warning("Error while downloading from %s" % (szURL, )) * return 0x800C0008 # INET_E_DOWNLOAD_FAILURE # <<<<<<<<<<<<<< * @@ -2470,63 +5057,71 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env __pyx_r = 0x800C0008; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_except_return; } - __pyx_L5_except_error:; + goto __pyx_L5_except_error; - /* "pylibemu.pyx":90 + /* "pylibemu.pyx":89 * szFileName.decode('utf-8'))) * * try: # <<<<<<<<<<<<<< * url = urllib2.urlopen(szURL.decode('utf-8'), timeout = 10) * content = url.read() */ - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); + __pyx_L5_except_error:; __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); goto __pyx_L1_error; __pyx_L6_except_return:; - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_11); + __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11); goto __pyx_L0; __pyx_L8_try_end:; } - /* "pylibemu.pyx":97 + /* "pylibemu.pyx":96 * return 0x800C0008 # INET_E_DOWNLOAD_FAILURE * * m = hashlib.md5(content) # <<<<<<<<<<<<<< * with open(str(m.hexdigest()), mode = 'wb') as fd: * fd.write(content) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_hashlib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_hashlib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_md5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_md5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(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; } } - __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_v_content) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_content); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_m = __pyx_t_6; - __pyx_t_6 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_content}; + __pyx_t_7 = __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_7)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_v_m = __pyx_t_7; + __pyx_t_7 = 0; - /* "pylibemu.pyx":98 + /* "pylibemu.pyx":97 * * m = hashlib.md5(content) * with open(str(m.hexdigest()), mode = 'wb') as fd: # <<<<<<<<<<<<<< @@ -2534,99 +5129,120 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env * */ /*with:*/ { - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_hexdigest); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_hexdigest); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __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; } } - __pyx_t_6 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_2 = __Pyx_PyObject_Str(__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_mode, __pyx_n_u_wb) < 0) __PYX_ERR(0, 98, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_mode, __pyx_n_u_wb) < 0) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_8 = 1; } } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L11_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __pyx_t_2; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_8, 0+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L11_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __pyx_t_7 = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_13); - __Pyx_XGOTREF(__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_13); + __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_9, &__pyx_t_15); + __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_15); /*try:*/ { - __pyx_v_fd = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_v_fd = __pyx_t_7; + __pyx_t_7 = 0; - /* "pylibemu.pyx":99 + /* "pylibemu.pyx":98 * m = hashlib.md5(content) * with open(str(m.hexdigest()), mode = 'wb') as fd: * fd.write(content) # <<<<<<<<<<<<<< * * return 0 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fd, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L15_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fd, __pyx_n_s_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L15_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_8 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_8 = 1; } } - __pyx_t_6 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_content) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_content); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L15_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_content}; + __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L15_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "pylibemu.pyx":98 + /* "pylibemu.pyx":97 * * m = hashlib.md5(content) * with open(str(m.hexdigest()), mode = 'wb') as fd: # <<<<<<<<<<<<<< @@ -2634,70 +5250,70 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env * */ } - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; goto __pyx_L20_try_end; __pyx_L15_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; /*except:*/ { __Pyx_AddTraceback("pylibemu.URLDownloadToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 98, __pyx_L17_except_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_Pack(3, __pyx_t_6, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L17_except_error) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(0, 97, __pyx_L17_except_error) + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_Pack(3, __pyx_t_7, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L17_except_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_3, NULL); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 98, __pyx_L17_except_error) - __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_14); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - if (__pyx_t_15 < 0) __PYX_ERR(0, 98, __pyx_L17_except_error) - __pyx_t_16 = ((!(__pyx_t_15 != 0)) != 0); - if (__pyx_t_16) { - __Pyx_GIVEREF(__pyx_t_6); + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 97, __pyx_L17_except_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_16); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + if (__pyx_t_17 < 0) __PYX_ERR(0, 97, __pyx_L17_except_error) + __pyx_t_18 = (!__pyx_t_17); + if (unlikely(__pyx_t_18)) { + __Pyx_GIVEREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_ErrRestoreWithState(__pyx_t_6, __pyx_t_1, __pyx_t_2); - __pyx_t_6 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; - __PYX_ERR(0, 98, __pyx_L17_except_error) + __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_1, __pyx_t_2); + __pyx_t_7 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; + __PYX_ERR(0, 97, __pyx_L17_except_error) } - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L16_exception_handled; } __pyx_L17_except_error:; - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_15); goto __pyx_L1_error; __pyx_L16_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_13); - __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_13); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_15); + __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_15); __pyx_L20_try_end:; } } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_9) { - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__3, NULL); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (__pyx_t_11) { + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_tuple__3, NULL); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } goto __pyx_L14; } @@ -2705,12 +5321,12 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env } goto __pyx_L24; __pyx_L11_error:; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; goto __pyx_L1_error; __pyx_L24:; } - /* "pylibemu.pyx":101 + /* "pylibemu.pyx":100 * fd.write(content) * * return 0 # <<<<<<<<<<<<<< @@ -2723,9 +5339,9 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env /* "pylibemu.pyx":70 * return 0 * - * cdef uint32_t URLDownloadToFile(c_emu_env *env, c_emu_env_hook *hook...): # <<<<<<<<<<<<<< + * cdef uint32_t URLDownloadToFile(c_emu_env *env, c_emu_env_hook *hook...) noexcept: # <<<<<<<<<<<<<< * cdef va_list args - * cdef void *pCaller + * cdef void *_pCaller */ /* function exit code */ @@ -2733,10 +5349,10 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); __Pyx_WriteUnraisable("pylibemu.URLDownloadToFile", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; @@ -2748,7 +5364,7 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env return __pyx_r; } -/* "pylibemu.pyx":117 +/* "pylibemu.pyx":116 * cdef unsigned long output_size * * def __cinit__(self, size_t output_size): # <<<<<<<<<<<<<< @@ -2760,44 +5376,64 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env static int __pyx_pw_8pylibemu_10EmuProfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_8pylibemu_10EmuProfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { size_t __pyx_v_output_size; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[1] = {0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (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 -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_size,0}; - PyObject* values[1] = {0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_size,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_size)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_size)) != 0)) { + (void)__Pyx_Arg_NewRef_VARARGS(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 117, __pyx_L3_error) + 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, "__cinit__") < 0)) __PYX_ERR(0, 116, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); } - __pyx_v_output_size = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_output_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L3_error) + __pyx_v_output_size = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_output_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 117, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 116, __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_VARARGS(values[__pyx_temp]); + } + } __Pyx_AddTraceback("pylibemu.EmuProfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; @@ -2805,6 +5441,12 @@ static int __pyx_pw_8pylibemu_10EmuProfile_1__cinit__(PyObject *__pyx_v_self, Py __pyx_r = __pyx_pf_8pylibemu_10EmuProfile___cinit__(((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self), __pyx_v_output_size); /* 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_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -2816,9 +5458,9 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(struct __pyx_obj_8pylibemu_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__cinit__", 0); + __Pyx_RefNannySetupContext("__cinit__", 1); - /* "pylibemu.pyx":118 + /* "pylibemu.pyx":117 * * def __cinit__(self, size_t output_size): * self.truncate = False # <<<<<<<<<<<<<< @@ -2827,7 +5469,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(struct __pyx_obj_8pylibemu_ */ __pyx_v_self->truncate = 0; - /* "pylibemu.pyx":119 + /* "pylibemu.pyx":118 * def __cinit__(self, size_t output_size): * self.truncate = False * self.output_size = output_size # <<<<<<<<<<<<<< @@ -2836,7 +5478,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(struct __pyx_obj_8pylibemu_ */ __pyx_v_self->output_size = __pyx_v_output_size; - /* "pylibemu.pyx":121 + /* "pylibemu.pyx":120 * self.output_size = output_size * * self.output = malloc(output_size) # <<<<<<<<<<<<<< @@ -2845,7 +5487,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(struct __pyx_obj_8pylibemu_ */ __pyx_v_self->output = ((char *)malloc(__pyx_v_output_size)); - /* "pylibemu.pyx":122 + /* "pylibemu.pyx":121 * * self.output = malloc(output_size) * self.s = malloc(S_SIZE) # <<<<<<<<<<<<<< @@ -2854,18 +5496,18 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(struct __pyx_obj_8pylibemu_ */ __pyx_v_self->s = ((char *)malloc(0x1000)); - /* "pylibemu.pyx":124 + /* "pylibemu.pyx":123 * self.s = malloc(S_SIZE) * * self.check_memalloc() # <<<<<<<<<<<<<< * memset(self.output, 0, output_size) * memset(self.s , 0, S_SIZE) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->check_memalloc(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->check_memalloc(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":125 + /* "pylibemu.pyx":124 * * self.check_memalloc() * memset(self.output, 0, output_size) # <<<<<<<<<<<<<< @@ -2874,7 +5516,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(struct __pyx_obj_8pylibemu_ */ (void)(memset(__pyx_v_self->output, 0, __pyx_v_output_size)); - /* "pylibemu.pyx":126 + /* "pylibemu.pyx":125 * self.check_memalloc() * memset(self.output, 0, output_size) * memset(self.s , 0, S_SIZE) # <<<<<<<<<<<<<< @@ -2883,18 +5525,18 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(struct __pyx_obj_8pylibemu_ */ (void)(memset(__pyx_v_self->s, 0, 0x1000)); - /* "pylibemu.pyx":127 + /* "pylibemu.pyx":126 * memset(self.output, 0, output_size) * memset(self.s , 0, S_SIZE) * self.build_sep() # <<<<<<<<<<<<<< * * cdef check_memalloc(self): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->build_sep(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->build_sep(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":117 + /* "pylibemu.pyx":116 * cdef unsigned long output_size * * def __cinit__(self, size_t output_size): # <<<<<<<<<<<<<< @@ -2914,7 +5556,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(struct __pyx_obj_8pylibemu_ return __pyx_r; } -/* "pylibemu.pyx":129 +/* "pylibemu.pyx":128 * self.build_sep() * * cdef check_memalloc(self): # <<<<<<<<<<<<<< @@ -2930,88 +5572,103 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_ 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("check_memalloc", 0); + __Pyx_RefNannySetupContext("check_memalloc", 1); - /* "pylibemu.pyx":130 + /* "pylibemu.pyx":129 * * cdef check_memalloc(self): * if self.output is NULL or self.s is NULL: # <<<<<<<<<<<<<< * logging.warning("Memory allocation error") * sys._exit(-1) */ - __pyx_t_2 = ((__pyx_v_self->output == NULL) != 0); + __pyx_t_2 = (__pyx_v_self->output == NULL); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } - __pyx_t_2 = ((__pyx_v_self->s == NULL) != 0); + __pyx_t_2 = (__pyx_v_self->s == NULL); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "pylibemu.pyx":131 + /* "pylibemu.pyx":130 * cdef check_memalloc(self): * if self.output is NULL or self.s is NULL: * logging.warning("Memory allocation error") # <<<<<<<<<<<<<< * sys._exit(-1) * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_logging); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_logging); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warning); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warning); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(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_6 = 1; } } - __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_kp_u_Memory_allocation_error) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_kp_u_Memory_allocation_error); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_kp_u_Memory_allocation_error}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pylibemu.pyx":132 + /* "pylibemu.pyx":131 * if self.output is NULL or self.s is NULL: * logging.warning("Memory allocation error") * sys._exit(-1) # <<<<<<<<<<<<<< * * cdef concatenate(self, char *dst, char *src, unsigned long n): */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_sys); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exit_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_exit_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_int_neg_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_int_neg_1); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_int_neg_1}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 1+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pylibemu.pyx":130 + /* "pylibemu.pyx":129 * * cdef check_memalloc(self): * if self.output is NULL or self.s is NULL: # <<<<<<<<<<<<<< @@ -3020,7 +5677,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_ */ } - /* "pylibemu.pyx":129 + /* "pylibemu.pyx":128 * self.build_sep() * * cdef check_memalloc(self): # <<<<<<<<<<<<<< @@ -3043,7 +5700,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_ return __pyx_r; } -/* "pylibemu.pyx":134 +/* "pylibemu.pyx":133 * sys._exit(-1) * * cdef concatenate(self, char *dst, char *src, unsigned long n): # <<<<<<<<<<<<<< @@ -3054,33 +5711,35 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_ static PyObject *__pyx_f_8pylibemu_10EmuProfile_concatenate(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, char *__pyx_v_dst, char *__pyx_v_src, unsigned long __pyx_v_n) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - size_t __pyx_t_2; - size_t __pyx_t_3; - __Pyx_RefNannySetupContext("concatenate", 0); + Py_ssize_t __pyx_t_1; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("concatenate", 1); - /* "pylibemu.pyx":135 + /* "pylibemu.pyx":134 * * cdef concatenate(self, char *dst, char *src, unsigned long n): * if self.truncate: # <<<<<<<<<<<<<< * return * */ - __pyx_t_1 = (__pyx_v_self->truncate != 0); - if (__pyx_t_1) { + if (__pyx_v_self->truncate) { - /* "pylibemu.pyx":136 + /* "pylibemu.pyx":135 * cdef concatenate(self, char *dst, char *src, unsigned long n): * if self.truncate: * return # <<<<<<<<<<<<<< * - * if len(dst) + len(src) > n - 1: + * if len(dst) + len(src) > n - 1: */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":135 + /* "pylibemu.pyx":134 * * cdef concatenate(self, char *dst, char *src, unsigned long n): * if self.truncate: # <<<<<<<<<<<<<< @@ -3089,29 +5748,29 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_concatenate(struct __pyx_obj_8py */ } - /* "pylibemu.pyx":138 + /* "pylibemu.pyx":137 * return * - * if len(dst) + len(src) > n - 1: # <<<<<<<<<<<<<< + * if len(dst) + len(src) > n - 1: # <<<<<<<<<<<<<< * self.truncate = True * return */ - __pyx_t_2 = strlen(__pyx_v_dst); - __pyx_t_3 = strlen(__pyx_v_src); - __pyx_t_1 = (((__pyx_t_2 + __pyx_t_3) > (__pyx_v_n - 1)) != 0); - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_ssize_strlen(__pyx_v_dst); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_t_2 = __Pyx_ssize_strlen(__pyx_v_src); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_t_3 = ((((unsigned long)__pyx_t_1) + ((unsigned long)__pyx_t_2)) > (__pyx_v_n - 1)); + if (__pyx_t_3) { - /* "pylibemu.pyx":139 + /* "pylibemu.pyx":138 * - * if len(dst) + len(src) > n - 1: + * if len(dst) + len(src) > n - 1: * self.truncate = True # <<<<<<<<<<<<<< * return * */ __pyx_v_self->truncate = 1; - /* "pylibemu.pyx":140 - * if len(dst) + len(src) > n - 1: + /* "pylibemu.pyx":139 + * if len(dst) + len(src) > n - 1: * self.truncate = True * return # <<<<<<<<<<<<<< * @@ -3121,16 +5780,16 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_concatenate(struct __pyx_obj_8py __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":138 + /* "pylibemu.pyx":137 * return * - * if len(dst) + len(src) > n - 1: # <<<<<<<<<<<<<< + * if len(dst) + len(src) > n - 1: # <<<<<<<<<<<<<< * self.truncate = True * return */ } - /* "pylibemu.pyx":142 + /* "pylibemu.pyx":141 * return * * strncat(dst, src, n) # <<<<<<<<<<<<<< @@ -3139,7 +5798,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_concatenate(struct __pyx_obj_8py */ (void)(strncat(__pyx_v_dst, __pyx_v_src, __pyx_v_n)); - /* "pylibemu.pyx":134 + /* "pylibemu.pyx":133 * sys._exit(-1) * * cdef concatenate(self, char *dst, char *src, unsigned long n): # <<<<<<<<<<<<<< @@ -3149,13 +5808,17 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_concatenate(struct __pyx_obj_8py /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("pylibemu.EmuProfile.concatenate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pylibemu.pyx":144 +/* "pylibemu.pyx":143 * strncat(dst, src, n) * * cdef build_sep(self): # <<<<<<<<<<<<<< @@ -3171,18 +5834,19 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli char *__pyx_v_t; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; + Py_ssize_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("build_sep", 0); + __Pyx_RefNannySetupContext("build_sep", 1); - /* "pylibemu.pyx":145 + /* "pylibemu.pyx":144 * * cdef build_sep(self): * cdef char *ssep = ' ' # <<<<<<<<<<<<<< @@ -3191,17 +5855,17 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli */ __pyx_v_ssep = ((char *)" "); - /* "pylibemu.pyx":150 + /* "pylibemu.pyx":149 * cdef int max_len * * max_len = len(ssep) * SEP_SIZE + 1 # <<<<<<<<<<<<<< * * for i in range(SEP_SIZE): */ - __pyx_t_1 = strlen(__pyx_v_ssep); + __pyx_t_1 = __Pyx_ssize_strlen(__pyx_v_ssep); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 149, __pyx_L1_error) __pyx_v_max_len = ((__pyx_t_1 * 16) + 1); - /* "pylibemu.pyx":152 + /* "pylibemu.pyx":151 * max_len = len(ssep) * SEP_SIZE + 1 * * for i in range(SEP_SIZE): # <<<<<<<<<<<<<< @@ -3211,7 +5875,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli for (__pyx_t_2 = 0; __pyx_t_2 < 16; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "pylibemu.pyx":153 + /* "pylibemu.pyx":152 * * for i in range(SEP_SIZE): * counter = i # <<<<<<<<<<<<<< @@ -3220,7 +5884,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli */ __pyx_v_counter = __pyx_v_i; - /* "pylibemu.pyx":154 + /* "pylibemu.pyx":153 * for i in range(SEP_SIZE): * counter = i * t = malloc(max_len) # <<<<<<<<<<<<<< @@ -3229,75 +5893,89 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli */ __pyx_v_t = ((char *)malloc(__pyx_v_max_len)); - /* "pylibemu.pyx":156 + /* "pylibemu.pyx":155 * t = malloc(max_len) * * if t is NULL: # <<<<<<<<<<<<<< * logging.warning("Memory allocation error") * sys._exit(-1) */ - __pyx_t_3 = ((__pyx_v_t == NULL) != 0); + __pyx_t_3 = (__pyx_v_t == NULL); if (__pyx_t_3) { - /* "pylibemu.pyx":157 + /* "pylibemu.pyx":156 * * if t is NULL: * logging.warning("Memory allocation error") # <<<<<<<<<<<<<< * sys._exit(-1) * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_logging); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_logging); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_warning); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_warning); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_7 = 1; } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_kp_u_Memory_allocation_error) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_Memory_allocation_error); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_kp_u_Memory_allocation_error}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pylibemu.pyx":158 + /* "pylibemu.pyx":157 * if t is NULL: * logging.warning("Memory allocation error") * sys._exit(-1) # <<<<<<<<<<<<<< * * memset(t, 0, sizeof(char) * max_len) */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_sys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_sys); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_exit_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_exit_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __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; } } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_int_neg_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_int_neg_1); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_int_neg_1}; + __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pylibemu.pyx":156 + /* "pylibemu.pyx":155 * t = malloc(max_len) * * if t is NULL: # <<<<<<<<<<<<<< @@ -3306,7 +5984,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli */ } - /* "pylibemu.pyx":160 + /* "pylibemu.pyx":159 * sys._exit(-1) * * memset(t, 0, sizeof(char) * max_len) # <<<<<<<<<<<<<< @@ -3315,7 +5993,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli */ (void)(memset(__pyx_v_t, 0, ((sizeof(char)) * __pyx_v_max_len))); - /* "pylibemu.pyx":162 + /* "pylibemu.pyx":161 * memset(t, 0, sizeof(char) * max_len) * * while counter: # <<<<<<<<<<<<<< @@ -3326,18 +6004,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli __pyx_t_3 = (__pyx_v_counter != 0); if (!__pyx_t_3) break; - /* "pylibemu.pyx":163 + /* "pylibemu.pyx":162 * * while counter: * self.concatenate(t, ssep, max_len) # <<<<<<<<<<<<<< * counter -= 1 * */ - __pyx_t_4 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_t, __pyx_v_ssep, __pyx_v_max_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_t, __pyx_v_ssep, __pyx_v_max_len); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "pylibemu.pyx":164 + /* "pylibemu.pyx":163 * while counter: * self.concatenate(t, ssep, max_len) * counter -= 1 # <<<<<<<<<<<<<< @@ -3347,7 +6025,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli __pyx_v_counter = (__pyx_v_counter - 1); } - /* "pylibemu.pyx":166 + /* "pylibemu.pyx":165 * counter -= 1 * * self.sep[i] = t # <<<<<<<<<<<<<< @@ -3357,7 +6035,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli (__pyx_v_self->sep[__pyx_v_i]) = __pyx_v_t; } - /* "pylibemu.pyx":144 + /* "pylibemu.pyx":143 * strncat(dst, src, n) * * cdef build_sep(self): # <<<<<<<<<<<<<< @@ -3380,7 +6058,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli return __pyx_r; } -/* "pylibemu.pyx":168 +/* "pylibemu.pyx":167 * self.sep[i] = t * * cdef log_function_header(self, c_emu_profile_function *function): # <<<<<<<<<<<<<< @@ -3395,9 +6073,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_function_header(struct __pyx int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_function_header", 0); + __Pyx_RefNannySetupContext("log_function_header", 1); - /* "pylibemu.pyx":169 + /* "pylibemu.pyx":168 * * cdef log_function_header(self, c_emu_profile_function *function): * snprintf(self.s, # <<<<<<<<<<<<<< @@ -3406,18 +6084,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_function_header(struct __pyx */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s %s (\n"), __pyx_v_function->return_value->argtype, __pyx_v_function->fnname)); - /* "pylibemu.pyx":175 + /* "pylibemu.pyx":174 * function.fnname) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef log_bracket_closed(self): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":168 + /* "pylibemu.pyx":167 * self.sep[i] = t * * cdef log_function_header(self, c_emu_profile_function *function): # <<<<<<<<<<<<<< @@ -3438,7 +6116,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_function_header(struct __pyx return __pyx_r; } -/* "pylibemu.pyx":177 +/* "pylibemu.pyx":176 * self.concatenate(self.output, self.s, self.output_size) * * cdef log_bracket_closed(self): # <<<<<<<<<<<<<< @@ -3454,9 +6132,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_bracket_closed(struct __pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_bracket_closed", 0); + __Pyx_RefNannySetupContext("log_bracket_closed", 1); - /* "pylibemu.pyx":178 + /* "pylibemu.pyx":177 * * cdef log_bracket_closed(self): * cdef char *s = ")" # <<<<<<<<<<<<<< @@ -3465,18 +6143,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_bracket_closed(struct __pyx_ */ __pyx_v_s = ((char *)")"); - /* "pylibemu.pyx":180 + /* "pylibemu.pyx":179 * cdef char *s = ")" * * self.concatenate(self.output, s, self.output_size) # <<<<<<<<<<<<<< * * cdef log_array_start(self, c_emu_profile_argument *argument, int indent): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":177 + /* "pylibemu.pyx":176 * self.concatenate(self.output, self.s, self.output_size) * * cdef log_bracket_closed(self): # <<<<<<<<<<<<<< @@ -3497,7 +6175,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_bracket_closed(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":182 +/* "pylibemu.pyx":181 * self.concatenate(self.output, s, self.output_size) * * cdef log_array_start(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3512,9 +6190,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_start(struct __pyx_obj int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_array_start", 0); + __Pyx_RefNannySetupContext("log_array_start", 1); - /* "pylibemu.pyx":183 + /* "pylibemu.pyx":182 * * cdef log_array_start(self, c_emu_profile_argument *argument, int indent): * snprintf(self.s, # <<<<<<<<<<<<<< @@ -3523,18 +6201,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_start(struct __pyx_obj */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s %s %s = [ \n"), (__pyx_v_self->sep[__pyx_v_indent]), __pyx_v_argument->argtype, __pyx_v_argument->argname)); - /* "pylibemu.pyx":190 + /* "pylibemu.pyx":189 * argument.argname) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef log_array_end(self, c_emu_profile_argument *argument, int indent): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":182 + /* "pylibemu.pyx":181 * self.concatenate(self.output, s, self.output_size) * * cdef log_array_start(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3555,7 +6233,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_start(struct __pyx_obj return __pyx_r; } -/* "pylibemu.pyx":192 +/* "pylibemu.pyx":191 * self.concatenate(self.output, self.s, self.output_size) * * cdef log_array_end(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3570,9 +6248,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_end(struct __pyx_obj_8 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_array_end", 0); + __Pyx_RefNannySetupContext("log_array_end", 1); - /* "pylibemu.pyx":193 + /* "pylibemu.pyx":192 * * cdef log_array_end(self, c_emu_profile_argument *argument, int indent): * snprintf(self.s, # <<<<<<<<<<<<<< @@ -3581,18 +6259,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_end(struct __pyx_obj_8 */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s ];\n"), (__pyx_v_self->sep[__pyx_v_indent]))); - /* "pylibemu.pyx":198 + /* "pylibemu.pyx":197 * self.sep[indent]) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef log_struct_start(self, c_emu_profile_argument *argument, int indent): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":192 + /* "pylibemu.pyx":191 * self.concatenate(self.output, self.s, self.output_size) * * cdef log_array_end(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3613,7 +6291,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_end(struct __pyx_obj_8 return __pyx_r; } -/* "pylibemu.pyx":200 +/* "pylibemu.pyx":199 * self.concatenate(self.output, self.s, self.output_size) * * cdef log_struct_start(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3628,9 +6306,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_ob int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_struct_start", 0); + __Pyx_RefNannySetupContext("log_struct_start", 1); - /* "pylibemu.pyx":201 + /* "pylibemu.pyx":200 * * cdef log_struct_start(self, c_emu_profile_argument *argument, int indent): * snprintf(self.s, # <<<<<<<<<<<<<< @@ -3639,18 +6317,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_ob */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s struct %s %s = {\n"), (__pyx_v_self->sep[__pyx_v_indent]), __pyx_v_argument->argtype, __pyx_v_argument->argname)); - /* "pylibemu.pyx":208 + /* "pylibemu.pyx":207 * argument.argname) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef log_struct_end(self, c_emu_profile_argument *argument, int indent): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":200 + /* "pylibemu.pyx":199 * self.concatenate(self.output, self.s, self.output_size) * * cdef log_struct_start(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3671,7 +6349,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_ob return __pyx_r; } - /* "pylibemu.pyx":210 + /* "pylibemu.pyx":209 * self.concatenate(self.output, self.s, self.output_size) * * cdef log_struct_end(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3686,9 +6364,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_ob int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_struct_end", 0); + __Pyx_RefNannySetupContext("log_struct_end", 1); - /* "pylibemu.pyx":211 + /* "pylibemu.pyx":210 * * cdef log_struct_end(self, c_emu_profile_argument *argument, int indent): * snprintf(self.s, # <<<<<<<<<<<<<< @@ -3697,18 +6375,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_ob */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s };\n"), (__pyx_v_self->sep[__pyx_v_indent]))); - /* "pylibemu.pyx":216 + /* "pylibemu.pyx":215 * self.sep[indent]) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef emu_profile_argument_render_int(self, c_emu_profile_argument *argument, int indent): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":210 + /* "pylibemu.pyx":209 * self.concatenate(self.output, self.s, self.output_size) * * cdef log_struct_end(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3729,7 +6407,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_ob return __pyx_r; } -/* "pylibemu.pyx":218 +/* "pylibemu.pyx":217 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_int(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3744,9 +6422,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_int( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_int", 0); + __Pyx_RefNannySetupContext("emu_profile_argument_render_int", 1); - /* "pylibemu.pyx":219 + /* "pylibemu.pyx":218 * * cdef emu_profile_argument_render_int(self, c_emu_profile_argument *argument, int indent): * snprintf(self.s, # <<<<<<<<<<<<<< @@ -3755,18 +6433,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_int( */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s %s %s = %i;\n"), (__pyx_v_self->sep[__pyx_v_indent]), __pyx_v_argument->argtype, __pyx_v_argument->argname, __pyx_v_argument->value.tint)); - /* "pylibemu.pyx":227 + /* "pylibemu.pyx":226 * argument.value.tint) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef emu_profile_argument_render_string(self, c_emu_profile_argument *argument, int indent): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":218 + /* "pylibemu.pyx":217 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_int(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3787,7 +6465,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_int( return __pyx_r; } -/* "pylibemu.pyx":229 +/* "pylibemu.pyx":228 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_string(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3802,9 +6480,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_stri int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_string", 0); + __Pyx_RefNannySetupContext("emu_profile_argument_render_string", 1); - /* "pylibemu.pyx":230 + /* "pylibemu.pyx":229 * * cdef emu_profile_argument_render_string(self, c_emu_profile_argument *argument, int indent): * snprintf(self.s, # <<<<<<<<<<<<<< @@ -3813,18 +6491,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_stri */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s %s %s = \"%s\";\n"), (__pyx_v_self->sep[__pyx_v_indent]), __pyx_v_argument->argtype, __pyx_v_argument->argname, __pyx_v_argument->value.tchar)); - /* "pylibemu.pyx":238 + /* "pylibemu.pyx":237 * argument.value.tchar) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef emu_profile_argument_render_bytea(self, c_emu_profile_argument *argument, int indent): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":229 + /* "pylibemu.pyx":228 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_string(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3845,7 +6523,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_stri return __pyx_r; } -/* "pylibemu.pyx":240 +/* "pylibemu.pyx":239 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_bytea(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3860,9 +6538,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_byte int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_bytea", 0); + __Pyx_RefNannySetupContext("emu_profile_argument_render_bytea", 1); - /* "pylibemu.pyx":241 + /* "pylibemu.pyx":240 * * cdef emu_profile_argument_render_bytea(self, c_emu_profile_argument *argument, int indent): * snprintf(self.s, # <<<<<<<<<<<<<< @@ -3871,18 +6549,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_byte */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s %s %s = \".binary.\" (%i bytes);\n"), (__pyx_v_self->sep[__pyx_v_indent]), __pyx_v_argument->argtype, __pyx_v_argument->argname, __pyx_v_argument->value.bytea.size)); - /* "pylibemu.pyx":249 + /* "pylibemu.pyx":248 * argument.value.bytea.size) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef emu_profile_argument_render_ptr(self, c_emu_profile_argument *argument, int is_struct, int indent): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":240 + /* "pylibemu.pyx":239 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_bytea(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -3903,7 +6581,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_byte return __pyx_r; } -/* "pylibemu.pyx":251 +/* "pylibemu.pyx":250 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_ptr(self, c_emu_profile_argument *argument, int is_struct, int indent): # <<<<<<<<<<<<<< @@ -3919,9 +6597,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_ptr", 0); + __Pyx_RefNannySetupContext("emu_profile_argument_render_ptr", 1); - /* "pylibemu.pyx":252 + /* "pylibemu.pyx":251 * * cdef emu_profile_argument_render_ptr(self, c_emu_profile_argument *argument, int is_struct, int indent): * if is_struct: # <<<<<<<<<<<<<< @@ -3931,7 +6609,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr( __pyx_t_1 = (__pyx_v_is_struct != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":253 + /* "pylibemu.pyx":252 * cdef emu_profile_argument_render_ptr(self, c_emu_profile_argument *argument, int is_struct, int indent): * if is_struct: * snprintf(self.s, # <<<<<<<<<<<<<< @@ -3940,7 +6618,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr( */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s struct %s %s = 0x%x => \n"), (__pyx_v_self->sep[__pyx_v_indent]), __pyx_v_argument->argtype, __pyx_v_argument->argname, __pyx_v_argument->value.tptr.addr)); - /* "pylibemu.pyx":252 + /* "pylibemu.pyx":251 * * cdef emu_profile_argument_render_ptr(self, c_emu_profile_argument *argument, int is_struct, int indent): * if is_struct: # <<<<<<<<<<<<<< @@ -3950,7 +6628,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr( goto __pyx_L3; } - /* "pylibemu.pyx":261 + /* "pylibemu.pyx":260 * argument.value.tptr.addr) * else: * snprintf(self.s, # <<<<<<<<<<<<<< @@ -3959,7 +6637,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr( */ /*else*/ { - /* "pylibemu.pyx":267 + /* "pylibemu.pyx":266 * argument.argtype, * argument.argname, * argument.value.tptr.addr) # <<<<<<<<<<<<<< @@ -3970,18 +6648,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr( } __pyx_L3:; - /* "pylibemu.pyx":269 + /* "pylibemu.pyx":268 * argument.value.tptr.addr) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef emu_profile_argument_render_ip(self, c_emu_profile_argument *argument, int indent): */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":251 + /* "pylibemu.pyx":250 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_ptr(self, c_emu_profile_argument *argument, int is_struct, int indent): # <<<<<<<<<<<<<< @@ -4002,7 +6680,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr( return __pyx_r; } -/* "pylibemu.pyx":271 +/* "pylibemu.pyx":270 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_ip(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -4019,9 +6697,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip(s int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_ip", 0); + __Pyx_RefNannySetupContext("emu_profile_argument_render_ip", 1); - /* "pylibemu.pyx":275 + /* "pylibemu.pyx":274 * cdef char *host * * addr = &argument.value.tint # <<<<<<<<<<<<<< @@ -4030,7 +6708,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip(s */ __pyx_v_addr = ((struct in_addr *)(&__pyx_v_argument->value.tint)); - /* "pylibemu.pyx":276 + /* "pylibemu.pyx":275 * * addr = &argument.value.tint * host = inet_ntoa(addr[0]) # <<<<<<<<<<<<<< @@ -4039,7 +6717,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip(s */ __pyx_v_host = inet_ntoa((__pyx_v_addr[0])); - /* "pylibemu.pyx":278 + /* "pylibemu.pyx":277 * host = inet_ntoa(addr[0]) * * snprintf(self.s, # <<<<<<<<<<<<<< @@ -4048,18 +6726,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip(s */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s %s %s = %i (host = %s);\n"), (__pyx_v_self->sep[__pyx_v_indent]), __pyx_v_argument->argtype, __pyx_v_argument->argname, __pyx_v_argument->value.tint, __pyx_v_host)); - /* "pylibemu.pyx":287 + /* "pylibemu.pyx":286 * host) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef emu_profile_argument_render_port(self, c_emu_profile_argument *argument, int indent): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":271 + /* "pylibemu.pyx":270 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_ip(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -4080,7 +6758,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip(s return __pyx_r; } -/* "pylibemu.pyx":289 +/* "pylibemu.pyx":288 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_port(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -4096,9 +6774,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_port int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_port", 0); + __Pyx_RefNannySetupContext("emu_profile_argument_render_port", 1); - /* "pylibemu.pyx":292 + /* "pylibemu.pyx":291 * cdef uint16_t port * * port = ntohs(argument.value.tint) # <<<<<<<<<<<<<< @@ -4107,7 +6785,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_port */ __pyx_v_port = ntohs(((uint16_t)__pyx_v_argument->value.tint)); - /* "pylibemu.pyx":294 + /* "pylibemu.pyx":293 * port = ntohs(argument.value.tint) * * snprintf(self.s, # <<<<<<<<<<<<<< @@ -4116,18 +6794,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_port */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s %s %s = %i (port = %i);\n"), (__pyx_v_self->sep[__pyx_v_indent]), __pyx_v_argument->argtype, __pyx_v_argument->argname, __pyx_v_argument->value.tint, __pyx_v_port)); - /* "pylibemu.pyx":303 + /* "pylibemu.pyx":302 * port) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef emu_profile_argument_render_none(self, c_emu_profile_argument *argument, int indent): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":289 + /* "pylibemu.pyx":288 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_port(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -4148,7 +6826,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_port return __pyx_r; } -/* "pylibemu.pyx":305 +/* "pylibemu.pyx":304 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_none(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -4163,9 +6841,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_none", 0); + __Pyx_RefNannySetupContext("emu_profile_argument_render_none", 1); - /* "pylibemu.pyx":306 + /* "pylibemu.pyx":305 * * cdef emu_profile_argument_render_none(self, c_emu_profile_argument *argument, int indent): * snprintf(self.s, # <<<<<<<<<<<<<< @@ -4174,18 +6852,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)"%s none;\n"), (__pyx_v_self->sep[__pyx_v_indent]))); - /* "pylibemu.pyx":311 + /* "pylibemu.pyx":310 * self.sep[indent]) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef emu_profile_function_render_none(self): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":305 + /* "pylibemu.pyx":304 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_render_none(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -4206,7 +6884,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none return __pyx_r; } -/* "pylibemu.pyx":313 +/* "pylibemu.pyx":312 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_function_render_none(self): # <<<<<<<<<<<<<< @@ -4217,9 +6895,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_none(CYTHON_UNUSED struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("emu_profile_function_render_none", 0); + __Pyx_RefNannySetupContext("emu_profile_function_render_none", 1); - /* "pylibemu.pyx":314 + /* "pylibemu.pyx":313 * * cdef emu_profile_function_render_none(self): * return # <<<<<<<<<<<<<< @@ -4230,7 +6908,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_none __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":313 + /* "pylibemu.pyx":312 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_function_render_none(self): # <<<<<<<<<<<<<< @@ -4245,7 +6923,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_none return __pyx_r; } -/* "pylibemu.pyx":316 +/* "pylibemu.pyx":315 * return * * cdef emu_profile_function_render_int(self, int value): # <<<<<<<<<<<<<< @@ -4260,9 +6938,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_int( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_function_render_int", 0); + __Pyx_RefNannySetupContext("emu_profile_function_render_int", 1); - /* "pylibemu.pyx":317 + /* "pylibemu.pyx":316 * * cdef emu_profile_function_render_int(self, int value): * snprintf(self.s, # <<<<<<<<<<<<<< @@ -4271,18 +6949,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_int( */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)" = 0x%x;\n"), __pyx_v_value)); - /* "pylibemu.pyx":322 + /* "pylibemu.pyx":321 * value) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef emu_profile_function_render_ptr(self, void* ptr): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":316 + /* "pylibemu.pyx":315 * return * * cdef emu_profile_function_render_int(self, int value): # <<<<<<<<<<<<<< @@ -4303,7 +6981,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_int( return __pyx_r; } -/* "pylibemu.pyx":324 +/* "pylibemu.pyx":323 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_function_render_ptr(self, void* ptr): # <<<<<<<<<<<<<< @@ -4318,9 +6996,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_ptr( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_function_render_ptr", 0); + __Pyx_RefNannySetupContext("emu_profile_function_render_ptr", 1); - /* "pylibemu.pyx":325 + /* "pylibemu.pyx":324 * * cdef emu_profile_function_render_ptr(self, void* ptr): * snprintf(self.s, # <<<<<<<<<<<<<< @@ -4329,18 +7007,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_ptr( */ (void)(snprintf(__pyx_v_self->s, 0x1000, ((char *)" = 0x%p;\n"), __pyx_v_ptr)); - /* "pylibemu.pyx":330 + /* "pylibemu.pyx":329 * ptr) * * self.concatenate(self.output, self.s, self.output_size) # <<<<<<<<<<<<<< * * cdef emu_profile_argument_debug(self, c_emu_profile_argument *argument, int indent): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->concatenate(__pyx_v_self, __pyx_v_self->output, __pyx_v_self->s, __pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":324 + /* "pylibemu.pyx":323 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_function_render_ptr(self, void* ptr): # <<<<<<<<<<<<<< @@ -4361,7 +7039,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_ptr( return __pyx_r; } -/* "pylibemu.pyx":332 +/* "pylibemu.pyx":331 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_debug(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -4381,30 +7059,30 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_debug", 0); + __Pyx_RefNannySetupContext("emu_profile_argument_debug", 1); - /* "pylibemu.pyx":337 + /* "pylibemu.pyx":336 * cdef int is_struct * * if argument.render == render_struct: # <<<<<<<<<<<<<< * self.log_struct_start(argument, indent) * */ - __pyx_t_1 = ((__pyx_v_argument->render == render_struct) != 0); + __pyx_t_1 = (__pyx_v_argument->render == render_struct); if (__pyx_t_1) { - /* "pylibemu.pyx":338 + /* "pylibemu.pyx":337 * * if argument.render == render_struct: * self.log_struct_start(argument, indent) # <<<<<<<<<<<<<< * * argumentit = emu_profile_arguments_first(argument.value.tstruct.arguments) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_struct_start(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_struct_start(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":340 + /* "pylibemu.pyx":339 * self.log_struct_start(argument, indent) * * argumentit = emu_profile_arguments_first(argument.value.tstruct.arguments) # <<<<<<<<<<<<<< @@ -4413,7 +7091,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ __pyx_v_argumentit = emu_profile_arguments_first(__pyx_v_argument->value.tstruct.arguments); - /* "pylibemu.pyx":342 + /* "pylibemu.pyx":341 * argumentit = emu_profile_arguments_first(argument.value.tstruct.arguments) * * while not emu_profile_arguments_istail(argumentit): # <<<<<<<<<<<<<< @@ -4421,21 +7099,21 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc * argumentit = emu_profile_arguments_next(argumentit) */ while (1) { - __pyx_t_1 = ((!(emu_profile_arguments_istail(__pyx_v_argumentit) != 0)) != 0); + __pyx_t_1 = (!emu_profile_arguments_istail(__pyx_v_argumentit)); if (!__pyx_t_1) break; - /* "pylibemu.pyx":343 + /* "pylibemu.pyx":342 * * while not emu_profile_arguments_istail(argumentit): * self.emu_profile_argument_debug(argumentit, indent + 1) # <<<<<<<<<<<<<< * argumentit = emu_profile_arguments_next(argumentit) * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_debug(__pyx_v_self, __pyx_v_argumentit, (__pyx_v_indent + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_debug(__pyx_v_self, __pyx_v_argumentit, (__pyx_v_indent + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":344 + /* "pylibemu.pyx":343 * while not emu_profile_arguments_istail(argumentit): * self.emu_profile_argument_debug(argumentit, indent + 1) * argumentit = emu_profile_arguments_next(argumentit) # <<<<<<<<<<<<<< @@ -4445,18 +7123,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_v_argumentit = emu_profile_arguments_next(__pyx_v_argumentit); } - /* "pylibemu.pyx":346 + /* "pylibemu.pyx":345 * argumentit = emu_profile_arguments_next(argumentit) * * self.log_struct_end(argument, indent) # <<<<<<<<<<<<<< * return * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_struct_end(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 346, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_struct_end(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":347 + /* "pylibemu.pyx":346 * * self.log_struct_end(argument, indent) * return # <<<<<<<<<<<<<< @@ -4467,7 +7145,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":337 + /* "pylibemu.pyx":336 * cdef int is_struct * * if argument.render == render_struct: # <<<<<<<<<<<<<< @@ -4476,28 +7154,28 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ } - /* "pylibemu.pyx":349 + /* "pylibemu.pyx":348 * return * * if argument.render == render_array: # <<<<<<<<<<<<<< * self.log_array_start(argument, indent) * */ - __pyx_t_1 = ((__pyx_v_argument->render == render_array) != 0); + __pyx_t_1 = (__pyx_v_argument->render == render_array); if (__pyx_t_1) { - /* "pylibemu.pyx":350 + /* "pylibemu.pyx":349 * * if argument.render == render_array: * self.log_array_start(argument, indent) # <<<<<<<<<<<<<< * * argumentit = emu_profile_arguments_first(argument.value.tstruct.arguments) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_array_start(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 350, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_array_start(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":352 + /* "pylibemu.pyx":351 * self.log_array_start(argument, indent) * * argumentit = emu_profile_arguments_first(argument.value.tstruct.arguments) # <<<<<<<<<<<<<< @@ -4506,7 +7184,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ __pyx_v_argumentit = emu_profile_arguments_first(__pyx_v_argument->value.tstruct.arguments); - /* "pylibemu.pyx":353 + /* "pylibemu.pyx":352 * * argumentit = emu_profile_arguments_first(argument.value.tstruct.arguments) * while not emu_profile_arguments_istail(argumentit): # <<<<<<<<<<<<<< @@ -4514,21 +7192,21 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc * argumentit = emu_profile_arguments_next(argumentit) */ while (1) { - __pyx_t_1 = ((!(emu_profile_arguments_istail(__pyx_v_argumentit) != 0)) != 0); + __pyx_t_1 = (!emu_profile_arguments_istail(__pyx_v_argumentit)); if (!__pyx_t_1) break; - /* "pylibemu.pyx":354 + /* "pylibemu.pyx":353 * argumentit = emu_profile_arguments_first(argument.value.tstruct.arguments) * while not emu_profile_arguments_istail(argumentit): * self.emu_profile_argument_debug(argumentit, indent + 1) # <<<<<<<<<<<<<< * argumentit = emu_profile_arguments_next(argumentit) * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_debug(__pyx_v_self, __pyx_v_argumentit, (__pyx_v_indent + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_debug(__pyx_v_self, __pyx_v_argumentit, (__pyx_v_indent + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":355 + /* "pylibemu.pyx":354 * while not emu_profile_arguments_istail(argumentit): * self.emu_profile_argument_debug(argumentit, indent + 1) * argumentit = emu_profile_arguments_next(argumentit) # <<<<<<<<<<<<<< @@ -4538,18 +7216,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_v_argumentit = emu_profile_arguments_next(__pyx_v_argumentit); } - /* "pylibemu.pyx":357 + /* "pylibemu.pyx":356 * argumentit = emu_profile_arguments_next(argumentit) * * self.log_array_end(argument, indent) # <<<<<<<<<<<<<< * return * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_array_end(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_array_end(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":358 + /* "pylibemu.pyx":357 * * self.log_array_end(argument, indent) * return # <<<<<<<<<<<<<< @@ -4560,7 +7238,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":349 + /* "pylibemu.pyx":348 * return * * if argument.render == render_array: # <<<<<<<<<<<<<< @@ -4569,28 +7247,28 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ } - /* "pylibemu.pyx":360 + /* "pylibemu.pyx":359 * return * * if argument.render == render_int: # <<<<<<<<<<<<<< * self.emu_profile_argument_render_int(argument, indent) * return */ - __pyx_t_1 = ((__pyx_v_argument->render == render_int) != 0); + __pyx_t_1 = (__pyx_v_argument->render == render_int); if (__pyx_t_1) { - /* "pylibemu.pyx":361 + /* "pylibemu.pyx":360 * * if argument.render == render_int: * self.emu_profile_argument_render_int(argument, indent) # <<<<<<<<<<<<<< * return * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_int(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_int(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":362 + /* "pylibemu.pyx":361 * if argument.render == render_int: * self.emu_profile_argument_render_int(argument, indent) * return # <<<<<<<<<<<<<< @@ -4601,7 +7279,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":360 + /* "pylibemu.pyx":359 * return * * if argument.render == render_int: # <<<<<<<<<<<<<< @@ -4610,28 +7288,28 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ } - /* "pylibemu.pyx":364 + /* "pylibemu.pyx":363 * return * * if argument.render == render_short: # <<<<<<<<<<<<<< * self.emu_profile_argument_render_int(argument, indent) * return */ - __pyx_t_1 = ((__pyx_v_argument->render == render_short) != 0); + __pyx_t_1 = (__pyx_v_argument->render == render_short); if (__pyx_t_1) { - /* "pylibemu.pyx":365 + /* "pylibemu.pyx":364 * * if argument.render == render_short: * self.emu_profile_argument_render_int(argument, indent) # <<<<<<<<<<<<<< * return * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_int(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_int(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":366 + /* "pylibemu.pyx":365 * if argument.render == render_short: * self.emu_profile_argument_render_int(argument, indent) * return # <<<<<<<<<<<<<< @@ -4642,7 +7320,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":364 + /* "pylibemu.pyx":363 * return * * if argument.render == render_short: # <<<<<<<<<<<<<< @@ -4651,28 +7329,28 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ } - /* "pylibemu.pyx":368 + /* "pylibemu.pyx":367 * return * * if argument.render == render_string: # <<<<<<<<<<<<<< * self.emu_profile_argument_render_string(argument, indent) * return */ - __pyx_t_1 = ((__pyx_v_argument->render == render_string) != 0); + __pyx_t_1 = (__pyx_v_argument->render == render_string); if (__pyx_t_1) { - /* "pylibemu.pyx":369 + /* "pylibemu.pyx":368 * * if argument.render == render_string: * self.emu_profile_argument_render_string(argument, indent) # <<<<<<<<<<<<<< * return * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_string(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_string(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":370 + /* "pylibemu.pyx":369 * if argument.render == render_string: * self.emu_profile_argument_render_string(argument, indent) * return # <<<<<<<<<<<<<< @@ -4683,7 +7361,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":368 + /* "pylibemu.pyx":367 * return * * if argument.render == render_string: # <<<<<<<<<<<<<< @@ -4692,28 +7370,28 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ } - /* "pylibemu.pyx":372 + /* "pylibemu.pyx":371 * return * * if argument.render == render_bytea: # <<<<<<<<<<<<<< * self.emu_profile_argument_render_bytea(argument, indent) * return */ - __pyx_t_1 = ((__pyx_v_argument->render == render_bytea) != 0); + __pyx_t_1 = (__pyx_v_argument->render == render_bytea); if (__pyx_t_1) { - /* "pylibemu.pyx":373 + /* "pylibemu.pyx":372 * * if argument.render == render_bytea: * self.emu_profile_argument_render_bytea(argument, indent) # <<<<<<<<<<<<<< * return * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_bytea(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_bytea(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":374 + /* "pylibemu.pyx":373 * if argument.render == render_bytea: * self.emu_profile_argument_render_bytea(argument, indent) * return # <<<<<<<<<<<<<< @@ -4724,7 +7402,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":372 + /* "pylibemu.pyx":371 * return * * if argument.render == render_bytea: # <<<<<<<<<<<<<< @@ -4733,17 +7411,17 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ } - /* "pylibemu.pyx":376 + /* "pylibemu.pyx":375 * return * * if argument.render == render_ptr: # <<<<<<<<<<<<<< * argit = argument * */ - __pyx_t_1 = ((__pyx_v_argument->render == render_ptr) != 0); + __pyx_t_1 = (__pyx_v_argument->render == render_ptr); if (__pyx_t_1) { - /* "pylibemu.pyx":377 + /* "pylibemu.pyx":376 * * if argument.render == render_ptr: * argit = argument # <<<<<<<<<<<<<< @@ -4752,7 +7430,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ __pyx_v_argit = __pyx_v_argument; - /* "pylibemu.pyx":379 + /* "pylibemu.pyx":378 * argit = argument * * while argit.render == render_ptr: # <<<<<<<<<<<<<< @@ -4760,10 +7438,10 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc * */ while (1) { - __pyx_t_1 = ((__pyx_v_argit->render == render_ptr) != 0); + __pyx_t_1 = (__pyx_v_argit->render == render_ptr); if (!__pyx_t_1) break; - /* "pylibemu.pyx":380 + /* "pylibemu.pyx":379 * * while argit.render == render_ptr: * argit = argit.value.tptr.ptr # <<<<<<<<<<<<<< @@ -4774,7 +7452,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_v_argit = __pyx_t_3; } - /* "pylibemu.pyx":382 + /* "pylibemu.pyx":381 * argit = argit.value.tptr.ptr * * is_struct = 0 # <<<<<<<<<<<<<< @@ -4783,17 +7461,17 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ __pyx_v_is_struct = 0; - /* "pylibemu.pyx":383 + /* "pylibemu.pyx":382 * * is_struct = 0 * if argit.render == render_struct: # <<<<<<<<<<<<<< * is_struct = 1 * */ - __pyx_t_1 = ((__pyx_v_argit->render == render_struct) != 0); + __pyx_t_1 = (__pyx_v_argit->render == render_struct); if (__pyx_t_1) { - /* "pylibemu.pyx":384 + /* "pylibemu.pyx":383 * is_struct = 0 * if argit.render == render_struct: * is_struct = 1 # <<<<<<<<<<<<<< @@ -4802,7 +7480,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ __pyx_v_is_struct = 1; - /* "pylibemu.pyx":383 + /* "pylibemu.pyx":382 * * is_struct = 0 * if argit.render == render_struct: # <<<<<<<<<<<<<< @@ -4811,29 +7489,29 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ } - /* "pylibemu.pyx":386 + /* "pylibemu.pyx":385 * is_struct = 1 * * self.emu_profile_argument_render_ptr(argument, is_struct, indent) # <<<<<<<<<<<<<< * self.emu_profile_argument_debug(argument.value.tptr.ptr, indent + 1) * return */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_ptr(__pyx_v_self, __pyx_v_argument, __pyx_v_is_struct, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_ptr(__pyx_v_self, __pyx_v_argument, __pyx_v_is_struct, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 385, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":387 + /* "pylibemu.pyx":386 * * self.emu_profile_argument_render_ptr(argument, is_struct, indent) * self.emu_profile_argument_debug(argument.value.tptr.ptr, indent + 1) # <<<<<<<<<<<<<< * return * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_debug(__pyx_v_self, __pyx_v_argument->value.tptr.ptr, (__pyx_v_indent + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 387, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_debug(__pyx_v_self, __pyx_v_argument->value.tptr.ptr, (__pyx_v_indent + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":388 + /* "pylibemu.pyx":387 * self.emu_profile_argument_render_ptr(argument, is_struct, indent) * self.emu_profile_argument_debug(argument.value.tptr.ptr, indent + 1) * return # <<<<<<<<<<<<<< @@ -4844,7 +7522,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":376 + /* "pylibemu.pyx":375 * return * * if argument.render == render_ptr: # <<<<<<<<<<<<<< @@ -4853,28 +7531,28 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ } - /* "pylibemu.pyx":390 + /* "pylibemu.pyx":389 * return * * if argument.render == render_ip: # <<<<<<<<<<<<<< * self.emu_profile_argument_render_ip(argument, indent) * return */ - __pyx_t_1 = ((__pyx_v_argument->render == render_ip) != 0); + __pyx_t_1 = (__pyx_v_argument->render == render_ip); if (__pyx_t_1) { - /* "pylibemu.pyx":391 + /* "pylibemu.pyx":390 * * if argument.render == render_ip: * self.emu_profile_argument_render_ip(argument, indent) # <<<<<<<<<<<<<< * return * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_ip(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_ip(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":392 + /* "pylibemu.pyx":391 * if argument.render == render_ip: * self.emu_profile_argument_render_ip(argument, indent) * return # <<<<<<<<<<<<<< @@ -4885,7 +7563,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":390 + /* "pylibemu.pyx":389 * return * * if argument.render == render_ip: # <<<<<<<<<<<<<< @@ -4894,28 +7572,28 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ } - /* "pylibemu.pyx":394 + /* "pylibemu.pyx":393 * return * * if argument.render == render_port: # <<<<<<<<<<<<<< * self.emu_profile_argument_render_port(argument, indent) * return */ - __pyx_t_1 = ((__pyx_v_argument->render == render_port) != 0); + __pyx_t_1 = (__pyx_v_argument->render == render_port); if (__pyx_t_1) { - /* "pylibemu.pyx":395 + /* "pylibemu.pyx":394 * * if argument.render == render_port: * self.emu_profile_argument_render_port(argument, indent) # <<<<<<<<<<<<<< * return * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_port(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_port(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":396 + /* "pylibemu.pyx":395 * if argument.render == render_port: * self.emu_profile_argument_render_port(argument, indent) * return # <<<<<<<<<<<<<< @@ -4926,7 +7604,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":394 + /* "pylibemu.pyx":393 * return * * if argument.render == render_port: # <<<<<<<<<<<<<< @@ -4935,28 +7613,28 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ } - /* "pylibemu.pyx":398 + /* "pylibemu.pyx":397 * return * * if argument.render == render_none: # <<<<<<<<<<<<<< * self.emu_profile_argument_render_none(argument, indent) * return */ - __pyx_t_1 = ((__pyx_v_argument->render == render_none) != 0); + __pyx_t_1 = (__pyx_v_argument->render == render_none); if (__pyx_t_1) { - /* "pylibemu.pyx":399 + /* "pylibemu.pyx":398 * * if argument.render == render_none: * self.emu_profile_argument_render_none(argument, indent) # <<<<<<<<<<<<<< * return * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_none(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_render_none(__pyx_v_self, __pyx_v_argument, __pyx_v_indent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":400 + /* "pylibemu.pyx":399 * if argument.render == render_none: * self.emu_profile_argument_render_none(argument, indent) * return # <<<<<<<<<<<<<< @@ -4967,7 +7645,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "pylibemu.pyx":398 + /* "pylibemu.pyx":397 * return * * if argument.render == render_none: # <<<<<<<<<<<<<< @@ -4976,7 +7654,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc */ } - /* "pylibemu.pyx":332 + /* "pylibemu.pyx":331 * self.concatenate(self.output, self.s, self.output_size) * * cdef emu_profile_argument_debug(self, c_emu_profile_argument *argument, int indent): # <<<<<<<<<<<<<< @@ -4997,7 +7675,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc return __pyx_r; } -/* "pylibemu.pyx":402 +/* "pylibemu.pyx":401 * return * * cdef emu_profile_function_debug(self, c_emu_profile_function *function): # <<<<<<<<<<<<<< @@ -5020,20 +7698,20 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_function_debug", 0); + __Pyx_RefNannySetupContext("emu_profile_function_debug", 1); - /* "pylibemu.pyx":403 + /* "pylibemu.pyx":402 * * cdef emu_profile_function_debug(self, c_emu_profile_function *function): * self.log_function_header(function) # <<<<<<<<<<<<<< * * argument = emu_profile_arguments_first(function.arguments) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_function_header(__pyx_v_self, __pyx_v_function); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_function_header(__pyx_v_self, __pyx_v_function); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":405 + /* "pylibemu.pyx":404 * self.log_function_header(function) * * argument = emu_profile_arguments_first(function.arguments) # <<<<<<<<<<<<<< @@ -5042,7 +7720,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc */ __pyx_v_argument = emu_profile_arguments_first(__pyx_v_function->arguments); - /* "pylibemu.pyx":406 + /* "pylibemu.pyx":405 * * argument = emu_profile_arguments_first(function.arguments) * while not emu_profile_arguments_istail(argument): # <<<<<<<<<<<<<< @@ -5050,21 +7728,21 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc * argument = emu_profile_arguments_next(argument) */ while (1) { - __pyx_t_2 = ((!(emu_profile_arguments_istail(__pyx_v_argument) != 0)) != 0); + __pyx_t_2 = (!emu_profile_arguments_istail(__pyx_v_argument)); if (!__pyx_t_2) break; - /* "pylibemu.pyx":407 + /* "pylibemu.pyx":406 * argument = emu_profile_arguments_first(function.arguments) * while not emu_profile_arguments_istail(argument): * self.emu_profile_argument_debug(argument, 1) # <<<<<<<<<<<<<< * argument = emu_profile_arguments_next(argument) * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_debug(__pyx_v_self, __pyx_v_argument, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_argument_debug(__pyx_v_self, __pyx_v_argument, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":408 + /* "pylibemu.pyx":407 * while not emu_profile_arguments_istail(argument): * self.emu_profile_argument_debug(argument, 1) * argument = emu_profile_arguments_next(argument) # <<<<<<<<<<<<<< @@ -5074,18 +7752,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc __pyx_v_argument = emu_profile_arguments_next(__pyx_v_argument); } - /* "pylibemu.pyx":410 + /* "pylibemu.pyx":409 * argument = emu_profile_arguments_next(argument) * * self.log_bracket_closed() # <<<<<<<<<<<<<< * * render = function.return_value.render */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_bracket_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->log_bracket_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":412 + /* "pylibemu.pyx":411 * self.log_bracket_closed() * * render = function.return_value.render # <<<<<<<<<<<<<< @@ -5095,28 +7773,28 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc __pyx_t_3 = __pyx_v_function->return_value->render; __pyx_v_render = __pyx_t_3; - /* "pylibemu.pyx":414 + /* "pylibemu.pyx":413 * render = function.return_value.render * * if render == render_none: # <<<<<<<<<<<<<< * self.emu_profile_function_render_none() * */ - __pyx_t_2 = ((__pyx_v_render == render_none) != 0); + __pyx_t_2 = (__pyx_v_render == render_none); if (__pyx_t_2) { - /* "pylibemu.pyx":415 + /* "pylibemu.pyx":414 * * if render == render_none: * self.emu_profile_function_render_none() # <<<<<<<<<<<<<< * * if render == render_int: */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_function_render_none(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 415, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_function_render_none(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":414 + /* "pylibemu.pyx":413 * render = function.return_value.render * * if render == render_none: # <<<<<<<<<<<<<< @@ -5125,17 +7803,17 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc */ } - /* "pylibemu.pyx":417 + /* "pylibemu.pyx":416 * self.emu_profile_function_render_none() * * if render == render_int: # <<<<<<<<<<<<<< * value = function.return_value.value.tint * self.emu_profile_function_render_int(value) */ - __pyx_t_2 = ((__pyx_v_render == render_int) != 0); + __pyx_t_2 = (__pyx_v_render == render_int); if (__pyx_t_2) { - /* "pylibemu.pyx":418 + /* "pylibemu.pyx":417 * * if render == render_int: * value = function.return_value.value.tint # <<<<<<<<<<<<<< @@ -5145,18 +7823,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc __pyx_t_4 = __pyx_v_function->return_value->value.tint; __pyx_v_value = __pyx_t_4; - /* "pylibemu.pyx":419 + /* "pylibemu.pyx":418 * if render == render_int: * value = function.return_value.value.tint * self.emu_profile_function_render_int(value) # <<<<<<<<<<<<<< * * if render == render_ptr: */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_function_render_int(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 419, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_function_render_int(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":417 + /* "pylibemu.pyx":416 * self.emu_profile_function_render_none() * * if render == render_int: # <<<<<<<<<<<<<< @@ -5165,17 +7843,17 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc */ } - /* "pylibemu.pyx":421 + /* "pylibemu.pyx":420 * self.emu_profile_function_render_int(value) * * if render == render_ptr: # <<<<<<<<<<<<<< * ptr = function.return_value.value.tptr.addr * self.emu_profile_function_render_int(ptr) */ - __pyx_t_2 = ((__pyx_v_render == render_ptr) != 0); + __pyx_t_2 = (__pyx_v_render == render_ptr); if (__pyx_t_2) { - /* "pylibemu.pyx":422 + /* "pylibemu.pyx":421 * * if render == render_ptr: * ptr = function.return_value.value.tptr.addr # <<<<<<<<<<<<<< @@ -5185,18 +7863,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc __pyx_t_5 = __pyx_v_function->return_value->value.tptr.addr; __pyx_v_ptr = __pyx_t_5; - /* "pylibemu.pyx":423 + /* "pylibemu.pyx":422 * if render == render_ptr: * ptr = function.return_value.value.tptr.addr * self.emu_profile_function_render_int(ptr) # <<<<<<<<<<<<<< * * self.emu_profile_function_render_none() */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_function_render_int(__pyx_v_self, __pyx_v_ptr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_function_render_int(__pyx_v_self, __pyx_v_ptr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":421 + /* "pylibemu.pyx":420 * self.emu_profile_function_render_int(value) * * if render == render_ptr: # <<<<<<<<<<<<<< @@ -5205,18 +7883,18 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc */ } - /* "pylibemu.pyx":425 + /* "pylibemu.pyx":424 * self.emu_profile_function_render_int(ptr) * * self.emu_profile_function_render_none() # <<<<<<<<<<<<<< * * cdef emu_profile_debug(self, c_emu_env *_env): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_function_render_none(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_function_render_none(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":402 + /* "pylibemu.pyx":401 * return * * cdef emu_profile_function_debug(self, c_emu_profile_function *function): # <<<<<<<<<<<<<< @@ -5237,7 +7915,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc return __pyx_r; } -/* "pylibemu.pyx":427 +/* "pylibemu.pyx":426 * self.emu_profile_function_render_none() * * cdef emu_profile_debug(self, c_emu_env *_env): # <<<<<<<<<<<<<< @@ -5254,9 +7932,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug(struct __pyx_o int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_debug", 0); + __Pyx_RefNannySetupContext("emu_profile_debug", 1); - /* "pylibemu.pyx":428 + /* "pylibemu.pyx":427 * * cdef emu_profile_debug(self, c_emu_env *_env): * function = emu_profile_functions_first(_env.profile.functions) # <<<<<<<<<<<<<< @@ -5265,7 +7943,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug(struct __pyx_o */ __pyx_v_function = emu_profile_functions_first(__pyx_v__env->profile->functions); - /* "pylibemu.pyx":430 + /* "pylibemu.pyx":429 * function = emu_profile_functions_first(_env.profile.functions) * * while not emu_profile_functions_istail(function): # <<<<<<<<<<<<<< @@ -5273,21 +7951,21 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug(struct __pyx_o * function = emu_profile_functions_next(function) */ while (1) { - __pyx_t_1 = ((!(emu_profile_functions_istail(__pyx_v_function) != 0)) != 0); + __pyx_t_1 = (!emu_profile_functions_istail(__pyx_v_function)); if (!__pyx_t_1) break; - /* "pylibemu.pyx":431 + /* "pylibemu.pyx":430 * * while not emu_profile_functions_istail(function): * self.emu_profile_function_debug(function) # <<<<<<<<<<<<<< * function = emu_profile_functions_next(function) * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_function_debug(__pyx_v_self, __pyx_v_function); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 431, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->emu_profile_function_debug(__pyx_v_self, __pyx_v_function); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":432 + /* "pylibemu.pyx":431 * while not emu_profile_functions_istail(function): * self.emu_profile_function_debug(function) * function = emu_profile_functions_next(function) # <<<<<<<<<<<<<< @@ -5297,7 +7975,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug(struct __pyx_o __pyx_v_function = emu_profile_functions_next(__pyx_v_function); } - /* "pylibemu.pyx":427 + /* "pylibemu.pyx":426 * self.emu_profile_function_render_none() * * cdef emu_profile_debug(self, c_emu_env *_env): # <<<<<<<<<<<<<< @@ -5320,16 +7998,44 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug(struct __pyx_o /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_10EmuProfile_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8pylibemu_10EmuProfile_3__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_8pylibemu_10EmuProfile_3__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_8pylibemu_10EmuProfile_3__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_10EmuProfile_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8pylibemu_10EmuProfile_3__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_8pylibemu_10EmuProfile_2__reduce_cython__(((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self)); /* function exit code */ @@ -5340,33 +8046,28 @@ static PyObject *__pyx_pw_8pylibemu_10EmuProfile_3__reduce_cython__(PyObject *__ static PyObject *__pyx_pf_8pylibemu_10EmuProfile_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_8pylibemu_EmuProfile *__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("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("__reduce_cython__", 1); /* "(tree fragment)":2 * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); __PYX_ERR(1, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("pylibemu.EmuProfile.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); @@ -5376,62 +8077,140 @@ static PyObject *__pyx_pf_8pylibemu_10EmuProfile_2__reduce_cython__(CYTHON_UNUSE /* "(tree fragment)":3 * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_10EmuProfile_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_8pylibemu_10EmuProfile_5__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); - __pyx_r = __pyx_pf_8pylibemu_10EmuProfile_4__setstate_cython__(((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8pylibemu_10EmuProfile_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; +static PyObject *__pyx_pw_8pylibemu_10EmuProfile_5__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_8pylibemu_10EmuProfile_5__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_10EmuProfile_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8pylibemu_10EmuProfile_5__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 +) { + CYTHON_UNUSED 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; - __Pyx_RefNannySetupContext("__setstate_cython__", 0); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(1, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + 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, 3, __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, 3, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __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, 3, __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("pylibemu.EmuProfile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8pylibemu_10EmuProfile_4__setstate_cython__(((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self), __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_8pylibemu_10EmuProfile_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 1); + + /* "(tree fragment)":4 + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("pylibemu.EmuProfile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pylibemu.pyx":442 +/* "pylibemu.pyx":441 * cdef bint enable_hooks * * def __cinit__(self, output_size = OUTPUT_SIZE, enable_hooks = True): # <<<<<<<<<<<<<< @@ -5444,50 +8223,60 @@ static int __pyx_pw_8pylibemu_8Emulator_1__cinit__(PyObject *__pyx_v_self, PyObj static int __pyx_pw_8pylibemu_8Emulator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_output_size = 0; PyObject *__pyx_v_enable_hooks = 0; + CYTHON_UNUSED Py_ssize_t __pyx_nargs; + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; + PyObject* values[2] = {0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (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 -1; + #endif + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_size,&__pyx_n_s_enable_hooks,0}; - PyObject* values[2] = {0,0}; - values[0] = ((PyObject *)__pyx_int_1048576); - values[1] = ((PyObject *)Py_True); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_size,&__pyx_n_s_enable_hooks,0}; + values[0] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_int_1048576)); + values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__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 = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds); + switch (__pyx_nargs) { case 0: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_size); - if (value) { values[0] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_output_size); + if (value) { values[0] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_enable_hooks); - if (value) { values[1] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_enable_hooks); + if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 442, __pyx_L3_error) + 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, "__cinit__") < 0)) __PYX_ERR(0, 441, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; @@ -5496,10 +8285,18 @@ static int __pyx_pw_8pylibemu_8Emulator_1__cinit__(PyObject *__pyx_v_self, PyObj __pyx_v_output_size = values[0]; __pyx_v_enable_hooks = values[1]; } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 442, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, __pyx_nargs); __PYX_ERR(0, 441, __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_VARARGS(values[__pyx_temp]); + } + } __Pyx_AddTraceback("pylibemu.Emulator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; @@ -5507,6 +8304,12 @@ static int __pyx_pw_8pylibemu_8Emulator_1__cinit__(PyObject *__pyx_v_self, PyObj __pyx_r = __pyx_pf_8pylibemu_8Emulator___cinit__(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_output_size, __pyx_v_enable_hooks); /* 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_VARARGS(values[__pyx_temp]); + } + } __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -5519,58 +8322,66 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(struct __pyx_obj_8pylibemu_Emu 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("__cinit__", 0); + __Pyx_RefNannySetupContext("__cinit__", 1); - /* "pylibemu.pyx":443 + /* "pylibemu.pyx":442 * * def __cinit__(self, output_size = OUTPUT_SIZE, enable_hooks = True): * self.output_size = output_size # <<<<<<<<<<<<<< * self.enable_hooks = enable_hooks * self.new() */ - __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_output_size); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_output_size); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L1_error) __pyx_v_self->output_size = __pyx_t_1; - /* "pylibemu.pyx":444 + /* "pylibemu.pyx":443 * def __cinit__(self, output_size = OUTPUT_SIZE, enable_hooks = True): * self.output_size = output_size * self.enable_hooks = enable_hooks # <<<<<<<<<<<<<< * self.new() * */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enable_hooks); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 444, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_enable_hooks); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 443, __pyx_L1_error) __pyx_v_self->enable_hooks = __pyx_t_2; - /* "pylibemu.pyx":445 + /* "pylibemu.pyx":444 * self.output_size = output_size * self.enable_hooks = enable_hooks * self.new() # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 445, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 444, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); + __pyx_t_6 = 1; } } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 444, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pylibemu.pyx":442 + /* "pylibemu.pyx":441 * cdef bint enable_hooks * * def __cinit__(self, output_size = OUTPUT_SIZE, enable_hooks = True): # <<<<<<<<<<<<<< @@ -5592,7 +8403,7 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(struct __pyx_obj_8pylibemu_Emu return __pyx_r; } -/* "pylibemu.pyx":447 +/* "pylibemu.pyx":446 * self.new() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -5603,8 +8414,10 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(struct __pyx_obj_8pylibemu_Emu /* Python wrapper */ static void __pyx_pw_8pylibemu_8Emulator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_8pylibemu_8Emulator_3__dealloc__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_pf_8pylibemu_8Emulator_2__dealloc__(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -5616,38 +8429,46 @@ static void __pyx_pf_8pylibemu_8Emulator_2__dealloc__(struct __pyx_obj_8pylibemu PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__dealloc__", 0); + __Pyx_RefNannySetupContext("__dealloc__", 1); - /* "pylibemu.pyx":448 + /* "pylibemu.pyx":447 * * def __dealloc__(self): * self.free() # <<<<<<<<<<<<<< * * def free(self): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 448, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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, 447, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":447 + /* "pylibemu.pyx":446 * self.new() * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -5666,7 +8487,7 @@ static void __pyx_pf_8pylibemu_8Emulator_2__dealloc__(struct __pyx_obj_8pylibemu __Pyx_RefNannyFinishContext(); } -/* "pylibemu.pyx":450 +/* "pylibemu.pyx":449 * self.free() * * def free(self): # <<<<<<<<<<<<<< @@ -5675,11 +8496,39 @@ static void __pyx_pf_8pylibemu_8Emulator_2__dealloc__(struct __pyx_obj_8pylibemu */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_5free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8pylibemu_8Emulator_5free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_5free(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_8pylibemu_8Emulator_5free = {"free", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_5free, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_5free(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("free (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("free", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "free", 0))) return NULL; __pyx_r = __pyx_pf_8pylibemu_8Emulator_4free(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -5691,19 +8540,19 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4free(struct __pyx_obj_8pylibemu_E PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("free", 0); + __Pyx_RefNannySetupContext("free", 1); - /* "pylibemu.pyx":451 + /* "pylibemu.pyx":450 * * def free(self): * if self._emu is not NULL: # <<<<<<<<<<<<<< * emu_free(self._emu) * self._emu = NULL */ - __pyx_t_1 = ((__pyx_v_self->_emu != NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu != NULL); if (__pyx_t_1) { - /* "pylibemu.pyx":452 + /* "pylibemu.pyx":451 * def free(self): * if self._emu is not NULL: * emu_free(self._emu) # <<<<<<<<<<<<<< @@ -5712,7 +8561,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4free(struct __pyx_obj_8pylibemu_E */ emu_free(__pyx_v_self->_emu); - /* "pylibemu.pyx":453 + /* "pylibemu.pyx":452 * if self._emu is not NULL: * emu_free(self._emu) * self._emu = NULL # <<<<<<<<<<<<<< @@ -5721,7 +8570,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4free(struct __pyx_obj_8pylibemu_E */ __pyx_v_self->_emu = NULL; - /* "pylibemu.pyx":451 + /* "pylibemu.pyx":450 * * def free(self): * if self._emu is not NULL: # <<<<<<<<<<<<<< @@ -5730,7 +8579,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4free(struct __pyx_obj_8pylibemu_E */ } - /* "pylibemu.pyx":450 + /* "pylibemu.pyx":449 * self.free() * * def free(self): # <<<<<<<<<<<<<< @@ -5745,7 +8594,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4free(struct __pyx_obj_8pylibemu_E return __pyx_r; } -/* "pylibemu.pyx":455 +/* "pylibemu.pyx":454 * self._emu = NULL * * def new(self): # <<<<<<<<<<<<<< @@ -5754,11 +8603,39 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4free(struct __pyx_obj_8pylibemu_E */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_7new(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8pylibemu_8Emulator_7new(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_7new(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_8pylibemu_8Emulator_7new = {"new", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_7new, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_7new(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("new (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("new", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "new", 0))) return NULL; __pyx_r = __pyx_pf_8pylibemu_8Emulator_6new(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -5774,9 +8651,9 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6new(struct __pyx_obj_8pylibemu_Em int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("new", 0); + __Pyx_RefNannySetupContext("new", 1); - /* "pylibemu.pyx":456 + /* "pylibemu.pyx":455 * * def new(self): * self._emu = emu_new() # <<<<<<<<<<<<<< @@ -5785,25 +8662,25 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6new(struct __pyx_obj_8pylibemu_Em */ __pyx_v_self->_emu = emu_new(); - /* "pylibemu.pyx":457 + /* "pylibemu.pyx":456 * def new(self): * self._emu = emu_new() * self.emu_profile = EmuProfile(self.output_size) # <<<<<<<<<<<<<< * * def set_output_size(self, output_size): */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8pylibemu_EmuProfile), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_8pylibemu_EmuProfile), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 456, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_v_self->emu_profile); - __Pyx_DECREF(((PyObject *)__pyx_v_self->emu_profile)); + __Pyx_GOTREF((PyObject *)__pyx_v_self->emu_profile); + __Pyx_DECREF((PyObject *)__pyx_v_self->emu_profile); __pyx_v_self->emu_profile = ((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":455 + /* "pylibemu.pyx":454 * self._emu = NULL * * def new(self): # <<<<<<<<<<<<<< @@ -5825,7 +8702,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6new(struct __pyx_obj_8pylibemu_Em return __pyx_r; } -/* "pylibemu.pyx":459 +/* "pylibemu.pyx":458 * self.emu_profile = EmuProfile(self.output_size) * * def set_output_size(self, output_size): # <<<<<<<<<<<<<< @@ -5834,14 +8711,97 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6new(struct __pyx_obj_8pylibemu_Em */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_9set_output_size(PyObject *__pyx_v_self, PyObject *__pyx_v_output_size); /*proto*/ -static PyObject *__pyx_pw_8pylibemu_8Emulator_9set_output_size(PyObject *__pyx_v_self, PyObject *__pyx_v_output_size) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_9set_output_size(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_8pylibemu_8Emulator_9set_output_size = {"set_output_size", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_9set_output_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_9set_output_size(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_output_size = 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("set_output_size (wrapper)", 0); - __pyx_r = __pyx_pf_8pylibemu_8Emulator_8set_output_size(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((PyObject *)__pyx_v_output_size)); + #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_output_size,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_output_size)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 458, __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, "set_output_size") < 0)) __PYX_ERR(0, 458, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_output_size = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("set_output_size", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 458, __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("pylibemu.Emulator.set_output_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8pylibemu_8Emulator_8set_output_size(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_output_size); /* 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; } @@ -5852,75 +8812,90 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8set_output_size(struct __pyx_obj_ PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - size_t __pyx_t_4; + int __pyx_t_4; + size_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("set_output_size", 0); + __Pyx_RefNannySetupContext("set_output_size", 1); - /* "pylibemu.pyx":460 + /* "pylibemu.pyx":459 * * def set_output_size(self, output_size): * self.free() # <<<<<<<<<<<<<< * self.output_size = output_size * self.new() */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 460, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 459, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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, 459, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":461 + /* "pylibemu.pyx":460 * def set_output_size(self, output_size): * self.free() * self.output_size = output_size # <<<<<<<<<<<<<< * self.new() * */ - __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_output_size); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 461, __pyx_L1_error) - __pyx_v_self->output_size = __pyx_t_4; + __pyx_t_5 = __Pyx_PyInt_As_size_t(__pyx_v_output_size); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L1_error) + __pyx_v_self->output_size = __pyx_t_5; - /* "pylibemu.pyx":462 + /* "pylibemu.pyx":461 * self.free() * self.output_size = output_size * self.new() # <<<<<<<<<<<<<< * * def shellcode_getpc_test(self, shellcode): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __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_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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, 461, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":459 + /* "pylibemu.pyx":458 * self.emu_profile = EmuProfile(self.output_size) * * def set_output_size(self, output_size): # <<<<<<<<<<<<<< @@ -5943,7 +8918,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8set_output_size(struct __pyx_obj_ return __pyx_r; } -/* "pylibemu.pyx":464 +/* "pylibemu.pyx":463 * self.new() * * def shellcode_getpc_test(self, shellcode): # <<<<<<<<<<<<<< @@ -5952,15 +8927,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8set_output_size(struct __pyx_obj_ */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_10shellcode_getpc_test[] = "\n GetPC code is code that determines its own location in a process address\n space. It is commonly used in code that needs to reference itself, for\n instance in self-decoding and self-modifying code. This method tries to\n identify GetPC within the shellcode.\n\n @type shellcode: Binary string\n @param shellcode: Shellcode\n\n @rtype: Integer\n @return: If GetPC code is successfully identified the offset from the\n start of the shellcode is returned, otherwise -1.\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test(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_8pylibemu_8Emulator_10shellcode_getpc_test, "\n GetPC code is code that determines its own location in a process address\n space. It is commonly used in code that needs to reference itself, for\n instance in self-decoding and self-modifying code. This method tries to\n identify GetPC within the shellcode.\n\n @type shellcode: Binary string\n @param shellcode: Shellcode\n\n @rtype: Integer\n @return: If GetPC code is successfully identified the offset from the\n start of the shellcode is returned, otherwise -1.\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_11shellcode_getpc_test = {"shellcode_getpc_test", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_10shellcode_getpc_test}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test(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_shellcode = 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("shellcode_getpc_test (wrapper)", 0); - __pyx_r = __pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((PyObject *)__pyx_v_shellcode)); + #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_shellcode,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_shellcode)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 463, __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, "shellcode_getpc_test") < 0)) __PYX_ERR(0, 463, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_shellcode = values[0]; + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("shellcode_getpc_test", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 463, __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("pylibemu.Emulator.shellcode_getpc_test", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_shellcode); /* 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; } @@ -5974,50 +9032,58 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - char *__pyx_t_5; - Py_ssize_t __pyx_t_6; + int __pyx_t_5; + char *__pyx_t_6; + Py_ssize_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("shellcode_getpc_test", 0); + __Pyx_RefNannySetupContext("shellcode_getpc_test", 1); - /* "pylibemu.pyx":480 + /* "pylibemu.pyx":479 * cdef char *buffer * * if self._emu is NULL: # <<<<<<<<<<<<<< * self.new() * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (__pyx_t_1) { - /* "pylibemu.pyx":481 + /* "pylibemu.pyx":480 * * if self._emu is NULL: * self.new() # <<<<<<<<<<<<<< * * buffer = shellcode */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __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; } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __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; - /* "pylibemu.pyx":480 + /* "pylibemu.pyx":479 * cdef char *buffer * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -6026,40 +9092,40 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py */ } - /* "pylibemu.pyx":483 + /* "pylibemu.pyx":482 * self.new() * * buffer = shellcode # <<<<<<<<<<<<<< * sclen = len(bytes(shellcode)) * */ - __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_shellcode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L1_error) - __pyx_v_buffer = ((char *)__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_shellcode); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 482, __pyx_L1_error) + __pyx_v_buffer = ((char *)__pyx_t_6); - /* "pylibemu.pyx":484 + /* "pylibemu.pyx":483 * * buffer = shellcode * sclen = len(bytes(shellcode)) # <<<<<<<<<<<<<< * * if buffer is NULL: */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_shellcode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_shellcode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyBytes_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 484, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyBytes_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_sclen = __pyx_t_6; + __pyx_v_sclen = __pyx_t_7; - /* "pylibemu.pyx":486 + /* "pylibemu.pyx":485 * sclen = len(bytes(shellcode)) * * if buffer is NULL: # <<<<<<<<<<<<<< * return -1 * */ - __pyx_t_1 = ((__pyx_v_buffer == NULL) != 0); + __pyx_t_1 = (__pyx_v_buffer == NULL); if (__pyx_t_1) { - /* "pylibemu.pyx":487 + /* "pylibemu.pyx":486 * * if buffer is NULL: * return -1 # <<<<<<<<<<<<<< @@ -6071,7 +9137,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py __pyx_r = __pyx_int_neg_1; goto __pyx_L0; - /* "pylibemu.pyx":486 + /* "pylibemu.pyx":485 * sclen = len(bytes(shellcode)) * * if buffer is NULL: # <<<<<<<<<<<<<< @@ -6080,7 +9146,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py */ } - /* "pylibemu.pyx":489 + /* "pylibemu.pyx":488 * return -1 * * self._offset = emu_shellcode_test(self._emu, buffer, sclen) # <<<<<<<<<<<<<< @@ -6089,7 +9155,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py */ __pyx_v_self->_offset = emu_shellcode_test(__pyx_v_self->_emu, ((uint8_t *)__pyx_v_buffer), __pyx_v_sclen); - /* "pylibemu.pyx":490 + /* "pylibemu.pyx":489 * * self._offset = emu_shellcode_test(self._emu, buffer, sclen) * return self._offset # <<<<<<<<<<<<<< @@ -6097,13 +9163,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py * def prepare(self, shellcode, offset): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_self->_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_self->_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":464 + /* "pylibemu.pyx":463 * self.new() * * def shellcode_getpc_test(self, shellcode): # <<<<<<<<<<<<<< @@ -6124,7 +9190,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py return __pyx_r; } -/* "pylibemu.pyx":492 +/* "pylibemu.pyx":491 * return self._offset * * def prepare(self, shellcode, offset): # <<<<<<<<<<<<<< @@ -6133,59 +9199,100 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_13prepare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_12prepare[] = "\n Method used to prepare the execution environment. The offset parameter\n value should be determined by the `shellcode_getpc_test method'. If such\n method is not able to identify the GetPC code (thus returning -1) the\n suggested value for offset parameter is 0.\n\n @type shellcode: Binary string\n @param shellcode: Shellcode\n @type offset : Integer\n @param offset : GetPC offset\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_13prepare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_13prepare(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_8pylibemu_8Emulator_12prepare, "\n Method used to prepare the execution environment. The offset parameter\n value should be determined by the `shellcode_getpc_test method'. If such\n method is not able to identify the GetPC code (thus returning -1) the\n suggested value for offset parameter is 0.\n\n @type shellcode: Binary string\n @param shellcode: Shellcode\n @type offset : Integer\n @param offset : GetPC offset\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_13prepare = {"prepare", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_13prepare, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_12prepare}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_13prepare(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_shellcode = 0; PyObject *__pyx_v_offset = 0; + #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("prepare (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shellcode,&__pyx_n_s_offset,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shellcode,&__pyx_n_s_offset,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shellcode)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shellcode)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("prepare", 1, 2, 2, 1); __PYX_ERR(0, 492, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("prepare", 1, 2, 2, 1); __PYX_ERR(0, 491, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare") < 0)) __PYX_ERR(0, 492, __pyx_L3_error) + 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, "prepare") < 0)) __PYX_ERR(0, 491, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } __pyx_v_shellcode = values[0]; __pyx_v_offset = values[1]; } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("prepare", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 492, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("prepare", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 491, __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("pylibemu.Emulator.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -6193,6 +9300,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_13prepare(PyObject *__pyx_v_self, __pyx_r = __pyx_pf_8pylibemu_8Emulator_12prepare(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_shellcode, __pyx_v_offset); /* 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; } @@ -6216,45 +9329,52 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("prepare", 0); + __Pyx_RefNannySetupContext("prepare", 1); - /* "pylibemu.pyx":509 + /* "pylibemu.pyx":508 * cdef int j, static_offset * * if self._emu is NULL: # <<<<<<<<<<<<<< * self.new() * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (__pyx_t_1) { - /* "pylibemu.pyx":510 + /* "pylibemu.pyx":509 * * if self._emu is NULL: * self.new() # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __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; } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __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; - /* "pylibemu.pyx":509 + /* "pylibemu.pyx":508 * cdef int j, static_offset * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -6263,7 +9383,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ } - /* "pylibemu.pyx":512 + /* "pylibemu.pyx":511 * self.new() * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -6272,7 +9392,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":513 + /* "pylibemu.pyx":512 * * _cpu = emu_cpu_get(self._emu) * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -6281,7 +9401,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":515 + /* "pylibemu.pyx":514 * _mem = emu_memory_get(self._emu) * * for j in range(8): # <<<<<<<<<<<<<< @@ -6291,7 +9411,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe for (__pyx_t_5 = 0; __pyx_t_5 < 8; __pyx_t_5+=1) { __pyx_v_j = __pyx_t_5; - /* "pylibemu.pyx":516 + /* "pylibemu.pyx":515 * * for j in range(8): * emu_cpu_reg32_set(_cpu, j, 0) # <<<<<<<<<<<<<< @@ -6301,7 +9421,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe emu_cpu_reg32_set(__pyx_v__cpu, ((enum emu_reg32)__pyx_v_j), 0); } - /* "pylibemu.pyx":518 + /* "pylibemu.pyx":517 * emu_cpu_reg32_set(_cpu, j, 0) * * emu_memory_write_dword(_mem, 0xef787c3c, 4711) # <<<<<<<<<<<<<< @@ -6310,7 +9430,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ (void)(emu_memory_write_dword(__pyx_v__mem, 0xef787c3c, 0x1267)); - /* "pylibemu.pyx":519 + /* "pylibemu.pyx":518 * * emu_memory_write_dword(_mem, 0xef787c3c, 4711) * emu_memory_write_dword(_mem, 0x0 , 4711) # <<<<<<<<<<<<<< @@ -6319,7 +9439,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x0, 0x1267)); - /* "pylibemu.pyx":520 + /* "pylibemu.pyx":519 * emu_memory_write_dword(_mem, 0xef787c3c, 4711) * emu_memory_write_dword(_mem, 0x0 , 4711) * emu_memory_write_dword(_mem, 0x00416f9a, 4711) # <<<<<<<<<<<<<< @@ -6328,7 +9448,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x00416f9a, 0x1267)); - /* "pylibemu.pyx":521 + /* "pylibemu.pyx":520 * emu_memory_write_dword(_mem, 0x0 , 4711) * emu_memory_write_dword(_mem, 0x00416f9a, 4711) * emu_memory_write_dword(_mem, 0x0044fcf7, 4711) # <<<<<<<<<<<<<< @@ -6337,7 +9457,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x0044fcf7, 0x1267)); - /* "pylibemu.pyx":522 + /* "pylibemu.pyx":521 * emu_memory_write_dword(_mem, 0x00416f9a, 4711) * emu_memory_write_dword(_mem, 0x0044fcf7, 4711) * emu_memory_write_dword(_mem, 0x00001265, 4711) # <<<<<<<<<<<<<< @@ -6346,7 +9466,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x00001265, 0x1267)); - /* "pylibemu.pyx":523 + /* "pylibemu.pyx":522 * emu_memory_write_dword(_mem, 0x0044fcf7, 4711) * emu_memory_write_dword(_mem, 0x00001265, 4711) * emu_memory_write_dword(_mem, 0x00002583, 4711) # <<<<<<<<<<<<<< @@ -6355,7 +9475,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x00002583, 0x1267)); - /* "pylibemu.pyx":524 + /* "pylibemu.pyx":523 * emu_memory_write_dword(_mem, 0x00001265, 4711) * emu_memory_write_dword(_mem, 0x00002583, 4711) * emu_memory_write_dword(_mem, 0x00e000de, 4711) # <<<<<<<<<<<<<< @@ -6364,7 +9484,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x00e000de, 0x1267)); - /* "pylibemu.pyx":525 + /* "pylibemu.pyx":524 * emu_memory_write_dword(_mem, 0x00002583, 4711) * emu_memory_write_dword(_mem, 0x00e000de, 4711) * emu_memory_write_dword(_mem, 0x01001265, 4711) # <<<<<<<<<<<<<< @@ -6373,7 +9493,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x01001265, 0x1267)); - /* "pylibemu.pyx":526 + /* "pylibemu.pyx":525 * emu_memory_write_dword(_mem, 0x00e000de, 4711) * emu_memory_write_dword(_mem, 0x01001265, 4711) * emu_memory_write_dword(_mem, 0x8a000066, 4711) # <<<<<<<<<<<<<< @@ -6382,7 +9502,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x8a000066, 0x1267)); - /* "pylibemu.pyx":527 + /* "pylibemu.pyx":526 * emu_memory_write_dword(_mem, 0x01001265, 4711) * emu_memory_write_dword(_mem, 0x8a000066, 4711) * emu_memory_write_dword(_mem, 0x7c80ffec, 0xc330408b) # <<<<<<<<<<<<<< @@ -6391,7 +9511,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x7c80ffec, 0xc330408b)); - /* "pylibemu.pyx":530 + /* "pylibemu.pyx":529 * * # Set the flags * emu_cpu_eflags_set(_cpu, 0) # <<<<<<<<<<<<<< @@ -6400,17 +9520,17 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ emu_cpu_eflags_set(__pyx_v__cpu, 0); - /* "pylibemu.pyx":533 + /* "pylibemu.pyx":532 * * # Write the code to the offset * scode = shellcode # <<<<<<<<<<<<<< * static_offset = 0x417000 * emu_memory_write_block(_mem, static_offset, scode, len(shellcode)) */ - __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_shellcode); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 533, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_shellcode); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L1_error) __pyx_v_scode = ((char *)__pyx_t_6); - /* "pylibemu.pyx":534 + /* "pylibemu.pyx":533 * # Write the code to the offset * scode = shellcode * static_offset = 0x417000 # <<<<<<<<<<<<<< @@ -6419,43 +9539,43 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ __pyx_v_static_offset = 0x417000; - /* "pylibemu.pyx":535 + /* "pylibemu.pyx":534 * scode = shellcode * static_offset = 0x417000 * emu_memory_write_block(_mem, static_offset, scode, len(shellcode)) # <<<<<<<<<<<<<< * * # Set eip to the code */ - __pyx_t_7 = PyObject_Length(__pyx_v_shellcode); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 535, __pyx_L1_error) + __pyx_t_7 = PyObject_Length(__pyx_v_shellcode); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 534, __pyx_L1_error) (void)(emu_memory_write_block(__pyx_v__mem, __pyx_v_static_offset, __pyx_v_scode, __pyx_t_7)); - /* "pylibemu.pyx":538 + /* "pylibemu.pyx":537 * * # Set eip to the code * emu_cpu_eip_set(emu_cpu_get(self._emu), static_offset + offset) # <<<<<<<<<<<<<< * * emu_memory_write_block(_mem, 0x0012fe98, scode, len(shellcode)) */ - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_static_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_static_offset); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_8 = __Pyx_PyInt_As_uint32_t(__pyx_t_3); if (unlikely((__pyx_t_8 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 538, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_As_uint32_t(__pyx_t_3); if (unlikely((__pyx_t_8 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; emu_cpu_eip_set(emu_cpu_get(__pyx_v_self->_emu), __pyx_t_8); - /* "pylibemu.pyx":540 + /* "pylibemu.pyx":539 * emu_cpu_eip_set(emu_cpu_get(self._emu), static_offset + offset) * * emu_memory_write_block(_mem, 0x0012fe98, scode, len(shellcode)) # <<<<<<<<<<<<<< * emu_cpu_reg32_set(emu_cpu_get(self._emu), esp, 0x0012fe98) * */ - __pyx_t_7 = PyObject_Length(__pyx_v_shellcode); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 540, __pyx_L1_error) + __pyx_t_7 = PyObject_Length(__pyx_v_shellcode); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 539, __pyx_L1_error) (void)(emu_memory_write_block(__pyx_v__mem, 0x0012fe98, __pyx_v_scode, __pyx_t_7)); - /* "pylibemu.pyx":541 + /* "pylibemu.pyx":540 * * emu_memory_write_block(_mem, 0x0012fe98, scode, len(shellcode)) * emu_cpu_reg32_set(emu_cpu_get(self._emu), esp, 0x0012fe98) # <<<<<<<<<<<<<< @@ -6464,7 +9584,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe */ emu_cpu_reg32_set(emu_cpu_get(__pyx_v_self->_emu), esp, 0x0012fe98); - /* "pylibemu.pyx":492 + /* "pylibemu.pyx":491 * return self._offset * * def prepare(self, shellcode, offset): # <<<<<<<<<<<<<< @@ -6487,7 +9607,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe return __pyx_r; } -/* "pylibemu.pyx":543 +/* "pylibemu.pyx":542 * emu_cpu_reg32_set(emu_cpu_get(self._emu), esp, 0x0012fe98) * * cdef check_stop_emulation(self, c_emu_env_hook *hook): # <<<<<<<<<<<<<< @@ -6499,16 +9619,17 @@ static PyObject *__pyx_f_8pylibemu_8Emulator_check_stop_emulation(CYTHON_UNUSED PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; + PyObject *__pyx_t_4 = NULL; int __pyx_t_5; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("check_stop_emulation", 0); + __Pyx_RefNannySetupContext("check_stop_emulation", 1); - /* "pylibemu.pyx":544 + /* "pylibemu.pyx":543 * * cdef check_stop_emulation(self, c_emu_env_hook *hook): * return hook.hook.win.fnname.decode('utf-8') in ('ExitProcess', 'ExitThread', 'exit') # <<<<<<<<<<<<<< @@ -6517,34 +9638,35 @@ static PyObject *__pyx_f_8pylibemu_8Emulator_check_stop_emulation(CYTHON_UNUSED */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_v_hook->hook.win->fnname; - __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = __pyx_t_2; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_ExitProcess, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 544, __pyx_L1_error) - if (!__pyx_t_5) { + __pyx_t_2 = __Pyx_ssize_strlen(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 543, __pyx_L1_error) + __pyx_t_3 = __Pyx_decode_c_string(__pyx_t_1, 0, __pyx_t_2, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = __pyx_t_3; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_ExitProcess, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 543, __pyx_L1_error) + if (!__pyx_t_6) { } else { - __pyx_t_4 = __pyx_t_5; + __pyx_t_5 = __pyx_t_6; goto __pyx_L3_bool_binop_done; } - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_ExitThread, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 544, __pyx_L1_error) - if (!__pyx_t_5) { + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_ExitThread, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 543, __pyx_L1_error) + if (!__pyx_t_6) { } else { - __pyx_t_4 = __pyx_t_5; + __pyx_t_5 = __pyx_t_6; goto __pyx_L3_bool_binop_done; } - __pyx_t_5 = (__Pyx_PyUnicode_Equals(__pyx_t_3, __pyx_n_u_exit_3, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 544, __pyx_L1_error) - __pyx_t_4 = __pyx_t_5; + __pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_4, __pyx_n_u_exit_3, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 543, __pyx_L1_error) + __pyx_t_5 = __pyx_t_6; __pyx_L3_bool_binop_done:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "pylibemu.pyx":543 + /* "pylibemu.pyx":542 * emu_cpu_reg32_set(emu_cpu_get(self._emu), esp, 0x0012fe98) * * cdef check_stop_emulation(self, c_emu_env_hook *hook): # <<<<<<<<<<<<<< @@ -6554,8 +9676,8 @@ static PyObject *__pyx_f_8pylibemu_8Emulator_check_stop_emulation(CYTHON_UNUSED /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("pylibemu.Emulator.check_stop_emulation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -6564,7 +9686,7 @@ static PyObject *__pyx_f_8pylibemu_8Emulator_check_stop_emulation(CYTHON_UNUSED return __pyx_r; } -/* "pylibemu.pyx":546 +/* "pylibemu.pyx":545 * return hook.hook.win.fnname.decode('utf-8') in ('ExitProcess', 'ExitThread', 'exit') * * cpdef int test(self, steps = 1000000): # <<<<<<<<<<<<<< @@ -6572,7 +9694,13 @@ static PyObject *__pyx_f_8pylibemu_8Emulator_check_stop_emulation(CYTHON_UNUSED * Method used to test and emulate the shellcode. The method must be always */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_15test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_15test(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 int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_test *__pyx_optional_args) { PyObject *__pyx_v_steps = ((PyObject *)__pyx_int_1000000); struct emu_cpu *__pyx_v__cpu; @@ -6595,10 +9723,11 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator Py_ssize_t __pyx_t_9; Py_UCS4 __pyx_t_10; PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("test", 0); + __Pyx_RefNannySetupContext("test", 1); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_steps = __pyx_optional_args->steps; @@ -6607,32 +9736,39 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ - else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { - PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_test); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 546, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_test); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8pylibemu_8Emulator_15test)) { + if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_8pylibemu_8Emulator_15test)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(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; } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_steps) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_steps); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 546, __pyx_L1_error) + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_steps}; + __pyx_t_2 = __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_2)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6641,7 +9777,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); - if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif @@ -6651,17 +9787,17 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator #endif } - /* "pylibemu.pyx":562 + /* "pylibemu.pyx":561 * cdef c_emu_env_hook *hook * * if self._emu is NULL: # <<<<<<<<<<<<<< * return -1 * */ - __pyx_t_6 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_6 = (__pyx_v_self->_emu == NULL); if (__pyx_t_6) { - /* "pylibemu.pyx":563 + /* "pylibemu.pyx":562 * * if self._emu is NULL: * return -1 # <<<<<<<<<<<<<< @@ -6671,7 +9807,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __pyx_r = -1; goto __pyx_L0; - /* "pylibemu.pyx":562 + /* "pylibemu.pyx":561 * cdef c_emu_env_hook *hook * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -6680,7 +9816,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ } - /* "pylibemu.pyx":565 + /* "pylibemu.pyx":564 * return -1 * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -6689,7 +9825,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":566 + /* "pylibemu.pyx":565 * * _cpu = emu_cpu_get(self._emu) * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -6698,7 +9834,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":567 + /* "pylibemu.pyx":566 * _cpu = emu_cpu_get(self._emu) * _mem = emu_memory_get(self._emu) * _env = emu_env_new(self._emu) # <<<<<<<<<<<<<< @@ -6707,31 +9843,31 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_v__env = emu_env_new(__pyx_v_self->_emu); - /* "pylibemu.pyx":568 + /* "pylibemu.pyx":567 * _mem = emu_memory_get(self._emu) * _env = emu_env_new(self._emu) * if _env is NULL: # <<<<<<<<<<<<<< * print(emu_strerror(self._emu)) * return -1 */ - __pyx_t_6 = ((__pyx_v__env == NULL) != 0); + __pyx_t_6 = (__pyx_v__env == NULL); if (__pyx_t_6) { - /* "pylibemu.pyx":569 + /* "pylibemu.pyx":568 * _env = emu_env_new(self._emu) * if _env is NULL: * print(emu_strerror(self._emu)) # <<<<<<<<<<<<<< * return -1 * */ - __pyx_t_1 = __Pyx_PyBytes_FromString(emu_strerror(__pyx_v_self->_emu)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(emu_strerror(__pyx_v_self->_emu)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 568, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 569, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 568, __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; - /* "pylibemu.pyx":570 + /* "pylibemu.pyx":569 * if _env is NULL: * print(emu_strerror(self._emu)) * return -1 # <<<<<<<<<<<<<< @@ -6741,7 +9877,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __pyx_r = -1; goto __pyx_L0; - /* "pylibemu.pyx":568 + /* "pylibemu.pyx":567 * _mem = emu_memory_get(self._emu) * _env = emu_env_new(self._emu) * if _env is NULL: # <<<<<<<<<<<<<< @@ -6750,7 +9886,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ } - /* "pylibemu.pyx":572 + /* "pylibemu.pyx":571 * return -1 * * _env.profile = emu_profile_new() # <<<<<<<<<<<<<< @@ -6759,7 +9895,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_v__env->profile = emu_profile_new(); - /* "pylibemu.pyx":575 + /* "pylibemu.pyx":574 * * # IAT for sqlslammer * emu_memory_write_dword(_mem, 0x42ae1018, 0x7c801d77) # <<<<<<<<<<<<<< @@ -6768,7 +9904,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x42ae1018, 0x7c801d77)); - /* "pylibemu.pyx":576 + /* "pylibemu.pyx":575 * # IAT for sqlslammer * emu_memory_write_dword(_mem, 0x42ae1018, 0x7c801d77) * emu_memory_write_dword(_mem, 0x42ae1010, 0x7c80ada0) # <<<<<<<<<<<<<< @@ -6777,7 +9913,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x42ae1010, 0x7c80ada0)); - /* "pylibemu.pyx":577 + /* "pylibemu.pyx":576 * emu_memory_write_dword(_mem, 0x42ae1018, 0x7c801d77) * emu_memory_write_dword(_mem, 0x42ae1010, 0x7c80ada0) * emu_memory_write_dword(_mem, 0x7c80ada0, 0x51ec8b55) # <<<<<<<<<<<<<< @@ -6786,7 +9922,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ (void)(emu_memory_write_dword(__pyx_v__mem, 0x7c80ada0, 0x51ec8b55)); - /* "pylibemu.pyx":578 + /* "pylibemu.pyx":577 * emu_memory_write_dword(_mem, 0x42ae1010, 0x7c80ada0) * emu_memory_write_dword(_mem, 0x7c80ada0, 0x51ec8b55) * emu_memory_write_byte(_mem, 0x7c814eeb, 0xc3) # <<<<<<<<<<<<<< @@ -6795,7 +9931,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ (void)(emu_memory_write_byte(__pyx_v__mem, 0x7c814eeb, 0xc3)); - /* "pylibemu.pyx":580 + /* "pylibemu.pyx":579 * emu_memory_write_byte(_mem, 0x7c814eeb, 0xc3) * * emu_env_w32_load_dll(_env.env.win, "urlmon.dll") # <<<<<<<<<<<<<< @@ -6804,17 +9940,16 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ (void)(emu_env_w32_load_dll(__pyx_v__env->env.win, ((char *)"urlmon.dll"))); - /* "pylibemu.pyx":582 + /* "pylibemu.pyx":581 * emu_env_w32_load_dll(_env.env.win, "urlmon.dll") * * if self.enable_hooks: # <<<<<<<<<<<<<< * emu_env_w32_export_hook(_env, "ExitProcess", ExitProcess, NULL) * emu_env_w32_export_hook(_env, "ExitThread", ExitThread, NULL) */ - __pyx_t_6 = (__pyx_v_self->enable_hooks != 0); - if (__pyx_t_6) { + if (__pyx_v_self->enable_hooks) { - /* "pylibemu.pyx":583 + /* "pylibemu.pyx":582 * * if self.enable_hooks: * emu_env_w32_export_hook(_env, "ExitProcess", ExitProcess, NULL) # <<<<<<<<<<<<<< @@ -6823,7 +9958,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ (void)(emu_env_w32_export_hook(__pyx_v__env, ((char *)"ExitProcess"), __pyx_f_8pylibemu_ExitProcess, NULL)); - /* "pylibemu.pyx":584 + /* "pylibemu.pyx":583 * if self.enable_hooks: * emu_env_w32_export_hook(_env, "ExitProcess", ExitProcess, NULL) * emu_env_w32_export_hook(_env, "ExitThread", ExitThread, NULL) # <<<<<<<<<<<<<< @@ -6832,7 +9967,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ (void)(emu_env_w32_export_hook(__pyx_v__env, ((char *)"ExitThread"), __pyx_f_8pylibemu_ExitThread, NULL)); - /* "pylibemu.pyx":585 + /* "pylibemu.pyx":584 * emu_env_w32_export_hook(_env, "ExitProcess", ExitProcess, NULL) * emu_env_w32_export_hook(_env, "ExitThread", ExitThread, NULL) * emu_env_w32_export_hook(_env, "URLDownloadToFileA", URLDownloadToFile, NULL) # <<<<<<<<<<<<<< @@ -6841,7 +9976,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ (void)(emu_env_w32_export_hook(__pyx_v__env, ((char *)"URLDownloadToFileA"), __pyx_f_8pylibemu_URLDownloadToFile, NULL)); - /* "pylibemu.pyx":582 + /* "pylibemu.pyx":581 * emu_env_w32_load_dll(_env.env.win, "urlmon.dll") * * if self.enable_hooks: # <<<<<<<<<<<<<< @@ -6850,7 +9985,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ } - /* "pylibemu.pyx":587 + /* "pylibemu.pyx":586 * emu_env_w32_export_hook(_env, "URLDownloadToFileA", URLDownloadToFile, NULL) * * eipsave = 0 # <<<<<<<<<<<<<< @@ -6859,7 +9994,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_v_eipsave = 0; - /* "pylibemu.pyx":588 + /* "pylibemu.pyx":587 * * eipsave = 0 * ret = 0 # <<<<<<<<<<<<<< @@ -6868,29 +10003,29 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_v_ret = 0; - /* "pylibemu.pyx":590 + /* "pylibemu.pyx":589 * ret = 0 * * for j in range(steps): # <<<<<<<<<<<<<< * if not _cpu.repeat_current_instr: * eipsave = emu_cpu_eip_get(emu_cpu_get(self._emu)) */ - __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_v_steps); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 590, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_v_steps); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 589, __pyx_L1_error) __pyx_t_8 = __pyx_t_7; for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_8; __pyx_t_5+=1) { __pyx_v_j = __pyx_t_5; - /* "pylibemu.pyx":591 + /* "pylibemu.pyx":590 * * for j in range(steps): * if not _cpu.repeat_current_instr: # <<<<<<<<<<<<<< * eipsave = emu_cpu_eip_get(emu_cpu_get(self._emu)) * */ - __pyx_t_6 = ((!(__pyx_v__cpu->repeat_current_instr != 0)) != 0); + __pyx_t_6 = (!__pyx_v__cpu->repeat_current_instr); if (__pyx_t_6) { - /* "pylibemu.pyx":592 + /* "pylibemu.pyx":591 * for j in range(steps): * if not _cpu.repeat_current_instr: * eipsave = emu_cpu_eip_get(emu_cpu_get(self._emu)) # <<<<<<<<<<<<<< @@ -6899,7 +10034,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_v_eipsave = emu_cpu_eip_get(emu_cpu_get(__pyx_v_self->_emu)); - /* "pylibemu.pyx":591 + /* "pylibemu.pyx":590 * * for j in range(steps): * if not _cpu.repeat_current_instr: # <<<<<<<<<<<<<< @@ -6908,7 +10043,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ } - /* "pylibemu.pyx":594 + /* "pylibemu.pyx":593 * eipsave = emu_cpu_eip_get(emu_cpu_get(self._emu)) * * hook = emu_env_w32_eip_check(_env) # <<<<<<<<<<<<<< @@ -6917,39 +10052,39 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_v_hook = emu_env_w32_eip_check(__pyx_v__env); - /* "pylibemu.pyx":595 + /* "pylibemu.pyx":594 * * hook = emu_env_w32_eip_check(_env) * if hook is not NULL: # <<<<<<<<<<<<<< * if hook.hook.win.fnname is NULL: * logging.warning("Unhooked call to %s\n" % (hook.hook.win.fnname, )) */ - __pyx_t_6 = ((__pyx_v_hook != NULL) != 0); + __pyx_t_6 = (__pyx_v_hook != NULL); if (__pyx_t_6) { - /* "pylibemu.pyx":596 + /* "pylibemu.pyx":595 * hook = emu_env_w32_eip_check(_env) * if hook is not NULL: * if hook.hook.win.fnname is NULL: # <<<<<<<<<<<<<< * logging.warning("Unhooked call to %s\n" % (hook.hook.win.fnname, )) * break */ - __pyx_t_6 = ((__pyx_v_hook->hook.win->fnname == NULL) != 0); + __pyx_t_6 = (__pyx_v_hook->hook.win->fnname == NULL); if (__pyx_t_6) { - /* "pylibemu.pyx":597 + /* "pylibemu.pyx":596 * if hook is not NULL: * if hook.hook.win.fnname is NULL: * logging.warning("Unhooked call to %s\n" % (hook.hook.win.fnname, )) # <<<<<<<<<<<<<< * break * */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_logging); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warning); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 597, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warning); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 597, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = 0; __pyx_t_10 = 127; @@ -6957,9 +10092,9 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __pyx_t_9 += 17; __Pyx_GIVEREF(__pyx_kp_u_Unhooked_call_to); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Unhooked_call_to); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_hook->hook.win->fnname); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 597, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_hook->hook.win->fnname); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 597, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_FormatSimpleAndDecref(PyObject_Unicode(__pyx_t_4), __pyx_empty_unicode); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_10 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) > __pyx_t_10) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_11) : __pyx_t_10; @@ -6967,32 +10102,39 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_11); __pyx_t_11 = 0; - __Pyx_INCREF(__pyx_kp_u__6); + __Pyx_INCREF(__pyx_kp_u__4); __pyx_t_9 += 1; - __Pyx_GIVEREF(__pyx_kp_u__6); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__6); - __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 597, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_kp_u__4); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u__4); + __pyx_t_11 = __Pyx_PyUnicode_Join(__pyx_t_1, 3, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_12 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(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_12 = 1; } } - __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_11); - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 597, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_11}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __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; - /* "pylibemu.pyx":598 + /* "pylibemu.pyx":597 * if hook.hook.win.fnname is NULL: * logging.warning("Unhooked call to %s\n" % (hook.hook.win.fnname, )) * break # <<<<<<<<<<<<<< @@ -7001,7 +10143,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ goto __pyx_L7_break; - /* "pylibemu.pyx":596 + /* "pylibemu.pyx":595 * hook = emu_env_w32_eip_check(_env) * if hook is not NULL: * if hook.hook.win.fnname is NULL: # <<<<<<<<<<<<<< @@ -7010,20 +10152,20 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ } - /* "pylibemu.pyx":600 + /* "pylibemu.pyx":599 * break * * if self.check_stop_emulation(hook): # <<<<<<<<<<<<<< * break * else: */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_Emulator *)__pyx_v_self->__pyx_vtab)->check_stop_emulation(__pyx_v_self, __pyx_v_hook); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_Emulator *)__pyx_v_self->__pyx_vtab)->check_stop_emulation(__pyx_v_self, __pyx_v_hook); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 600, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_6) { - /* "pylibemu.pyx":601 + /* "pylibemu.pyx":600 * * if self.check_stop_emulation(hook): * break # <<<<<<<<<<<<<< @@ -7032,7 +10174,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ goto __pyx_L7_break; - /* "pylibemu.pyx":600 + /* "pylibemu.pyx":599 * break * * if self.check_stop_emulation(hook): # <<<<<<<<<<<<<< @@ -7041,7 +10183,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ } - /* "pylibemu.pyx":595 + /* "pylibemu.pyx":594 * * hook = emu_env_w32_eip_check(_env) * if hook is not NULL: # <<<<<<<<<<<<<< @@ -7051,7 +10193,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator goto __pyx_L9; } - /* "pylibemu.pyx":603 + /* "pylibemu.pyx":602 * break * else: * ret = emu_cpu_parse(emu_cpu_get(self._emu)) # <<<<<<<<<<<<<< @@ -7061,7 +10203,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator /*else*/ { __pyx_v_ret = emu_cpu_parse(emu_cpu_get(__pyx_v_self->_emu)); - /* "pylibemu.pyx":604 + /* "pylibemu.pyx":603 * else: * ret = emu_cpu_parse(emu_cpu_get(self._emu)) * hook = NULL # <<<<<<<<<<<<<< @@ -7070,17 +10212,17 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_v_hook = NULL; - /* "pylibemu.pyx":605 + /* "pylibemu.pyx":604 * ret = emu_cpu_parse(emu_cpu_get(self._emu)) * hook = NULL * if ret != -1: # <<<<<<<<<<<<<< * hook = emu_env_linux_syscall_check(_env) * if hook is NULL: */ - __pyx_t_6 = ((__pyx_v_ret != -1L) != 0); + __pyx_t_6 = (__pyx_v_ret != -1L); if (__pyx_t_6) { - /* "pylibemu.pyx":606 + /* "pylibemu.pyx":605 * hook = NULL * if ret != -1: * hook = emu_env_linux_syscall_check(_env) # <<<<<<<<<<<<<< @@ -7089,17 +10231,17 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_v_hook = emu_env_linux_syscall_check(__pyx_v__env); - /* "pylibemu.pyx":607 + /* "pylibemu.pyx":606 * if ret != -1: * hook = emu_env_linux_syscall_check(_env) * if hook is NULL: # <<<<<<<<<<<<<< * ret = emu_cpu_step(emu_cpu_get(self._emu)) * else: */ - __pyx_t_6 = ((__pyx_v_hook == NULL) != 0); + __pyx_t_6 = (__pyx_v_hook == NULL); if (__pyx_t_6) { - /* "pylibemu.pyx":608 + /* "pylibemu.pyx":607 * hook = emu_env_linux_syscall_check(_env) * if hook is NULL: * ret = emu_cpu_step(emu_cpu_get(self._emu)) # <<<<<<<<<<<<<< @@ -7108,7 +10250,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_v_ret = emu_cpu_step(emu_cpu_get(__pyx_v_self->_emu)); - /* "pylibemu.pyx":607 + /* "pylibemu.pyx":606 * if ret != -1: * hook = emu_env_linux_syscall_check(_env) * if hook is NULL: # <<<<<<<<<<<<<< @@ -7118,7 +10260,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator goto __pyx_L13; } - /* "pylibemu.pyx":610 + /* "pylibemu.pyx":609 * ret = emu_cpu_step(emu_cpu_get(self._emu)) * else: * logging.warning("Error") # <<<<<<<<<<<<<< @@ -7126,31 +10268,38 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * if ret == -1: */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_logging); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warning); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 610, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warning); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = 0; + #if CYTHON_UNPACK_METHODS + if (unlikely(PyMethod_Check(__pyx_t_11))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); + __pyx_t_12 = 1; } } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_3, __pyx_n_u_Error) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_n_u_Error); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_n_u_Error}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_12, 1+__pyx_t_12); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L13:; - /* "pylibemu.pyx":605 + /* "pylibemu.pyx":604 * ret = emu_cpu_parse(emu_cpu_get(self._emu)) * hook = NULL * if ret != -1: # <<<<<<<<<<<<<< @@ -7159,17 +10308,17 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ } - /* "pylibemu.pyx":612 + /* "pylibemu.pyx":611 * logging.warning("Error") * * if ret == -1: # <<<<<<<<<<<<<< * break * */ - __pyx_t_6 = ((__pyx_v_ret == -1L) != 0); + __pyx_t_6 = (__pyx_v_ret == -1L); if (__pyx_t_6) { - /* "pylibemu.pyx":613 + /* "pylibemu.pyx":612 * * if ret == -1: * break # <<<<<<<<<<<<<< @@ -7178,7 +10327,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ goto __pyx_L7_break; - /* "pylibemu.pyx":612 + /* "pylibemu.pyx":611 * logging.warning("Error") * * if ret == -1: # <<<<<<<<<<<<<< @@ -7191,18 +10340,18 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator } __pyx_L7_break:; - /* "pylibemu.pyx":615 + /* "pylibemu.pyx":614 * break * * self.emu_profile.emu_profile_debug(_env) # <<<<<<<<<<<<<< * return 0 * */ - __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->emu_profile->__pyx_vtab)->emu_profile_debug(__pyx_v_self->emu_profile, __pyx_v__env); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 615, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->emu_profile->__pyx_vtab)->emu_profile_debug(__pyx_v_self->emu_profile, __pyx_v__env); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":616 + /* "pylibemu.pyx":615 * * self.emu_profile.emu_profile_debug(_env) * return 0 # <<<<<<<<<<<<<< @@ -7212,7 +10361,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __pyx_r = 0; goto __pyx_L0; - /* "pylibemu.pyx":546 + /* "pylibemu.pyx":545 * return hook.hook.win.fnname.decode('utf-8') in ('ExitProcess', 'ExitThread', 'exit') * * cpdef int test(self, steps = 1000000): # <<<<<<<<<<<<<< @@ -7227,7 +10376,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_11); - __Pyx_WriteUnraisable("pylibemu.Emulator.test", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_AddTraceback("pylibemu.Emulator.test", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -7235,43 +10384,69 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator } /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_15test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_14test[] = "\n Method used to test and emulate the shellcode. The method must be always\n called after the `prepare' method.\n\n @type steps: Integer\n @param steps: Max number of steps to run\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_15test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_15test(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_8pylibemu_8Emulator_14test, "\n Method used to test and emulate the shellcode. The method must be always\n called after the `prepare' method.\n\n @type steps: Integer\n @param steps: Max number of steps to run\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_15test = {"test", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_15test, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_14test}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_15test(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_steps = 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("test (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_steps,0}; - PyObject* values[1] = {0}; - values[0] = ((PyObject *)__pyx_int_1000000); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_steps,0}; + values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_1000000)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + 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 = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps); - if (value) { values[0] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_steps); + if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 545, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "test") < 0)) __PYX_ERR(0, 546, __pyx_L3_error) + 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, "test") < 0)) __PYX_ERR(0, 545, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; @@ -7279,10 +10454,18 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_15test(PyObject *__pyx_v_self, PyO } __pyx_v_steps = values[0]; } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("test", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 546, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("test", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 545, __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("pylibemu.Emulator.test", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -7290,6 +10473,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_15test(PyObject *__pyx_v_self, PyO __pyx_r = __pyx_pf_8pylibemu_8Emulator_14test(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_steps); /* 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; } @@ -7303,12 +10492,12 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_14test(struct __pyx_obj_8pylibemu_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("test", 0); + __Pyx_RefNannySetupContext("test", 1); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.steps = __pyx_v_steps; - __pyx_t_1 = __pyx_vtabptr_8pylibemu_Emulator->test(__pyx_v_self, 1, &__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 546, __pyx_L1_error) + __pyx_t_1 = __pyx_vtabptr_8pylibemu_Emulator->test(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 545, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 545, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -7325,7 +10514,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_14test(struct __pyx_obj_8pylibemu_ return __pyx_r; } -/* "pylibemu.pyx":618 +/* "pylibemu.pyx":617 * return 0 * * cpdef int run(self, shellcode, steps = 1000000): # <<<<<<<<<<<<<< @@ -7333,7 +10522,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_14test(struct __pyx_obj_8pylibemu_ * */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(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 int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_run *__pyx_optional_args) { PyObject *__pyx_v_steps = ((PyObject *)__pyx_int_1000000); int32_t __pyx_v_offset; @@ -7344,14 +10539,13 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int32_t __pyx_t_7; - int __pyx_t_8; - struct __pyx_opt_args_8pylibemu_8Emulator_test __pyx_t_9; + int32_t __pyx_t_6; + int __pyx_t_7; + struct __pyx_opt_args_8pylibemu_8Emulator_test __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("run", 0); + __Pyx_RefNannySetupContext("run", 1); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_steps = __pyx_optional_args->steps; @@ -7360,19 +10554,20 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ - else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { + else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || __Pyx_PyType_HasFeature(Py_TYPE(((PyObject *)__pyx_v_self)), (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { - PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); + PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_run); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_run); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8pylibemu_8Emulator_17run)) { + if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_8pylibemu_8Emulator_17run)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + #if CYTHON_UNPACK_METHODS + if (unlikely(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); @@ -7382,40 +10577,16 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * __pyx_t_5 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_shellcode, __pyx_v_steps}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_shellcode, __pyx_v_steps}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else #endif { - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 618, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_shellcode); - __Pyx_GIVEREF(__pyx_v_shellcode); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_shellcode); - __Pyx_INCREF(__pyx_v_steps); - __Pyx_GIVEREF(__pyx_v_steps); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_steps); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error) + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_shellcode, __pyx_v_steps}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7424,7 +10595,7 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); - if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { + if (unlikely(__pyx_typedict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif @@ -7434,45 +10605,52 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * #endif } - /* "pylibemu.pyx":621 + /* "pylibemu.pyx":620 * cdef int32_t offset * * offset = self.shellcode_getpc_test(shellcode) # <<<<<<<<<<<<<< * if offset < 0: * offset = 0 */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shellcode_getpc_test); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 621, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shellcode_getpc_test); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = 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_5 = 1; } } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_shellcode) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_shellcode); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 621, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_7 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 621, __pyx_L1_error) + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_shellcode}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 620, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __pyx_t_6 = __Pyx_PyInt_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_6 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_offset = __pyx_t_7; + __pyx_v_offset = __pyx_t_6; - /* "pylibemu.pyx":622 + /* "pylibemu.pyx":621 * * offset = self.shellcode_getpc_test(shellcode) * if offset < 0: # <<<<<<<<<<<<<< * offset = 0 * */ - __pyx_t_8 = ((__pyx_v_offset < 0) != 0); - if (__pyx_t_8) { + __pyx_t_7 = (__pyx_v_offset < 0); + if (__pyx_t_7) { - /* "pylibemu.pyx":623 + /* "pylibemu.pyx":622 * offset = self.shellcode_getpc_test(shellcode) * if offset < 0: * offset = 0 # <<<<<<<<<<<<<< @@ -7481,7 +10659,7 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * */ __pyx_v_offset = 0; - /* "pylibemu.pyx":622 + /* "pylibemu.pyx":621 * * offset = self.shellcode_getpc_test(shellcode) * if offset < 0: # <<<<<<<<<<<<<< @@ -7490,80 +10668,56 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * */ } - /* "pylibemu.pyx":625 + /* "pylibemu.pyx":624 * offset = 0 * * self.prepare(shellcode, offset) # <<<<<<<<<<<<<< * return self.test(steps = steps) * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prepare); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 625, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prepare); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int32_t(__pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int32_t(__pyx_v_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = NULL; + __pyx_t_4 = NULL; __pyx_t_5 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_6)) { + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_shellcode, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_shellcode, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else #endif { - __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 625, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_INCREF(__pyx_v_shellcode); - __Pyx_GIVEREF(__pyx_v_shellcode); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_shellcode); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error) + PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_shellcode, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __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_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "pylibemu.pyx":626 + /* "pylibemu.pyx":625 * * self.prepare(shellcode, offset) * return self.test(steps = steps) # <<<<<<<<<<<<<< * * @property */ - __pyx_t_9.__pyx_n = 1; - __pyx_t_9.steps = __pyx_v_steps; - __pyx_t_5 = ((struct __pyx_vtabstruct_8pylibemu_Emulator *)__pyx_v_self->__pyx_vtab)->test(__pyx_v_self, 0, &__pyx_t_9); + __pyx_t_8.__pyx_n = 1; + __pyx_t_8.steps = __pyx_v_steps; + __pyx_t_5 = ((struct __pyx_vtabstruct_8pylibemu_Emulator *)__pyx_v_self->__pyx_vtab)->test(__pyx_v_self, 0, &__pyx_t_8); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 625, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0; - /* "pylibemu.pyx":618 + /* "pylibemu.pyx":617 * return 0 * * cpdef int run(self, shellcode, steps = 1000000): # <<<<<<<<<<<<<< @@ -7577,8 +10731,7 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("pylibemu.Emulator.run", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_AddTraceback("pylibemu.Emulator.run", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -7586,51 +10739,81 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * } /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(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_8pylibemu_8Emulator_17run = {"run", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_17run, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(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_shellcode = 0; PyObject *__pyx_v_steps = 0; + #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("run (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shellcode,&__pyx_n_s_steps,0}; - PyObject* values[2] = {0,0}; - values[1] = ((PyObject *)__pyx_int_1000000); - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shellcode,&__pyx_n_s_steps,0}; + values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)__pyx_int_1000000)); + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shellcode)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shellcode)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 617, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_steps); - if (value) { values[1] = value; kw_args--; } + PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_steps); + if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 617, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "run") < 0)) __PYX_ERR(0, 618, __pyx_L3_error) + 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, "run") < 0)) __PYX_ERR(0, 617, __pyx_L3_error) } } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } @@ -7638,10 +10821,18 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(PyObject *__pyx_v_self, PyOb __pyx_v_shellcode = values[0]; __pyx_v_steps = values[1]; } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("run", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 618, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("run", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 617, __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("pylibemu.Emulator.run", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -7649,6 +10840,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(PyObject *__pyx_v_self, PyOb __pyx_r = __pyx_pf_8pylibemu_8Emulator_16run(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_shellcode, __pyx_v_steps); /* 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; } @@ -7662,12 +10859,12 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_16run(struct __pyx_obj_8pylibemu_E int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("run", 0); + __Pyx_RefNannySetupContext("run", 1); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.steps = __pyx_v_steps; - __pyx_t_1 = __pyx_vtabptr_8pylibemu_Emulator->run(__pyx_v_self, __pyx_v_shellcode, 1, &__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 618, __pyx_L1_error) + __pyx_t_1 = __pyx_vtabptr_8pylibemu_Emulator->run(__pyx_v_self, __pyx_v_shellcode, 1, &__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 617, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -7684,20 +10881,22 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_16run(struct __pyx_obj_8pylibemu_E return __pyx_r; } -/* "pylibemu.pyx":629 +/* "pylibemu.pyx":627 + * return self.test(steps = steps) * - * @property - * def offset(self): # <<<<<<<<<<<<<< + * @property # <<<<<<<<<<<<<< + * def offset(self): * return self._offset - * */ /* Python wrapper */ static PyObject *__pyx_pw_8pylibemu_8Emulator_6offset_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8pylibemu_8Emulator_6offset_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_8pylibemu_8Emulator_6offset___get__(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -7712,9 +10911,9 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6offset___get__(struct __pyx_obj_8 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("__get__", 1); - /* "pylibemu.pyx":630 + /* "pylibemu.pyx":629 * @property * def offset(self): * return self._offset # <<<<<<<<<<<<<< @@ -7722,18 +10921,18 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6offset___get__(struct __pyx_obj_8 * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->_offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->_offset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "pylibemu.pyx":629 + /* "pylibemu.pyx":627 + * return self.test(steps = steps) * - * @property - * def offset(self): # <<<<<<<<<<<<<< + * @property # <<<<<<<<<<<<<< + * def offset(self): * return self._offset - * */ /* function exit code */ @@ -7747,20 +10946,22 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6offset___get__(struct __pyx_obj_8 return __pyx_r; } -/* "pylibemu.pyx":633 +/* "pylibemu.pyx":631 + * return self._offset * - * @property - * def emu_profile_output(self): # <<<<<<<<<<<<<< + * @property # <<<<<<<<<<<<<< + * def emu_profile_output(self): * return self.emu_profile.output - * */ /* Python wrapper */ static PyObject *__pyx_pw_8pylibemu_8Emulator_18emu_profile_output_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8pylibemu_8Emulator_18emu_profile_output_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_8pylibemu_8Emulator_18emu_profile_output___get__(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -7775,9 +10976,9 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18emu_profile_output___get__(struc int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("__get__", 1); - /* "pylibemu.pyx":634 + /* "pylibemu.pyx":633 * @property * def emu_profile_output(self): * return self.emu_profile.output # <<<<<<<<<<<<<< @@ -7785,18 +10986,18 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18emu_profile_output___get__(struc * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->emu_profile->output); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->emu_profile->output); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "pylibemu.pyx":633 + /* "pylibemu.pyx":631 + * return self._offset * - * @property - * def emu_profile_output(self): # <<<<<<<<<<<<<< + * @property # <<<<<<<<<<<<<< + * def emu_profile_output(self): * return self.emu_profile.output - * */ /* function exit code */ @@ -7810,20 +11011,22 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18emu_profile_output___get__(struc return __pyx_r; } -/* "pylibemu.pyx":637 +/* "pylibemu.pyx":635 + * return self.emu_profile.output * - * @property - * def emu_profile_truncated(self): # <<<<<<<<<<<<<< + * @property # <<<<<<<<<<<<<< + * def emu_profile_truncated(self): * return self.emu_profile.truncate - * */ /* Python wrapper */ static PyObject *__pyx_pw_8pylibemu_8Emulator_21emu_profile_truncated_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8pylibemu_8Emulator_21emu_profile_truncated_1__get__(PyObject *__pyx_v_self) { + CYTHON_UNUSED PyObject *const *__pyx_kwvalues; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); __pyx_r = __pyx_pf_8pylibemu_8Emulator_21emu_profile_truncated___get__(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -7838,9 +11041,9 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_21emu_profile_truncated___get__(st int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_RefNannySetupContext("__get__", 1); - /* "pylibemu.pyx":638 + /* "pylibemu.pyx":637 * @property * def emu_profile_truncated(self): * return self.emu_profile.truncate # <<<<<<<<<<<<<< @@ -7848,18 +11051,18 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_21emu_profile_truncated___get__(st * # CPU methods */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->emu_profile->truncate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->emu_profile->truncate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "pylibemu.pyx":637 + /* "pylibemu.pyx":635 + * return self.emu_profile.output * - * @property - * def emu_profile_truncated(self): # <<<<<<<<<<<<<< + * @property # <<<<<<<<<<<<<< + * def emu_profile_truncated(self): * return self.emu_profile.truncate - * */ /* function exit code */ @@ -7873,7 +11076,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_21emu_profile_truncated___get__(st return __pyx_r; } -/* "pylibemu.pyx":641 +/* "pylibemu.pyx":640 * * # CPU methods * def cpu_reg32_get(self, c_emu_reg32 reg): # <<<<<<<<<<<<<< @@ -7882,28 +11085,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_21emu_profile_truncated___get__(st */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_19cpu_reg32_get(PyObject *__pyx_v_self, PyObject *__pyx_arg_reg); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_18cpu_reg32_get[] = "\n Method used to get the 32-bit value stored in a register\n\n @type reg: Integer\n @param reg: Register index\n eax = 0\n ecx = 1\n edx = 2\n ebx = 3\n esp = 4\n ebp = 5\n esi = 6\n edi = 7\n\n @rtype: uint32_t\n @return: 32-bit value stored in the register\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_19cpu_reg32_get(PyObject *__pyx_v_self, PyObject *__pyx_arg_reg) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_19cpu_reg32_get(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_8pylibemu_8Emulator_18cpu_reg32_get, "\n Method used to get the 32-bit value stored in a register\n\n @type reg: Integer\n @param reg: Register index\n eax = 0\n ecx = 1\n edx = 2\n ebx = 3\n esp = 4\n ebp = 5\n esi = 6\n edi = 7\n\n @rtype: uint32_t\n @return: 32-bit value stored in the register\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_19cpu_reg32_get = {"cpu_reg32_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_19cpu_reg32_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_18cpu_reg32_get}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_19cpu_reg32_get(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 +) { enum emu_reg32 __pyx_v_reg; + #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("cpu_reg32_get (wrapper)", 0); - assert(__pyx_arg_reg); { - __pyx_v_reg = ((enum emu_reg32)__Pyx_PyInt_As_enum__emu_reg32(__pyx_arg_reg)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 641, __pyx_L3_error) + #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_reg,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_reg)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __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, "cpu_reg32_get") < 0)) __PYX_ERR(0, 640, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_reg = ((enum emu_reg32)__Pyx_PyInt_As_enum__emu_reg32(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 640, __pyx_L3_error) } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cpu_reg32_get", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 640, __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("pylibemu.Emulator.cpu_reg32_get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylibemu_8Emulator_18cpu_reg32_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((enum emu_reg32)__pyx_v_reg)); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_18cpu_reg32_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_reg); /* 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; } @@ -7917,32 +11190,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18cpu_reg32_get(struct __pyx_obj_8 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_reg32_get", 0); + __Pyx_RefNannySetupContext("cpu_reg32_get", 1); - /* "pylibemu.pyx":663 + /* "pylibemu.pyx":662 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":664 + /* "pylibemu.pyx":663 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 664, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 664, __pyx_L1_error) + __PYX_ERR(0, 663, __pyx_L1_error) - /* "pylibemu.pyx":663 + /* "pylibemu.pyx":662 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -7951,7 +11224,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18cpu_reg32_get(struct __pyx_obj_8 */ } - /* "pylibemu.pyx":666 + /* "pylibemu.pyx":665 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -7960,7 +11233,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18cpu_reg32_get(struct __pyx_obj_8 */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":667 + /* "pylibemu.pyx":666 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_reg32_get(_cpu, reg) # <<<<<<<<<<<<<< @@ -7968,13 +11241,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18cpu_reg32_get(struct __pyx_obj_8 * def cpu_reg32_set(self, c_emu_reg32 reg, uint32_t val): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_reg32_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_reg32_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 666, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":641 + /* "pylibemu.pyx":640 * * # CPU methods * def cpu_reg32_get(self, c_emu_reg32 reg): # <<<<<<<<<<<<<< @@ -7993,7 +11266,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18cpu_reg32_get(struct __pyx_obj_8 return __pyx_r; } -/* "pylibemu.pyx":669 +/* "pylibemu.pyx":668 * return emu_cpu_reg32_get(_cpu, reg) * * def cpu_reg32_set(self, c_emu_reg32 reg, uint32_t val): # <<<<<<<<<<<<<< @@ -8002,59 +11275,100 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18cpu_reg32_get(struct __pyx_obj_8 */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_21cpu_reg32_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_20cpu_reg32_set[] = "\n Method used to set a register with a 32-bit value\n\n @type reg: Integer\n @param reg: Register index\n eax = 0\n ecx = 1\n edx = 2\n ebx = 3\n esp = 4\n ebp = 5\n esi = 6\n edi = 7\n\n @type val: uint32_t\n @param val: 32-bit value\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_21cpu_reg32_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_21cpu_reg32_set(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_8pylibemu_8Emulator_20cpu_reg32_set, "\n Method used to set a register with a 32-bit value\n\n @type reg: Integer\n @param reg: Register index\n eax = 0\n ecx = 1\n edx = 2\n ebx = 3\n esp = 4\n ebp = 5\n esi = 6\n edi = 7\n\n @type val: uint32_t\n @param val: 32-bit value\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_21cpu_reg32_set = {"cpu_reg32_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_21cpu_reg32_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_20cpu_reg32_set}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_21cpu_reg32_set(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 +) { enum emu_reg32 __pyx_v_reg; uint32_t __pyx_v_val; + #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("cpu_reg32_set (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reg,&__pyx_n_s_val,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reg,&__pyx_n_s_val,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reg)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reg)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 668, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_val)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 668, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, 1); __PYX_ERR(0, 669, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, 1); __PYX_ERR(0, 668, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cpu_reg32_set") < 0)) __PYX_ERR(0, 669, __pyx_L3_error) + 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, "cpu_reg32_set") < 0)) __PYX_ERR(0, 668, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_reg = ((enum emu_reg32)__Pyx_PyInt_As_enum__emu_reg32(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 669, __pyx_L3_error) - __pyx_v_val = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_val == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 669, __pyx_L3_error) + __pyx_v_reg = ((enum emu_reg32)__Pyx_PyInt_As_enum__emu_reg32(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 668, __pyx_L3_error) + __pyx_v_val = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_val == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 668, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 669, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 668, __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("pylibemu.Emulator.cpu_reg32_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -8062,6 +11376,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_21cpu_reg32_set(PyObject *__pyx_v_ __pyx_r = __pyx_pf_8pylibemu_8Emulator_20cpu_reg32_set(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_reg, __pyx_v_val); /* 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; } @@ -8075,32 +11395,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_20cpu_reg32_set(struct __pyx_obj_8 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_reg32_set", 0); + __Pyx_RefNannySetupContext("cpu_reg32_set", 1); - /* "pylibemu.pyx":691 + /* "pylibemu.pyx":690 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":692 + /* "pylibemu.pyx":691 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 691, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 692, __pyx_L1_error) + __PYX_ERR(0, 691, __pyx_L1_error) - /* "pylibemu.pyx":691 + /* "pylibemu.pyx":690 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8109,7 +11429,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_20cpu_reg32_set(struct __pyx_obj_8 */ } - /* "pylibemu.pyx":694 + /* "pylibemu.pyx":693 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -8118,7 +11438,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_20cpu_reg32_set(struct __pyx_obj_8 */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":695 + /* "pylibemu.pyx":694 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_reg32_set(_cpu, reg, val) # <<<<<<<<<<<<<< @@ -8127,7 +11447,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_20cpu_reg32_set(struct __pyx_obj_8 */ emu_cpu_reg32_set(__pyx_v__cpu, __pyx_v_reg, __pyx_v_val); - /* "pylibemu.pyx":669 + /* "pylibemu.pyx":668 * return emu_cpu_reg32_get(_cpu, reg) * * def cpu_reg32_set(self, c_emu_reg32 reg, uint32_t val): # <<<<<<<<<<<<<< @@ -8148,7 +11468,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_20cpu_reg32_set(struct __pyx_obj_8 return __pyx_r; } -/* "pylibemu.pyx":697 +/* "pylibemu.pyx":696 * emu_cpu_reg32_set(_cpu, reg, val) * * def cpu_reg16_get(self, c_emu_reg16 reg): # <<<<<<<<<<<<<< @@ -8157,28 +11477,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_20cpu_reg32_set(struct __pyx_obj_8 */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_23cpu_reg16_get(PyObject *__pyx_v_self, PyObject *__pyx_arg_reg); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_22cpu_reg16_get[] = "\n Method used to get the 16-bit value stored in a register\n\n @type reg: Integer\n @param reg: Register index\n ax = 0\n cx = 1\n dx = 2\n bx = 3\n sp = 4\n bp = 5\n si = 6\n di = 7\n\n @rtype: uint16_t\n @return: 16-bit value stored in the register\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_23cpu_reg16_get(PyObject *__pyx_v_self, PyObject *__pyx_arg_reg) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_23cpu_reg16_get(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_8pylibemu_8Emulator_22cpu_reg16_get, "\n Method used to get the 16-bit value stored in a register\n\n @type reg: Integer\n @param reg: Register index\n ax = 0\n cx = 1\n dx = 2\n bx = 3\n sp = 4\n bp = 5\n si = 6\n di = 7\n\n @rtype: uint16_t\n @return: 16-bit value stored in the register\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_23cpu_reg16_get = {"cpu_reg16_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_23cpu_reg16_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_22cpu_reg16_get}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_23cpu_reg16_get(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 +) { enum emu_reg16 __pyx_v_reg; + #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("cpu_reg16_get (wrapper)", 0); - assert(__pyx_arg_reg); { - __pyx_v_reg = ((enum emu_reg16)__Pyx_PyInt_As_enum__emu_reg16(__pyx_arg_reg)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 697, __pyx_L3_error) + #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_reg,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_reg)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 696, __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, "cpu_reg16_get") < 0)) __PYX_ERR(0, 696, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_reg = ((enum emu_reg16)__Pyx_PyInt_As_enum__emu_reg16(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 696, __pyx_L3_error) } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cpu_reg16_get", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 696, __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("pylibemu.Emulator.cpu_reg16_get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylibemu_8Emulator_22cpu_reg16_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((enum emu_reg16)__pyx_v_reg)); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_22cpu_reg16_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_reg); /* 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; } @@ -8192,32 +11582,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_22cpu_reg16_get(struct __pyx_obj_8 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_reg16_get", 0); + __Pyx_RefNannySetupContext("cpu_reg16_get", 1); - /* "pylibemu.pyx":719 + /* "pylibemu.pyx":718 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":720 + /* "pylibemu.pyx":719 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 720, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 720, __pyx_L1_error) + __PYX_ERR(0, 719, __pyx_L1_error) - /* "pylibemu.pyx":719 + /* "pylibemu.pyx":718 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8226,7 +11616,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_22cpu_reg16_get(struct __pyx_obj_8 */ } - /* "pylibemu.pyx":722 + /* "pylibemu.pyx":721 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -8235,7 +11625,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_22cpu_reg16_get(struct __pyx_obj_8 */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":723 + /* "pylibemu.pyx":722 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_reg16_get(_cpu, reg) # <<<<<<<<<<<<<< @@ -8243,13 +11633,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_22cpu_reg16_get(struct __pyx_obj_8 * def cpu_reg16_set(self, c_emu_reg16 reg, uint16_t val): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint16_t(((uint16_t)emu_cpu_reg16_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint16_t(((uint16_t)emu_cpu_reg16_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 722, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":697 + /* "pylibemu.pyx":696 * emu_cpu_reg32_set(_cpu, reg, val) * * def cpu_reg16_get(self, c_emu_reg16 reg): # <<<<<<<<<<<<<< @@ -8268,7 +11658,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_22cpu_reg16_get(struct __pyx_obj_8 return __pyx_r; } -/* "pylibemu.pyx":725 +/* "pylibemu.pyx":724 * return emu_cpu_reg16_get(_cpu, reg) * * def cpu_reg16_set(self, c_emu_reg16 reg, uint16_t val): # <<<<<<<<<<<<<< @@ -8277,59 +11667,100 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_22cpu_reg16_get(struct __pyx_obj_8 */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_25cpu_reg16_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_24cpu_reg16_set[] = "\n Method used to set a register with a 16-bit value\n\n @type reg: Integer\n @param reg: Register index\n ax = 0\n cx = 1\n dx = 2\n bx = 3\n sp = 4\n bp = 5\n si = 6\n di = 7\n\n @type val: uint16_t\n @param val: 16-bit value\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_25cpu_reg16_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_25cpu_reg16_set(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_8pylibemu_8Emulator_24cpu_reg16_set, "\n Method used to set a register with a 16-bit value\n\n @type reg: Integer\n @param reg: Register index\n ax = 0\n cx = 1\n dx = 2\n bx = 3\n sp = 4\n bp = 5\n si = 6\n di = 7\n\n @type val: uint16_t\n @param val: 16-bit value\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_25cpu_reg16_set = {"cpu_reg16_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_25cpu_reg16_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_24cpu_reg16_set}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_25cpu_reg16_set(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 +) { enum emu_reg16 __pyx_v_reg; uint16_t __pyx_v_val; + #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("cpu_reg16_set (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reg,&__pyx_n_s_val,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reg,&__pyx_n_s_val,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reg)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reg)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 724, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_val)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 724, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("cpu_reg16_set", 1, 2, 2, 1); __PYX_ERR(0, 725, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("cpu_reg16_set", 1, 2, 2, 1); __PYX_ERR(0, 724, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cpu_reg16_set") < 0)) __PYX_ERR(0, 725, __pyx_L3_error) + 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, "cpu_reg16_set") < 0)) __PYX_ERR(0, 724, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_reg = ((enum emu_reg16)__Pyx_PyInt_As_enum__emu_reg16(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 725, __pyx_L3_error) - __pyx_v_val = __Pyx_PyInt_As_uint16_t(values[1]); if (unlikely((__pyx_v_val == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 725, __pyx_L3_error) + __pyx_v_reg = ((enum emu_reg16)__Pyx_PyInt_As_enum__emu_reg16(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 724, __pyx_L3_error) + __pyx_v_val = __Pyx_PyInt_As_uint16_t(values[1]); if (unlikely((__pyx_v_val == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 724, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("cpu_reg16_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 725, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("cpu_reg16_set", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 724, __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("pylibemu.Emulator.cpu_reg16_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -8337,6 +11768,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_25cpu_reg16_set(PyObject *__pyx_v_ __pyx_r = __pyx_pf_8pylibemu_8Emulator_24cpu_reg16_set(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_reg, __pyx_v_val); /* 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; } @@ -8350,32 +11787,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_24cpu_reg16_set(struct __pyx_obj_8 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_reg16_set", 0); + __Pyx_RefNannySetupContext("cpu_reg16_set", 1); - /* "pylibemu.pyx":747 + /* "pylibemu.pyx":746 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":748 + /* "pylibemu.pyx":747 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 748, __pyx_L1_error) + __PYX_ERR(0, 747, __pyx_L1_error) - /* "pylibemu.pyx":747 + /* "pylibemu.pyx":746 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8384,7 +11821,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_24cpu_reg16_set(struct __pyx_obj_8 */ } - /* "pylibemu.pyx":750 + /* "pylibemu.pyx":749 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -8393,7 +11830,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_24cpu_reg16_set(struct __pyx_obj_8 */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":751 + /* "pylibemu.pyx":750 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_reg16_set(_cpu, reg, val) # <<<<<<<<<<<<<< @@ -8402,7 +11839,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_24cpu_reg16_set(struct __pyx_obj_8 */ emu_cpu_reg16_set(__pyx_v__cpu, __pyx_v_reg, __pyx_v_val); - /* "pylibemu.pyx":725 + /* "pylibemu.pyx":724 * return emu_cpu_reg16_get(_cpu, reg) * * def cpu_reg16_set(self, c_emu_reg16 reg, uint16_t val): # <<<<<<<<<<<<<< @@ -8423,7 +11860,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_24cpu_reg16_set(struct __pyx_obj_8 return __pyx_r; } -/* "pylibemu.pyx":753 +/* "pylibemu.pyx":752 * emu_cpu_reg16_set(_cpu, reg, val) * * def cpu_reg8_get(self, c_emu_reg8 reg): # <<<<<<<<<<<<<< @@ -8432,28 +11869,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_24cpu_reg16_set(struct __pyx_obj_8 */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_27cpu_reg8_get(PyObject *__pyx_v_self, PyObject *__pyx_arg_reg); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_26cpu_reg8_get[] = "\n Method used to get the 8-bit value stored in a register\n\n @type reg: Integer\n @param reg: Register index\n al = 0\n cl = 1\n dl = 2\n bl = 3\n ah = 4\n ch = 5\n dh = 6\n bh = 7\n\n @rtype: uint8_t\n @return: 8-bit value stored in the register\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_27cpu_reg8_get(PyObject *__pyx_v_self, PyObject *__pyx_arg_reg) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_27cpu_reg8_get(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_8pylibemu_8Emulator_26cpu_reg8_get, "\n Method used to get the 8-bit value stored in a register\n\n @type reg: Integer\n @param reg: Register index\n al = 0\n cl = 1\n dl = 2\n bl = 3\n ah = 4\n ch = 5\n dh = 6\n bh = 7\n\n @rtype: uint8_t\n @return: 8-bit value stored in the register\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_27cpu_reg8_get = {"cpu_reg8_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_27cpu_reg8_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_26cpu_reg8_get}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_27cpu_reg8_get(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 +) { enum emu_reg8 __pyx_v_reg; + #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("cpu_reg8_get (wrapper)", 0); - assert(__pyx_arg_reg); { - __pyx_v_reg = ((enum emu_reg8)__Pyx_PyInt_As_enum__emu_reg8(__pyx_arg_reg)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 753, __pyx_L3_error) + #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_reg,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_reg)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 752, __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, "cpu_reg8_get") < 0)) __PYX_ERR(0, 752, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_reg = ((enum emu_reg8)__Pyx_PyInt_As_enum__emu_reg8(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 752, __pyx_L3_error) } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cpu_reg8_get", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 752, __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("pylibemu.Emulator.cpu_reg8_get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylibemu_8Emulator_26cpu_reg8_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((enum emu_reg8)__pyx_v_reg)); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_26cpu_reg8_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_reg); /* 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; } @@ -8467,32 +11974,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg8_get(struct __pyx_obj_8p int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_reg8_get", 0); + __Pyx_RefNannySetupContext("cpu_reg8_get", 1); - /* "pylibemu.pyx":775 + /* "pylibemu.pyx":774 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":776 + /* "pylibemu.pyx":775 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 776, __pyx_L1_error) + __PYX_ERR(0, 775, __pyx_L1_error) - /* "pylibemu.pyx":775 + /* "pylibemu.pyx":774 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8501,7 +12008,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg8_get(struct __pyx_obj_8p */ } - /* "pylibemu.pyx":778 + /* "pylibemu.pyx":777 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -8510,7 +12017,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg8_get(struct __pyx_obj_8p */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":779 + /* "pylibemu.pyx":778 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_reg8_get(_cpu, reg) # <<<<<<<<<<<<<< @@ -8518,13 +12025,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg8_get(struct __pyx_obj_8p * def cpu_reg8_set(self, c_emu_reg8 reg, uint8_t val): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint8_t(((uint8_t)emu_cpu_reg8_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint8_t(((uint8_t)emu_cpu_reg8_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":753 + /* "pylibemu.pyx":752 * emu_cpu_reg16_set(_cpu, reg, val) * * def cpu_reg8_get(self, c_emu_reg8 reg): # <<<<<<<<<<<<<< @@ -8543,7 +12050,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg8_get(struct __pyx_obj_8p return __pyx_r; } -/* "pylibemu.pyx":781 +/* "pylibemu.pyx":780 * return emu_cpu_reg8_get(_cpu, reg) * * def cpu_reg8_set(self, c_emu_reg8 reg, uint8_t val): # <<<<<<<<<<<<<< @@ -8552,59 +12059,100 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg8_get(struct __pyx_obj_8p */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_29cpu_reg8_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_28cpu_reg8_set[] = "\n Method used to set a register with a 8-bit value\n\n @type reg: Integer\n @param reg: Register index\n al = 0\n cl = 1\n dl = 2\n bl = 3\n ah = 4\n ch = 5\n dh = 6\n bh = 7\n\n @type val: uint8_t\n @param val: 8-bit value\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_29cpu_reg8_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_29cpu_reg8_set(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_8pylibemu_8Emulator_28cpu_reg8_set, "\n Method used to set a register with a 8-bit value\n\n @type reg: Integer\n @param reg: Register index\n al = 0\n cl = 1\n dl = 2\n bl = 3\n ah = 4\n ch = 5\n dh = 6\n bh = 7\n\n @type val: uint8_t\n @param val: 8-bit value\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_29cpu_reg8_set = {"cpu_reg8_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_29cpu_reg8_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_28cpu_reg8_set}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_29cpu_reg8_set(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 +) { enum emu_reg8 __pyx_v_reg; uint8_t __pyx_v_val; + #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("cpu_reg8_set (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reg,&__pyx_n_s_val,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reg,&__pyx_n_s_val,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reg)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reg)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_val)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("cpu_reg8_set", 1, 2, 2, 1); __PYX_ERR(0, 781, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("cpu_reg8_set", 1, 2, 2, 1); __PYX_ERR(0, 780, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cpu_reg8_set") < 0)) __PYX_ERR(0, 781, __pyx_L3_error) + 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, "cpu_reg8_set") < 0)) __PYX_ERR(0, 780, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_reg = ((enum emu_reg8)__Pyx_PyInt_As_enum__emu_reg8(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 781, __pyx_L3_error) - __pyx_v_val = __Pyx_PyInt_As_uint8_t(values[1]); if (unlikely((__pyx_v_val == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 781, __pyx_L3_error) + __pyx_v_reg = ((enum emu_reg8)__Pyx_PyInt_As_enum__emu_reg8(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error) + __pyx_v_val = __Pyx_PyInt_As_uint8_t(values[1]); if (unlikely((__pyx_v_val == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("cpu_reg8_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 781, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("cpu_reg8_set", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 780, __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("pylibemu.Emulator.cpu_reg8_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -8612,6 +12160,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_29cpu_reg8_set(PyObject *__pyx_v_s __pyx_r = __pyx_pf_8pylibemu_8Emulator_28cpu_reg8_set(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_reg, __pyx_v_val); /* 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; } @@ -8625,32 +12179,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_reg8_set(struct __pyx_obj_8p int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_reg8_set", 0); + __Pyx_RefNannySetupContext("cpu_reg8_set", 1); - /* "pylibemu.pyx":803 + /* "pylibemu.pyx":802 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":804 + /* "pylibemu.pyx":803 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 804, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 803, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 804, __pyx_L1_error) + __PYX_ERR(0, 803, __pyx_L1_error) - /* "pylibemu.pyx":803 + /* "pylibemu.pyx":802 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8659,7 +12213,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_reg8_set(struct __pyx_obj_8p */ } - /* "pylibemu.pyx":806 + /* "pylibemu.pyx":805 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -8668,7 +12222,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_reg8_set(struct __pyx_obj_8p */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":807 + /* "pylibemu.pyx":806 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_reg8_set(_cpu, reg, val) # <<<<<<<<<<<<<< @@ -8677,7 +12231,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_reg8_set(struct __pyx_obj_8p */ emu_cpu_reg8_set(__pyx_v__cpu, __pyx_v_reg, __pyx_v_val); - /* "pylibemu.pyx":781 + /* "pylibemu.pyx":780 * return emu_cpu_reg8_get(_cpu, reg) * * def cpu_reg8_set(self, c_emu_reg8 reg, uint8_t val): # <<<<<<<<<<<<<< @@ -8698,7 +12252,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_reg8_set(struct __pyx_obj_8p return __pyx_r; } -/* "pylibemu.pyx":809 +/* "pylibemu.pyx":808 * emu_cpu_reg8_set(_cpu, reg, val) * * def cpu_eflags_get(self): # <<<<<<<<<<<<<< @@ -8707,12 +12261,40 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_reg8_set(struct __pyx_obj_8p */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_31cpu_eflags_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_30cpu_eflags_get[] = "\n Method used to get the 32-bit value stored in the register eflags\n\n @rtype: uint32_t\n @return: 32-bit value stored in the register eflags\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_31cpu_eflags_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_31cpu_eflags_get(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_8pylibemu_8Emulator_30cpu_eflags_get, "\n Method used to get the 32-bit value stored in the register eflags\n\n @rtype: uint32_t\n @return: 32-bit value stored in the register eflags\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_31cpu_eflags_get = {"cpu_eflags_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_31cpu_eflags_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_30cpu_eflags_get}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_31cpu_eflags_get(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("cpu_eflags_get (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("cpu_eflags_get", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "cpu_eflags_get", 0))) return NULL; __pyx_r = __pyx_pf_8pylibemu_8Emulator_30cpu_eflags_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -8729,32 +12311,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_30cpu_eflags_get(struct __pyx_obj_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_eflags_get", 0); + __Pyx_RefNannySetupContext("cpu_eflags_get", 1); - /* "pylibemu.pyx":820 + /* "pylibemu.pyx":819 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":821 + /* "pylibemu.pyx":820 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 820, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 821, __pyx_L1_error) + __PYX_ERR(0, 820, __pyx_L1_error) - /* "pylibemu.pyx":820 + /* "pylibemu.pyx":819 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8763,7 +12345,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_30cpu_eflags_get(struct __pyx_obj_ */ } - /* "pylibemu.pyx":823 + /* "pylibemu.pyx":822 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -8772,7 +12354,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_30cpu_eflags_get(struct __pyx_obj_ */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":824 + /* "pylibemu.pyx":823 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_eflags_get(_cpu) # <<<<<<<<<<<<<< @@ -8780,13 +12362,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_30cpu_eflags_get(struct __pyx_obj_ * def cpu_eflags_set(self, uint32_t val): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_eflags_get(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_eflags_get(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":809 + /* "pylibemu.pyx":808 * emu_cpu_reg8_set(_cpu, reg, val) * * def cpu_eflags_get(self): # <<<<<<<<<<<<<< @@ -8805,7 +12387,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_30cpu_eflags_get(struct __pyx_obj_ return __pyx_r; } -/* "pylibemu.pyx":826 +/* "pylibemu.pyx":825 * return emu_cpu_eflags_get(_cpu) * * def cpu_eflags_set(self, uint32_t val): # <<<<<<<<<<<<<< @@ -8814,28 +12396,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_30cpu_eflags_get(struct __pyx_obj_ */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_33cpu_eflags_set(PyObject *__pyx_v_self, PyObject *__pyx_arg_val); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_32cpu_eflags_set[] = "\n Method used to set the register eflags with a 32-bit value\n\n @type val: uint32_t\n @param val: 32-bit value\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_33cpu_eflags_set(PyObject *__pyx_v_self, PyObject *__pyx_arg_val) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_33cpu_eflags_set(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_8pylibemu_8Emulator_32cpu_eflags_set, "\n Method used to set the register eflags with a 32-bit value\n\n @type val: uint32_t\n @param val: 32-bit value\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_33cpu_eflags_set = {"cpu_eflags_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_33cpu_eflags_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_32cpu_eflags_set}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_33cpu_eflags_set(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 +) { uint32_t __pyx_v_val; + #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("cpu_eflags_set (wrapper)", 0); - assert(__pyx_arg_val); { - __pyx_v_val = __Pyx_PyInt_As_uint32_t(__pyx_arg_val); if (unlikely((__pyx_v_val == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 826, __pyx_L3_error) + #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_val,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_val)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 825, __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, "cpu_eflags_set") < 0)) __PYX_ERR(0, 825, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_val = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_val == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 825, __pyx_L3_error) } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cpu_eflags_set", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 825, __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("pylibemu.Emulator.cpu_eflags_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylibemu_8Emulator_32cpu_eflags_set(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((uint32_t)__pyx_v_val)); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_32cpu_eflags_set(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_val); /* 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; } @@ -8849,32 +12501,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_32cpu_eflags_set(struct __pyx_obj_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_eflags_set", 0); + __Pyx_RefNannySetupContext("cpu_eflags_set", 1); - /* "pylibemu.pyx":837 + /* "pylibemu.pyx":836 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":838 + /* "pylibemu.pyx":837 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 838, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 837, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 838, __pyx_L1_error) + __PYX_ERR(0, 837, __pyx_L1_error) - /* "pylibemu.pyx":837 + /* "pylibemu.pyx":836 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8883,7 +12535,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_32cpu_eflags_set(struct __pyx_obj_ */ } - /* "pylibemu.pyx":840 + /* "pylibemu.pyx":839 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -8892,7 +12544,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_32cpu_eflags_set(struct __pyx_obj_ */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":841 + /* "pylibemu.pyx":840 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_eflags_set(_cpu, val) # <<<<<<<<<<<<<< @@ -8901,7 +12553,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_32cpu_eflags_set(struct __pyx_obj_ */ emu_cpu_eflags_set(__pyx_v__cpu, __pyx_v_val); - /* "pylibemu.pyx":826 + /* "pylibemu.pyx":825 * return emu_cpu_eflags_get(_cpu) * * def cpu_eflags_set(self, uint32_t val): # <<<<<<<<<<<<<< @@ -8922,7 +12574,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_32cpu_eflags_set(struct __pyx_obj_ return __pyx_r; } -/* "pylibemu.pyx":843 +/* "pylibemu.pyx":842 * emu_cpu_eflags_set(_cpu, val) * * def cpu_eip_set(self, uint32_t eip): # <<<<<<<<<<<<<< @@ -8931,28 +12583,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_32cpu_eflags_set(struct __pyx_obj_ */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_35cpu_eip_set(PyObject *__pyx_v_self, PyObject *__pyx_arg_eip); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_34cpu_eip_set[] = "\n Method used to set the register eip with a 32-bit value\n\n @type val: uint32_t\n @param val: 32-bit value\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_35cpu_eip_set(PyObject *__pyx_v_self, PyObject *__pyx_arg_eip) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_35cpu_eip_set(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_8pylibemu_8Emulator_34cpu_eip_set, "\n Method used to set the register eip with a 32-bit value\n\n @type val: uint32_t\n @param val: 32-bit value\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_35cpu_eip_set = {"cpu_eip_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_35cpu_eip_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_34cpu_eip_set}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_35cpu_eip_set(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 +) { uint32_t __pyx_v_eip; + #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("cpu_eip_set (wrapper)", 0); - assert(__pyx_arg_eip); { - __pyx_v_eip = __Pyx_PyInt_As_uint32_t(__pyx_arg_eip); if (unlikely((__pyx_v_eip == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 843, __pyx_L3_error) + #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_eip,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_eip)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 842, __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, "cpu_eip_set") < 0)) __PYX_ERR(0, 842, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_eip = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_eip == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 842, __pyx_L3_error) } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cpu_eip_set", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 842, __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("pylibemu.Emulator.cpu_eip_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylibemu_8Emulator_34cpu_eip_set(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((uint32_t)__pyx_v_eip)); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_34cpu_eip_set(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_eip); /* 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; } @@ -8966,32 +12688,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_34cpu_eip_set(struct __pyx_obj_8py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_eip_set", 0); + __Pyx_RefNannySetupContext("cpu_eip_set", 1); - /* "pylibemu.pyx":854 + /* "pylibemu.pyx":853 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":855 + /* "pylibemu.pyx":854 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 855, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 854, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 855, __pyx_L1_error) + __PYX_ERR(0, 854, __pyx_L1_error) - /* "pylibemu.pyx":854 + /* "pylibemu.pyx":853 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9000,7 +12722,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_34cpu_eip_set(struct __pyx_obj_8py */ } - /* "pylibemu.pyx":857 + /* "pylibemu.pyx":856 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -9009,7 +12731,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_34cpu_eip_set(struct __pyx_obj_8py */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":858 + /* "pylibemu.pyx":857 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_eip_set(_cpu, eip) # <<<<<<<<<<<<<< @@ -9018,7 +12740,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_34cpu_eip_set(struct __pyx_obj_8py */ emu_cpu_eip_set(__pyx_v__cpu, __pyx_v_eip); - /* "pylibemu.pyx":843 + /* "pylibemu.pyx":842 * emu_cpu_eflags_set(_cpu, val) * * def cpu_eip_set(self, uint32_t eip): # <<<<<<<<<<<<<< @@ -9039,7 +12761,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_34cpu_eip_set(struct __pyx_obj_8py return __pyx_r; } -/* "pylibemu.pyx":860 +/* "pylibemu.pyx":859 * emu_cpu_eip_set(_cpu, eip) * * def cpu_eip_get(self): # <<<<<<<<<<<<<< @@ -9048,12 +12770,40 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_34cpu_eip_set(struct __pyx_obj_8py */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_37cpu_eip_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_36cpu_eip_get[] = "\n Method used to get the 32-bit value stored in the register eip\n\n @rtype: uint32_t\n @return: 32-bit value stored in the register eip\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_37cpu_eip_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_37cpu_eip_get(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_8pylibemu_8Emulator_36cpu_eip_get, "\n Method used to get the 32-bit value stored in the register eip\n\n @rtype: uint32_t\n @return: 32-bit value stored in the register eip\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_37cpu_eip_get = {"cpu_eip_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_37cpu_eip_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_36cpu_eip_get}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_37cpu_eip_get(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("cpu_eip_get (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("cpu_eip_get", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "cpu_eip_get", 0))) return NULL; __pyx_r = __pyx_pf_8pylibemu_8Emulator_36cpu_eip_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -9070,32 +12820,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_36cpu_eip_get(struct __pyx_obj_8py int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_eip_get", 0); + __Pyx_RefNannySetupContext("cpu_eip_get", 1); - /* "pylibemu.pyx":871 + /* "pylibemu.pyx":870 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":872 + /* "pylibemu.pyx":871 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 872, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 872, __pyx_L1_error) + __PYX_ERR(0, 871, __pyx_L1_error) - /* "pylibemu.pyx":871 + /* "pylibemu.pyx":870 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9104,7 +12854,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_36cpu_eip_get(struct __pyx_obj_8py */ } - /* "pylibemu.pyx":874 + /* "pylibemu.pyx":873 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -9113,7 +12863,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_36cpu_eip_get(struct __pyx_obj_8py */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":875 + /* "pylibemu.pyx":874 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_eip_get(_cpu) # <<<<<<<<<<<<<< @@ -9121,13 +12871,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_36cpu_eip_get(struct __pyx_obj_8py * def cpu_parse(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_eip_get(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_eip_get(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 874, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":860 + /* "pylibemu.pyx":859 * emu_cpu_eip_set(_cpu, eip) * * def cpu_eip_get(self): # <<<<<<<<<<<<<< @@ -9146,7 +12896,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_36cpu_eip_get(struct __pyx_obj_8py return __pyx_r; } -/* "pylibemu.pyx":877 +/* "pylibemu.pyx":876 * return emu_cpu_eip_get(_cpu) * * def cpu_parse(self): # <<<<<<<<<<<<<< @@ -9155,12 +12905,40 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_36cpu_eip_get(struct __pyx_obj_8py */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_39cpu_parse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_38cpu_parse[] = "\n Method used to parse an instruction at eip\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_39cpu_parse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_39cpu_parse(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_8pylibemu_8Emulator_38cpu_parse, "\n Method used to parse an instruction at eip\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_39cpu_parse = {"cpu_parse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_39cpu_parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_38cpu_parse}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_39cpu_parse(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("cpu_parse (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("cpu_parse", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "cpu_parse", 0))) return NULL; __pyx_r = __pyx_pf_8pylibemu_8Emulator_38cpu_parse(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -9177,32 +12955,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_38cpu_parse(struct __pyx_obj_8pyli int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_parse", 0); + __Pyx_RefNannySetupContext("cpu_parse", 1); - /* "pylibemu.pyx":885 + /* "pylibemu.pyx":884 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":886 + /* "pylibemu.pyx":885 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 886, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 886, __pyx_L1_error) + __PYX_ERR(0, 885, __pyx_L1_error) - /* "pylibemu.pyx":885 + /* "pylibemu.pyx":884 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9211,7 +12989,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_38cpu_parse(struct __pyx_obj_8pyli */ } - /* "pylibemu.pyx":888 + /* "pylibemu.pyx":887 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -9220,7 +12998,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_38cpu_parse(struct __pyx_obj_8pyli */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":889 + /* "pylibemu.pyx":888 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_parse(_cpu) # <<<<<<<<<<<<<< @@ -9228,13 +13006,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_38cpu_parse(struct __pyx_obj_8pyli * def cpu_step(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int32_t(((int32_t)emu_cpu_parse(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int32_t(((int32_t)emu_cpu_parse(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":877 + /* "pylibemu.pyx":876 * return emu_cpu_eip_get(_cpu) * * def cpu_parse(self): # <<<<<<<<<<<<<< @@ -9253,7 +13031,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_38cpu_parse(struct __pyx_obj_8pyli return __pyx_r; } -/* "pylibemu.pyx":891 +/* "pylibemu.pyx":890 * return emu_cpu_parse(_cpu) * * def cpu_step(self): # <<<<<<<<<<<<<< @@ -9262,12 +13040,40 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_38cpu_parse(struct __pyx_obj_8pyli */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_41cpu_step(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_40cpu_step[] = "\n Method used to step the last instruction\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_41cpu_step(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_41cpu_step(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_8pylibemu_8Emulator_40cpu_step, "\n Method used to step the last instruction\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_41cpu_step = {"cpu_step", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_41cpu_step, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_40cpu_step}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_41cpu_step(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("cpu_step (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("cpu_step", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "cpu_step", 0))) return NULL; __pyx_r = __pyx_pf_8pylibemu_8Emulator_40cpu_step(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -9284,32 +13090,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_40cpu_step(struct __pyx_obj_8pylib int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_step", 0); + __Pyx_RefNannySetupContext("cpu_step", 1); - /* "pylibemu.pyx":899 + /* "pylibemu.pyx":898 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":900 + /* "pylibemu.pyx":899 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 900, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 900, __pyx_L1_error) + __PYX_ERR(0, 899, __pyx_L1_error) - /* "pylibemu.pyx":899 + /* "pylibemu.pyx":898 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9318,7 +13124,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_40cpu_step(struct __pyx_obj_8pylib */ } - /* "pylibemu.pyx":902 + /* "pylibemu.pyx":901 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -9327,7 +13133,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_40cpu_step(struct __pyx_obj_8pylib */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":903 + /* "pylibemu.pyx":902 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_step(_cpu) # <<<<<<<<<<<<<< @@ -9335,13 +13141,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_40cpu_step(struct __pyx_obj_8pylib * def cpu_debugflag_set(self, uint8_t flag): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int32_t(((int32_t)emu_cpu_step(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 903, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int32_t(((int32_t)emu_cpu_step(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":891 + /* "pylibemu.pyx":890 * return emu_cpu_parse(_cpu) * * def cpu_step(self): # <<<<<<<<<<<<<< @@ -9360,7 +13166,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_40cpu_step(struct __pyx_obj_8pylib return __pyx_r; } -/* "pylibemu.pyx":905 +/* "pylibemu.pyx":904 * return emu_cpu_step(_cpu) * * def cpu_debugflag_set(self, uint8_t flag): # <<<<<<<<<<<<<< @@ -9369,28 +13175,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_40cpu_step(struct __pyx_obj_8pylib */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_43cpu_debugflag_set(PyObject *__pyx_v_self, PyObject *__pyx_arg_flag); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_42cpu_debugflag_set[] = "\n Method used to set a cpu debug flag\n\n @type flag: uint8_t\n @param flag: flag to set\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_43cpu_debugflag_set(PyObject *__pyx_v_self, PyObject *__pyx_arg_flag) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_43cpu_debugflag_set(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_8pylibemu_8Emulator_42cpu_debugflag_set, "\n Method used to set a cpu debug flag\n\n @type flag: uint8_t\n @param flag: flag to set\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_43cpu_debugflag_set = {"cpu_debugflag_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_43cpu_debugflag_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_42cpu_debugflag_set}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_43cpu_debugflag_set(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 +) { uint8_t __pyx_v_flag; + #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("cpu_debugflag_set (wrapper)", 0); - assert(__pyx_arg_flag); { - __pyx_v_flag = __Pyx_PyInt_As_uint8_t(__pyx_arg_flag); if (unlikely((__pyx_v_flag == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 905, __pyx_L3_error) + #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_flag,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_flag)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 904, __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, "cpu_debugflag_set") < 0)) __PYX_ERR(0, 904, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_flag = __Pyx_PyInt_As_uint8_t(values[0]); if (unlikely((__pyx_v_flag == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 904, __pyx_L3_error) } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cpu_debugflag_set", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 904, __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("pylibemu.Emulator.cpu_debugflag_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylibemu_8Emulator_42cpu_debugflag_set(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((uint8_t)__pyx_v_flag)); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_42cpu_debugflag_set(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_flag); /* 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; } @@ -9404,32 +13280,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_42cpu_debugflag_set(struct __pyx_o int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_debugflag_set", 0); + __Pyx_RefNannySetupContext("cpu_debugflag_set", 1); - /* "pylibemu.pyx":916 + /* "pylibemu.pyx":915 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":917 + /* "pylibemu.pyx":916 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 917, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 916, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 917, __pyx_L1_error) + __PYX_ERR(0, 916, __pyx_L1_error) - /* "pylibemu.pyx":916 + /* "pylibemu.pyx":915 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9438,7 +13314,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_42cpu_debugflag_set(struct __pyx_o */ } - /* "pylibemu.pyx":919 + /* "pylibemu.pyx":918 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -9447,7 +13323,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_42cpu_debugflag_set(struct __pyx_o */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":920 + /* "pylibemu.pyx":919 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_debugflag_set(_cpu, flag) # <<<<<<<<<<<<<< @@ -9456,7 +13332,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_42cpu_debugflag_set(struct __pyx_o */ emu_cpu_debugflag_set(__pyx_v__cpu, __pyx_v_flag); - /* "pylibemu.pyx":905 + /* "pylibemu.pyx":904 * return emu_cpu_step(_cpu) * * def cpu_debugflag_set(self, uint8_t flag): # <<<<<<<<<<<<<< @@ -9477,7 +13353,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_42cpu_debugflag_set(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":922 +/* "pylibemu.pyx":921 * emu_cpu_debugflag_set(_cpu, flag) * * def cpu_debugflag_unset(self, uint8_t flag): # <<<<<<<<<<<<<< @@ -9486,28 +13362,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_42cpu_debugflag_set(struct __pyx_o */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_45cpu_debugflag_unset(PyObject *__pyx_v_self, PyObject *__pyx_arg_flag); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_44cpu_debugflag_unset[] = "\n Method used to unset a cpu debug flag\n\n @type flag: uint8_t\n @param flag: flag to unset\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_45cpu_debugflag_unset(PyObject *__pyx_v_self, PyObject *__pyx_arg_flag) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_45cpu_debugflag_unset(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_8pylibemu_8Emulator_44cpu_debugflag_unset, "\n Method used to unset a cpu debug flag\n\n @type flag: uint8_t\n @param flag: flag to unset\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_45cpu_debugflag_unset = {"cpu_debugflag_unset", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_45cpu_debugflag_unset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_44cpu_debugflag_unset}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_45cpu_debugflag_unset(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 +) { uint8_t __pyx_v_flag; + #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("cpu_debugflag_unset (wrapper)", 0); - assert(__pyx_arg_flag); { - __pyx_v_flag = __Pyx_PyInt_As_uint8_t(__pyx_arg_flag); if (unlikely((__pyx_v_flag == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L3_error) + #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_flag,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_flag)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 921, __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, "cpu_debugflag_unset") < 0)) __PYX_ERR(0, 921, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_flag = __Pyx_PyInt_As_uint8_t(values[0]); if (unlikely((__pyx_v_flag == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 921, __pyx_L3_error) } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("cpu_debugflag_unset", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 921, __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("pylibemu.Emulator.cpu_debugflag_unset", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylibemu_8Emulator_44cpu_debugflag_unset(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((uint8_t)__pyx_v_flag)); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_44cpu_debugflag_unset(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_flag); /* 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; } @@ -9521,32 +13467,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_44cpu_debugflag_unset(struct __pyx int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_debugflag_unset", 0); + __Pyx_RefNannySetupContext("cpu_debugflag_unset", 1); - /* "pylibemu.pyx":933 + /* "pylibemu.pyx":932 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":934 + /* "pylibemu.pyx":933 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 934, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 933, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 934, __pyx_L1_error) + __PYX_ERR(0, 933, __pyx_L1_error) - /* "pylibemu.pyx":933 + /* "pylibemu.pyx":932 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9555,7 +13501,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_44cpu_debugflag_unset(struct __pyx */ } - /* "pylibemu.pyx":936 + /* "pylibemu.pyx":935 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -9564,7 +13510,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_44cpu_debugflag_unset(struct __pyx */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":937 + /* "pylibemu.pyx":936 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_debugflag_unset(_cpu, flag) # <<<<<<<<<<<<<< @@ -9573,7 +13519,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_44cpu_debugflag_unset(struct __pyx */ emu_cpu_debugflag_unset(__pyx_v__cpu, __pyx_v_flag); - /* "pylibemu.pyx":922 + /* "pylibemu.pyx":921 * emu_cpu_debugflag_set(_cpu, flag) * * def cpu_debugflag_unset(self, uint8_t flag): # <<<<<<<<<<<<<< @@ -9594,7 +13540,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_44cpu_debugflag_unset(struct __pyx return __pyx_r; } -/* "pylibemu.pyx":939 +/* "pylibemu.pyx":938 * emu_cpu_debugflag_unset(_cpu, flag) * * def cpu_get_current_instruction(self): # <<<<<<<<<<<<<< @@ -9603,12 +13549,40 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_44cpu_debugflag_unset(struct __pyx */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_47cpu_get_current_instruction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_46cpu_get_current_instruction[] = "\n Method used to disassemble the current instruction\n\n @rtype : string\n @return : disassembled current instruction\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_47cpu_get_current_instruction(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_47cpu_get_current_instruction(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_8pylibemu_8Emulator_46cpu_get_current_instruction, "\n Method used to disassemble the current instruction\n\n @rtype : string\n @return : disassembled current instruction\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_47cpu_get_current_instruction = {"cpu_get_current_instruction", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_47cpu_get_current_instruction, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_46cpu_get_current_instruction}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_47cpu_get_current_instruction(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("cpu_get_current_instruction (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("cpu_get_current_instruction", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "cpu_get_current_instruction", 0))) return NULL; __pyx_r = __pyx_pf_8pylibemu_8Emulator_46cpu_get_current_instruction(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -9624,36 +13598,37 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_46cpu_get_current_instruction(stru PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - char *__pyx_t_5; + int __pyx_t_5; + char *__pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("cpu_get_current_instruction", 0); + __Pyx_RefNannySetupContext("cpu_get_current_instruction", 1); - /* "pylibemu.pyx":948 + /* "pylibemu.pyx":947 * Raises RuntimeError if the Emulator is not initialized * ''' * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":949 + /* "pylibemu.pyx":948 * ''' * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * self.cpu_debugflag_set(1) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 949, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 949, __pyx_L1_error) + __PYX_ERR(0, 948, __pyx_L1_error) - /* "pylibemu.pyx":948 + /* "pylibemu.pyx":947 * Raises RuntimeError if the Emulator is not initialized * ''' * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9662,95 +13637,116 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_46cpu_get_current_instruction(stru */ } - /* "pylibemu.pyx":951 + /* "pylibemu.pyx":950 * raise RuntimeError('Emulator not initialized') * * self.cpu_debugflag_set(1) # <<<<<<<<<<<<<< * self.cpu_parse() * instr_string = emu_cpu_get(self._emu).instr_string */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_debugflag_set); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 951, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_debugflag_set); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 950, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __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; } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_1); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 951, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_int_1}; + __pyx_t_2 = __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_2)) __PYX_ERR(0, 950, __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; - /* "pylibemu.pyx":952 + /* "pylibemu.pyx":951 * * self.cpu_debugflag_set(1) * self.cpu_parse() # <<<<<<<<<<<<<< * instr_string = emu_cpu_get(self._emu).instr_string * self.cpu_debugflag_unset(1) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_parse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 952, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_parse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 951, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __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; } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 952, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL}; + __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 951, __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; - /* "pylibemu.pyx":953 + /* "pylibemu.pyx":952 * self.cpu_debugflag_set(1) * self.cpu_parse() * instr_string = emu_cpu_get(self._emu).instr_string # <<<<<<<<<<<<<< * self.cpu_debugflag_unset(1) * */ - __pyx_t_5 = emu_cpu_get(__pyx_v_self->_emu)->instr_string; - __pyx_v_instr_string = __pyx_t_5; + __pyx_t_6 = emu_cpu_get(__pyx_v_self->_emu)->instr_string; + __pyx_v_instr_string = __pyx_t_6; - /* "pylibemu.pyx":954 + /* "pylibemu.pyx":953 * self.cpu_parse() * instr_string = emu_cpu_get(self._emu).instr_string * self.cpu_debugflag_unset(1) # <<<<<<<<<<<<<< * * return instr_string */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_debugflag_unset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 954, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_debugflag_unset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 953, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __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; } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_1); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 954, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_int_1}; + __pyx_t_2 = __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_2)) __PYX_ERR(0, 953, __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; - /* "pylibemu.pyx":956 + /* "pylibemu.pyx":955 * self.cpu_debugflag_unset(1) * * return instr_string # <<<<<<<<<<<<<< @@ -9758,13 +13754,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_46cpu_get_current_instruction(stru * # Memory methods */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_instr_string); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 956, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_instr_string); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 955, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":939 + /* "pylibemu.pyx":938 * emu_cpu_debugflag_unset(_cpu, flag) * * def cpu_get_current_instruction(self): # <<<<<<<<<<<<<< @@ -9785,7 +13781,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_46cpu_get_current_instruction(stru return __pyx_r; } -/* "pylibemu.pyx":959 +/* "pylibemu.pyx":958 * * # Memory methods * def memory_write_byte(self, uint32_t addr, uint8_t byte): # <<<<<<<<<<<<<< @@ -9794,59 +13790,100 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_46cpu_get_current_instruction(stru */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_49memory_write_byte(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_48memory_write_byte[] = "\n Method used to write a byte at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type byte: uint8_t\n @param byte: byte to write\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_49memory_write_byte(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_49memory_write_byte(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_8pylibemu_8Emulator_48memory_write_byte, "\n Method used to write a byte at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type byte: uint8_t\n @param byte: byte to write\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_49memory_write_byte = {"memory_write_byte", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_49memory_write_byte, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_48memory_write_byte}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_49memory_write_byte(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 +) { uint32_t __pyx_v_addr; uint8_t __pyx_v_byte; + #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("memory_write_byte (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_byte,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_byte,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_addr)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_addr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_byte)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_byte)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("memory_write_byte", 1, 2, 2, 1); __PYX_ERR(0, 959, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_write_byte", 1, 2, 2, 1); __PYX_ERR(0, 958, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_byte") < 0)) __PYX_ERR(0, 959, __pyx_L3_error) + 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, "memory_write_byte") < 0)) __PYX_ERR(0, 958, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L3_error) - __pyx_v_byte = __Pyx_PyInt_As_uint8_t(values[1]); if (unlikely((__pyx_v_byte == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 959, __pyx_L3_error) + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L3_error) + __pyx_v_byte = __Pyx_PyInt_As_uint8_t(values[1]); if (unlikely((__pyx_v_byte == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 958, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_write_byte", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 959, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_write_byte", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 958, __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("pylibemu.Emulator.memory_write_byte", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -9854,6 +13891,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_49memory_write_byte(PyObject *__py __pyx_r = __pyx_pf_8pylibemu_8Emulator_48memory_write_byte(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_addr, __pyx_v_byte); /* 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; } @@ -9867,32 +13910,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_48memory_write_byte(struct __pyx_o int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memory_write_byte", 0); + __Pyx_RefNannySetupContext("memory_write_byte", 1); - /* "pylibemu.pyx":973 + /* "pylibemu.pyx":972 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":974 + /* "pylibemu.pyx":973 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 974, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 973, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 974, __pyx_L1_error) + __PYX_ERR(0, 973, __pyx_L1_error) - /* "pylibemu.pyx":973 + /* "pylibemu.pyx":972 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9901,7 +13944,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_48memory_write_byte(struct __pyx_o */ } - /* "pylibemu.pyx":976 + /* "pylibemu.pyx":975 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -9910,7 +13953,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_48memory_write_byte(struct __pyx_o */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":977 + /* "pylibemu.pyx":976 * * _mem = emu_memory_get(self._emu) * emu_memory_write_byte(_mem, addr, byte) # <<<<<<<<<<<<<< @@ -9919,7 +13962,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_48memory_write_byte(struct __pyx_o */ (void)(emu_memory_write_byte(__pyx_v__mem, __pyx_v_addr, __pyx_v_byte)); - /* "pylibemu.pyx":959 + /* "pylibemu.pyx":958 * * # Memory methods * def memory_write_byte(self, uint32_t addr, uint8_t byte): # <<<<<<<<<<<<<< @@ -9940,7 +13983,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_48memory_write_byte(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":979 +/* "pylibemu.pyx":978 * emu_memory_write_byte(_mem, addr, byte) * * def memory_write_word(self, uint32_t addr, uint16_t word): # <<<<<<<<<<<<<< @@ -9949,59 +13992,100 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_48memory_write_byte(struct __pyx_o */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_51memory_write_word(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_50memory_write_word[] = "\n Method used to write a word at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type word: uint16_t\n @param word: word to write\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_51memory_write_word(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_51memory_write_word(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_8pylibemu_8Emulator_50memory_write_word, "\n Method used to write a word at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type word: uint16_t\n @param word: word to write\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_51memory_write_word = {"memory_write_word", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_51memory_write_word, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_50memory_write_word}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_51memory_write_word(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 +) { uint32_t __pyx_v_addr; uint16_t __pyx_v_word; + #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("memory_write_word (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_word,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_word,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_addr)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_addr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 978, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_word)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_word)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 978, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("memory_write_word", 1, 2, 2, 1); __PYX_ERR(0, 979, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_write_word", 1, 2, 2, 1); __PYX_ERR(0, 978, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_word") < 0)) __PYX_ERR(0, 979, __pyx_L3_error) + 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, "memory_write_word") < 0)) __PYX_ERR(0, 978, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 979, __pyx_L3_error) - __pyx_v_word = __Pyx_PyInt_As_uint16_t(values[1]); if (unlikely((__pyx_v_word == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 979, __pyx_L3_error) + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 978, __pyx_L3_error) + __pyx_v_word = __Pyx_PyInt_As_uint16_t(values[1]); if (unlikely((__pyx_v_word == ((uint16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 978, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_write_word", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 979, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_write_word", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 978, __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("pylibemu.Emulator.memory_write_word", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -10009,6 +14093,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_51memory_write_word(PyObject *__py __pyx_r = __pyx_pf_8pylibemu_8Emulator_50memory_write_word(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_addr, __pyx_v_word); /* 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; } @@ -10022,32 +14112,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_50memory_write_word(struct __pyx_o int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memory_write_word", 0); + __Pyx_RefNannySetupContext("memory_write_word", 1); - /* "pylibemu.pyx":993 + /* "pylibemu.pyx":992 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":994 + /* "pylibemu.pyx":993 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 994, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 993, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 994, __pyx_L1_error) + __PYX_ERR(0, 993, __pyx_L1_error) - /* "pylibemu.pyx":993 + /* "pylibemu.pyx":992 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -10056,7 +14146,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_50memory_write_word(struct __pyx_o */ } - /* "pylibemu.pyx":996 + /* "pylibemu.pyx":995 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -10065,7 +14155,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_50memory_write_word(struct __pyx_o */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":997 + /* "pylibemu.pyx":996 * * _mem = emu_memory_get(self._emu) * emu_memory_write_word(_mem, addr, word) # <<<<<<<<<<<<<< @@ -10074,7 +14164,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_50memory_write_word(struct __pyx_o */ (void)(emu_memory_write_word(__pyx_v__mem, __pyx_v_addr, __pyx_v_word)); - /* "pylibemu.pyx":979 + /* "pylibemu.pyx":978 * emu_memory_write_byte(_mem, addr, byte) * * def memory_write_word(self, uint32_t addr, uint16_t word): # <<<<<<<<<<<<<< @@ -10095,7 +14185,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_50memory_write_word(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":999 +/* "pylibemu.pyx":998 * emu_memory_write_word(_mem, addr, word) * * def memory_write_dword(self, uint32_t addr, uint32_t dword): # <<<<<<<<<<<<<< @@ -10104,59 +14194,100 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_50memory_write_word(struct __pyx_o */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_53memory_write_dword(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_52memory_write_dword[] = "\n Method used to write a dword at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type dword: uint32_t\n @param dword: dword to write\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_53memory_write_dword(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_53memory_write_dword(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_8pylibemu_8Emulator_52memory_write_dword, "\n Method used to write a dword at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type dword: uint32_t\n @param dword: dword to write\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_53memory_write_dword = {"memory_write_dword", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_53memory_write_dword, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_52memory_write_dword}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_53memory_write_dword(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 +) { uint32_t __pyx_v_addr; uint32_t __pyx_v_dword; + #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("memory_write_dword (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_dword,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_dword,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_addr)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_addr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 998, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dword)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dword)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 998, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("memory_write_dword", 1, 2, 2, 1); __PYX_ERR(0, 999, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_write_dword", 1, 2, 2, 1); __PYX_ERR(0, 998, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_dword") < 0)) __PYX_ERR(0, 999, __pyx_L3_error) + 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, "memory_write_dword") < 0)) __PYX_ERR(0, 998, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 999, __pyx_L3_error) - __pyx_v_dword = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_dword == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 999, __pyx_L3_error) + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 998, __pyx_L3_error) + __pyx_v_dword = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_dword == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 998, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_write_dword", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 999, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_write_dword", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 998, __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("pylibemu.Emulator.memory_write_dword", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -10164,6 +14295,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_53memory_write_dword(PyObject *__p __pyx_r = __pyx_pf_8pylibemu_8Emulator_52memory_write_dword(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_addr, __pyx_v_dword); /* 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; } @@ -10177,32 +14314,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_52memory_write_dword(struct __pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memory_write_dword", 0); + __Pyx_RefNannySetupContext("memory_write_dword", 1); - /* "pylibemu.pyx":1013 + /* "pylibemu.pyx":1012 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1014 + /* "pylibemu.pyx":1013 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1014, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1014, __pyx_L1_error) + __PYX_ERR(0, 1013, __pyx_L1_error) - /* "pylibemu.pyx":1013 + /* "pylibemu.pyx":1012 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -10211,7 +14348,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_52memory_write_dword(struct __pyx_ */ } - /* "pylibemu.pyx":1016 + /* "pylibemu.pyx":1015 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -10220,7 +14357,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_52memory_write_dword(struct __pyx_ */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1017 + /* "pylibemu.pyx":1016 * * _mem = emu_memory_get(self._emu) * emu_memory_write_dword(_mem, addr, dword) # <<<<<<<<<<<<<< @@ -10229,7 +14366,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_52memory_write_dword(struct __pyx_ */ (void)(emu_memory_write_dword(__pyx_v__mem, __pyx_v_addr, __pyx_v_dword)); - /* "pylibemu.pyx":999 + /* "pylibemu.pyx":998 * emu_memory_write_word(_mem, addr, word) * * def memory_write_dword(self, uint32_t addr, uint32_t dword): # <<<<<<<<<<<<<< @@ -10250,7 +14387,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_52memory_write_dword(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":1019 +/* "pylibemu.pyx":1018 * emu_memory_write_dword(_mem, addr, dword) * * def memory_write_block(self, uint32_t addr, src, size_t _len): # <<<<<<<<<<<<<< @@ -10259,70 +14396,115 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_52memory_write_dword(struct __pyx_ */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_55memory_write_block(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_54memory_write_block[] = "\n Method used to write a block at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type src: bytes\n @param src: block of data to write\n\n @type _len: size_t\n @param _len: block size\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_55memory_write_block(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_55memory_write_block(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_8pylibemu_8Emulator_54memory_write_block, "\n Method used to write a block at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type src: bytes\n @param src: block of data to write\n\n @type _len: size_t\n @param _len: block size\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_55memory_write_block = {"memory_write_block", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_55memory_write_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_54memory_write_block}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_55memory_write_block(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 +) { uint32_t __pyx_v_addr; PyObject *__pyx_v_src = 0; size_t __pyx_v__len; + #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("memory_write_block (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_src,&__pyx_n_s_len,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_src,&__pyx_n_s_len,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + switch (__pyx_nargs) { + case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_addr)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_addr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1018, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_src)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_src)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1018, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, 1); __PYX_ERR(0, 1019, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, 1); __PYX_ERR(0, 1018, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_len)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_len)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1018, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, 2); __PYX_ERR(0, 1019, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, 2); __PYX_ERR(0, 1018, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_block") < 0)) __PYX_ERR(0, 1019, __pyx_L3_error) + 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, "memory_write_block") < 0)) __PYX_ERR(0, 1018, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (unlikely(__pyx_nargs != 3)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + 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_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1019, __pyx_L3_error) + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1018, __pyx_L3_error) __pyx_v_src = values[1]; - __pyx_v__len = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v__len == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1019, __pyx_L3_error) + __pyx_v__len = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v__len == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1018, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1019, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1018, __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("pylibemu.Emulator.memory_write_block", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -10330,6 +14512,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_55memory_write_block(PyObject *__p __pyx_r = __pyx_pf_8pylibemu_8Emulator_54memory_write_block(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_addr, __pyx_v_src, __pyx_v__len); /* 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; } @@ -10343,32 +14531,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_54memory_write_block(struct __pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memory_write_block", 0); + __Pyx_RefNannySetupContext("memory_write_block", 1); - /* "pylibemu.pyx":1036 + /* "pylibemu.pyx":1035 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1037 + /* "pylibemu.pyx":1036 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1037, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1036, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1037, __pyx_L1_error) + __PYX_ERR(0, 1036, __pyx_L1_error) - /* "pylibemu.pyx":1036 + /* "pylibemu.pyx":1035 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -10377,7 +14565,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_54memory_write_block(struct __pyx_ */ } - /* "pylibemu.pyx":1039 + /* "pylibemu.pyx":1038 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -10386,7 +14574,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_54memory_write_block(struct __pyx_ */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1040 + /* "pylibemu.pyx":1039 * * _mem = emu_memory_get(self._emu) * emu_memory_write_block(_mem, addr, src, _len) # <<<<<<<<<<<<<< @@ -10395,7 +14583,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_54memory_write_block(struct __pyx_ */ (void)(emu_memory_write_block(__pyx_v__mem, __pyx_v_addr, ((void *)__pyx_v_src), __pyx_v__len)); - /* "pylibemu.pyx":1019 + /* "pylibemu.pyx":1018 * emu_memory_write_dword(_mem, addr, dword) * * def memory_write_block(self, uint32_t addr, src, size_t _len): # <<<<<<<<<<<<<< @@ -10416,7 +14604,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_54memory_write_block(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":1042 +/* "pylibemu.pyx":1041 * emu_memory_write_block(_mem, addr, src, _len) * * def memory_read_byte(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -10425,28 +14613,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_54memory_write_block(struct __pyx_ */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_57memory_read_byte(PyObject *__pyx_v_self, PyObject *__pyx_arg_addr); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_56memory_read_byte[] = "\n Method used to read a byte at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @rtype: uint8_t\n @return: byte at memory location address\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_57memory_read_byte(PyObject *__pyx_v_self, PyObject *__pyx_arg_addr) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_57memory_read_byte(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_8pylibemu_8Emulator_56memory_read_byte, "\n Method used to read a byte at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @rtype: uint8_t\n @return: byte at memory location address\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_57memory_read_byte = {"memory_read_byte", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_57memory_read_byte, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_56memory_read_byte}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_57memory_read_byte(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 +) { uint32_t __pyx_v_addr; + #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("memory_read_byte (wrapper)", 0); - assert(__pyx_arg_addr); { - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(__pyx_arg_addr); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1042, __pyx_L3_error) + #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_addr,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_addr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1041, __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, "memory_read_byte") < 0)) __PYX_ERR(0, 1041, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1041, __pyx_L3_error) } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("memory_read_byte", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1041, __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("pylibemu.Emulator.memory_read_byte", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylibemu_8Emulator_56memory_read_byte(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((uint32_t)__pyx_v_addr)); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_56memory_read_byte(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_addr); /* 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; } @@ -10462,32 +14720,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_read_byte(struct __pyx_ob int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memory_read_byte", 0); + __Pyx_RefNannySetupContext("memory_read_byte", 1); - /* "pylibemu.pyx":1057 + /* "pylibemu.pyx":1056 * cdef uint8_t byte * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1058 + /* "pylibemu.pyx":1057 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1058, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1057, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1058, __pyx_L1_error) + __PYX_ERR(0, 1057, __pyx_L1_error) - /* "pylibemu.pyx":1057 + /* "pylibemu.pyx":1056 * cdef uint8_t byte * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -10496,7 +14754,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_read_byte(struct __pyx_ob */ } - /* "pylibemu.pyx":1060 + /* "pylibemu.pyx":1059 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -10505,7 +14763,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_read_byte(struct __pyx_ob */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1061 + /* "pylibemu.pyx":1060 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_byte(_mem, addr, &byte): # <<<<<<<<<<<<<< @@ -10515,29 +14773,29 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_read_byte(struct __pyx_ob __pyx_t_1 = (emu_memory_read_byte(__pyx_v__mem, __pyx_v_addr, (&__pyx_v_byte)) != 0); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1062 + /* "pylibemu.pyx":1061 * _mem = emu_memory_get(self._emu) * if emu_memory_read_byte(_mem, addr, &byte): * raise RuntimeError("Error while reading a byte at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * * return byte */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1062, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1061, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1062, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1061, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_reading_a_byte_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1062, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_reading_a_byte_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1061, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1062, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1061, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1062, __pyx_L1_error) + __PYX_ERR(0, 1061, __pyx_L1_error) - /* "pylibemu.pyx":1061 + /* "pylibemu.pyx":1060 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_byte(_mem, addr, &byte): # <<<<<<<<<<<<<< @@ -10546,7 +14804,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_read_byte(struct __pyx_ob */ } - /* "pylibemu.pyx":1064 + /* "pylibemu.pyx":1063 * raise RuntimeError("Error while reading a byte at address 0x%x" % (addr, )) * * return byte # <<<<<<<<<<<<<< @@ -10554,13 +14812,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_read_byte(struct __pyx_ob * def memory_read_word(self, uint32_t addr): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_uint8_t(__pyx_v_byte); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1064, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_uint8_t(__pyx_v_byte); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1063, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1042 + /* "pylibemu.pyx":1041 * emu_memory_write_block(_mem, addr, src, _len) * * def memory_read_byte(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -10580,7 +14838,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_read_byte(struct __pyx_ob return __pyx_r; } -/* "pylibemu.pyx":1066 +/* "pylibemu.pyx":1065 * return byte * * def memory_read_word(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -10589,28 +14847,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_read_byte(struct __pyx_ob */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_59memory_read_word(PyObject *__pyx_v_self, PyObject *__pyx_arg_addr); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_58memory_read_word[] = "\n Method used to read a word at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @rtype: uint16_t\n @return: word at memory location address\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_59memory_read_word(PyObject *__pyx_v_self, PyObject *__pyx_arg_addr) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_59memory_read_word(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_8pylibemu_8Emulator_58memory_read_word, "\n Method used to read a word at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @rtype: uint16_t\n @return: word at memory location address\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_59memory_read_word = {"memory_read_word", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_59memory_read_word, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_58memory_read_word}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_59memory_read_word(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 +) { uint32_t __pyx_v_addr; + #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("memory_read_word (wrapper)", 0); - assert(__pyx_arg_addr); { - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(__pyx_arg_addr); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1066, __pyx_L3_error) - } + #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_addr,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_addr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1065, __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, "memory_read_word") < 0)) __PYX_ERR(0, 1065, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1065, __pyx_L3_error) + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("memory_read_word", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1065, __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("pylibemu.Emulator.memory_read_word", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylibemu_8Emulator_58memory_read_word(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((uint32_t)__pyx_v_addr)); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_58memory_read_word(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_addr); /* 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; } @@ -10626,32 +14954,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_read_word(struct __pyx_ob int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memory_read_word", 0); + __Pyx_RefNannySetupContext("memory_read_word", 1); - /* "pylibemu.pyx":1081 + /* "pylibemu.pyx":1080 * cdef uint16_t word * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1082 + /* "pylibemu.pyx":1081 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1082, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1081, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1082, __pyx_L1_error) + __PYX_ERR(0, 1081, __pyx_L1_error) - /* "pylibemu.pyx":1081 + /* "pylibemu.pyx":1080 * cdef uint16_t word * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -10660,7 +14988,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_read_word(struct __pyx_ob */ } - /* "pylibemu.pyx":1084 + /* "pylibemu.pyx":1083 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -10669,7 +14997,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_read_word(struct __pyx_ob */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1085 + /* "pylibemu.pyx":1084 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_word(_mem, addr, &word): # <<<<<<<<<<<<<< @@ -10679,29 +15007,29 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_read_word(struct __pyx_ob __pyx_t_1 = (emu_memory_read_word(__pyx_v__mem, __pyx_v_addr, (&__pyx_v_word)) != 0); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1086 + /* "pylibemu.pyx":1085 * _mem = emu_memory_get(self._emu) * if emu_memory_read_word(_mem, addr, &word): * raise RuntimeError("Error while reading a word at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * * return word */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1086, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1085, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1086, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_reading_a_word_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1086, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_reading_a_word_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1085, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1086, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1086, __pyx_L1_error) + __PYX_ERR(0, 1085, __pyx_L1_error) - /* "pylibemu.pyx":1085 + /* "pylibemu.pyx":1084 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_word(_mem, addr, &word): # <<<<<<<<<<<<<< @@ -10710,7 +15038,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_read_word(struct __pyx_ob */ } - /* "pylibemu.pyx":1088 + /* "pylibemu.pyx":1087 * raise RuntimeError("Error while reading a word at address 0x%x" % (addr, )) * * return word # <<<<<<<<<<<<<< @@ -10718,13 +15046,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_read_word(struct __pyx_ob * def memory_read_dword(self, uint32_t addr): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_v_word); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1088, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_uint16_t(__pyx_v_word); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1087, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1066 + /* "pylibemu.pyx":1065 * return byte * * def memory_read_word(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -10744,7 +15072,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_read_word(struct __pyx_ob return __pyx_r; } -/* "pylibemu.pyx":1090 +/* "pylibemu.pyx":1089 * return word * * def memory_read_dword(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -10753,28 +15081,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_read_word(struct __pyx_ob */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_61memory_read_dword(PyObject *__pyx_v_self, PyObject *__pyx_arg_addr); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_60memory_read_dword[] = "\n Method used to read a dword at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @rtype: uint32_t\n @return: word at memory location address\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_61memory_read_dword(PyObject *__pyx_v_self, PyObject *__pyx_arg_addr) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_61memory_read_dword(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_8pylibemu_8Emulator_60memory_read_dword, "\n Method used to read a dword at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @rtype: uint32_t\n @return: word at memory location address\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_61memory_read_dword = {"memory_read_dword", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_61memory_read_dword, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_60memory_read_dword}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_61memory_read_dword(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 +) { uint32_t __pyx_v_addr; + #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("memory_read_dword (wrapper)", 0); - assert(__pyx_arg_addr); { - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(__pyx_arg_addr); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error) + #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_addr,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_addr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1089, __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, "memory_read_dword") < 0)) __PYX_ERR(0, 1089, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1089, __pyx_L3_error) } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("memory_read_dword", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1089, __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("pylibemu.Emulator.memory_read_dword", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylibemu_8Emulator_60memory_read_dword(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((uint32_t)__pyx_v_addr)); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_60memory_read_dword(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_addr); /* 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; } @@ -10790,32 +15188,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_read_dword(struct __pyx_o int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memory_read_dword", 0); + __Pyx_RefNannySetupContext("memory_read_dword", 1); - /* "pylibemu.pyx":1105 + /* "pylibemu.pyx":1104 * cdef uint32_t dword * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1106 + /* "pylibemu.pyx":1105 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1106, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1106, __pyx_L1_error) + __PYX_ERR(0, 1105, __pyx_L1_error) - /* "pylibemu.pyx":1105 + /* "pylibemu.pyx":1104 * cdef uint32_t dword * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -10824,7 +15222,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_read_dword(struct __pyx_o */ } - /* "pylibemu.pyx":1108 + /* "pylibemu.pyx":1107 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -10833,7 +15231,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_read_dword(struct __pyx_o */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1109 + /* "pylibemu.pyx":1108 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_dword(_mem, addr, &dword): # <<<<<<<<<<<<<< @@ -10843,29 +15241,29 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_read_dword(struct __pyx_o __pyx_t_1 = (emu_memory_read_dword(__pyx_v__mem, __pyx_v_addr, (&__pyx_v_dword)) != 0); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1110 + /* "pylibemu.pyx":1109 * _mem = emu_memory_get(self._emu) * if emu_memory_read_dword(_mem, addr, &dword): * raise RuntimeError("Error while reading a word at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * * return dword */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1110, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1110, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_reading_a_word_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1110, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_reading_a_word_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1110, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1110, __pyx_L1_error) + __PYX_ERR(0, 1109, __pyx_L1_error) - /* "pylibemu.pyx":1109 + /* "pylibemu.pyx":1108 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_dword(_mem, addr, &dword): # <<<<<<<<<<<<<< @@ -10874,7 +15272,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_read_dword(struct __pyx_o */ } - /* "pylibemu.pyx":1112 + /* "pylibemu.pyx":1111 * raise RuntimeError("Error while reading a word at address 0x%x" % (addr, )) * * return dword # <<<<<<<<<<<<<< @@ -10882,13 +15280,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_read_dword(struct __pyx_o * def memory_read_block(self, uint32_t addr, size_t _len): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_dword); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1112, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_dword); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1090 + /* "pylibemu.pyx":1089 * return word * * def memory_read_dword(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -10908,7 +15306,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_read_dword(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":1114 +/* "pylibemu.pyx":1113 * return dword * * def memory_read_block(self, uint32_t addr, size_t _len): # <<<<<<<<<<<<<< @@ -10917,59 +15315,100 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_read_dword(struct __pyx_o */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_63memory_read_block(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_62memory_read_block[] = "\n Method used to read a block at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type _len: size_t\n @param _len: block size\n\n @rtype: char *\n @return: block at memory location address\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_63memory_read_block(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_63memory_read_block(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_8pylibemu_8Emulator_62memory_read_block, "\n Method used to read a block at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type _len: size_t\n @param _len: block size\n\n @rtype: char *\n @return: block at memory location address\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_63memory_read_block = {"memory_read_block", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_63memory_read_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_62memory_read_block}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_63memory_read_block(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 +) { uint32_t __pyx_v_addr; size_t __pyx_v__len; + #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("memory_read_block (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_len,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_len,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_addr)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_addr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1113, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_len)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_len)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1113, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("memory_read_block", 1, 2, 2, 1); __PYX_ERR(0, 1114, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_read_block", 1, 2, 2, 1); __PYX_ERR(0, 1113, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_read_block") < 0)) __PYX_ERR(0, 1114, __pyx_L3_error) + 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, "memory_read_block") < 0)) __PYX_ERR(0, 1113, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1114, __pyx_L3_error) - __pyx_v__len = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v__len == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1114, __pyx_L3_error) + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1113, __pyx_L3_error) + __pyx_v__len = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v__len == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1113, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_read_block", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1114, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_read_block", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1113, __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("pylibemu.Emulator.memory_read_block", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -10977,6 +15416,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_63memory_read_block(PyObject *__py __pyx_r = __pyx_pf_8pylibemu_8Emulator_62memory_read_block(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_addr, __pyx_v__len); /* 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; } @@ -10992,32 +15437,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_block(struct __pyx_o int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memory_read_block", 0); + __Pyx_RefNannySetupContext("memory_read_block", 1); - /* "pylibemu.pyx":1132 + /* "pylibemu.pyx":1131 * cdef void *block * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1133 + /* "pylibemu.pyx":1132 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * block = malloc(_len) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1133, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1133, __pyx_L1_error) + __PYX_ERR(0, 1132, __pyx_L1_error) - /* "pylibemu.pyx":1132 + /* "pylibemu.pyx":1131 * cdef void *block * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -11026,7 +15471,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_block(struct __pyx_o */ } - /* "pylibemu.pyx":1135 + /* "pylibemu.pyx":1134 * raise RuntimeError('Emulator not initialized') * * block = malloc(_len) # <<<<<<<<<<<<<< @@ -11035,30 +15480,30 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_block(struct __pyx_o */ __pyx_v_block = malloc(__pyx_v__len); - /* "pylibemu.pyx":1136 + /* "pylibemu.pyx":1135 * * block = malloc(_len) * if block is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Error while allocating memory') * */ - __pyx_t_1 = ((__pyx_v_block == NULL) != 0); + __pyx_t_1 = (__pyx_v_block == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1137 + /* "pylibemu.pyx":1136 * block = malloc(_len) * if block is NULL: * raise RuntimeError('Error while allocating memory') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1137, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1137, __pyx_L1_error) + __PYX_ERR(0, 1136, __pyx_L1_error) - /* "pylibemu.pyx":1136 + /* "pylibemu.pyx":1135 * * block = malloc(_len) * if block is NULL: # <<<<<<<<<<<<<< @@ -11067,7 +15512,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_block(struct __pyx_o */ } - /* "pylibemu.pyx":1139 + /* "pylibemu.pyx":1138 * raise RuntimeError('Error while allocating memory') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -11076,7 +15521,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_block(struct __pyx_o */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1140 + /* "pylibemu.pyx":1139 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_block(_mem, addr, block, _len): # <<<<<<<<<<<<<< @@ -11086,29 +15531,29 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_block(struct __pyx_o __pyx_t_1 = (emu_memory_read_block(__pyx_v__mem, __pyx_v_addr, __pyx_v_block, __pyx_v__len) != 0); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1141 + /* "pylibemu.pyx":1140 * _mem = emu_memory_get(self._emu) * if emu_memory_read_block(_mem, addr, block, _len): * raise RuntimeError("Error while reading a dword at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * * return block */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1141, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1141, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_reading_a_dword_at_a, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1141, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_reading_a_dword_at_a, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1141, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1141, __pyx_L1_error) + __PYX_ERR(0, 1140, __pyx_L1_error) - /* "pylibemu.pyx":1140 + /* "pylibemu.pyx":1139 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_block(_mem, addr, block, _len): # <<<<<<<<<<<<<< @@ -11117,7 +15562,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_block(struct __pyx_o */ } - /* "pylibemu.pyx":1143 + /* "pylibemu.pyx":1142 * raise RuntimeError("Error while reading a dword at address 0x%x" % (addr, )) * * return block # <<<<<<<<<<<<<< @@ -11125,13 +15570,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_block(struct __pyx_o * def memory_read_string(self, uint32_t addr, uint32_t maxsize): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBytes_FromString(((char *)__pyx_v_block)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1143, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromString(((char *)__pyx_v_block)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1114 + /* "pylibemu.pyx":1113 * return dword * * def memory_read_block(self, uint32_t addr, size_t _len): # <<<<<<<<<<<<<< @@ -11151,7 +15596,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_block(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":1145 +/* "pylibemu.pyx":1144 * return block * * def memory_read_string(self, uint32_t addr, uint32_t maxsize): # <<<<<<<<<<<<<< @@ -11160,59 +15605,100 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_block(struct __pyx_o */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_65memory_read_string(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_64memory_read_string[] = "\n Method used to read a string at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type maxsize: uint32_t\n @param maxsize: string max size\n\n @rtype: char *\n @return: string at memory location address\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_65memory_read_string(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_65memory_read_string(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_8pylibemu_8Emulator_64memory_read_string, "\n Method used to read a string at a memory location\n\n @type addr: uint32_t\n @param addr: memory location address\n\n @type maxsize: uint32_t\n @param maxsize: string max size\n\n @rtype: char *\n @return: string at memory location address\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_65memory_read_string = {"memory_read_string", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_65memory_read_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_64memory_read_string}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_65memory_read_string(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 +) { uint32_t __pyx_v_addr; uint32_t __pyx_v_maxsize; + #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("memory_read_string (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); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_maxsize,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_maxsize,0}; + if (__pyx_kwds) { Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + switch (__pyx_nargs) { + case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_addr)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_addr)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1144, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxsize)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_maxsize)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1144, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, 1); __PYX_ERR(0, 1145, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, 1); __PYX_ERR(0, 1144, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_read_string") < 0)) __PYX_ERR(0, 1145, __pyx_L3_error) + 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, "memory_read_string") < 0)) __PYX_ERR(0, 1144, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (unlikely(__pyx_nargs != 2)) { goto __pyx_L5_argtuple_error; } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1145, __pyx_L3_error) - __pyx_v_maxsize = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_maxsize == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1145, __pyx_L3_error) + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1144, __pyx_L3_error) + __pyx_v_maxsize = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_maxsize == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1144, __pyx_L3_error) } - goto __pyx_L4_argument_unpacking_done; + goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1145, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1144, __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("pylibemu.Emulator.memory_read_string", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; @@ -11220,6 +15706,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_65memory_read_string(PyObject *__p __pyx_r = __pyx_pf_8pylibemu_8Emulator_64memory_read_string(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_addr, __pyx_v_maxsize); /* 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; } @@ -11235,32 +15727,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_string(struct __pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memory_read_string", 0); + __Pyx_RefNannySetupContext("memory_read_string", 1); - /* "pylibemu.pyx":1163 + /* "pylibemu.pyx":1162 * cdef c_emu_string s * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1164 + /* "pylibemu.pyx":1163 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1164, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1163, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1164, __pyx_L1_error) + __PYX_ERR(0, 1163, __pyx_L1_error) - /* "pylibemu.pyx":1163 + /* "pylibemu.pyx":1162 * cdef c_emu_string s * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -11269,7 +15761,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_string(struct __pyx_ */ } - /* "pylibemu.pyx":1166 + /* "pylibemu.pyx":1165 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -11278,7 +15770,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_string(struct __pyx_ */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1167 + /* "pylibemu.pyx":1166 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_string(_mem, addr, &s, maxsize): # <<<<<<<<<<<<<< @@ -11288,29 +15780,29 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_string(struct __pyx_ __pyx_t_1 = (emu_memory_read_string(__pyx_v__mem, __pyx_v_addr, (&__pyx_v_s), __pyx_v_maxsize) != 0); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1168 + /* "pylibemu.pyx":1167 * _mem = emu_memory_get(self._emu) * if emu_memory_read_string(_mem, addr, &s, maxsize): * raise RuntimeError("Error while reading a string at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * * return s.data */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1168, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1168, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Format(__pyx_t_2, __pyx_n_u_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_reading_a_string_at, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1168, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Error_while_reading_a_string_at, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1168, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1168, __pyx_L1_error) + __PYX_ERR(0, 1167, __pyx_L1_error) - /* "pylibemu.pyx":1167 + /* "pylibemu.pyx":1166 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_string(_mem, addr, &s, maxsize): # <<<<<<<<<<<<<< @@ -11319,7 +15811,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_string(struct __pyx_ */ } - /* "pylibemu.pyx":1170 + /* "pylibemu.pyx":1169 * raise RuntimeError("Error while reading a string at address 0x%x" % (addr, )) * * return s.data # <<<<<<<<<<<<<< @@ -11327,13 +15819,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_string(struct __pyx_ * def memory_segment_select(self, c_emu_segment segment): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBytes_FromString(((char *)__pyx_v_s.data)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1170, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromString(((char *)__pyx_v_s.data)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1145 + /* "pylibemu.pyx":1144 * return block * * def memory_read_string(self, uint32_t addr, uint32_t maxsize): # <<<<<<<<<<<<<< @@ -11353,7 +15845,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_string(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":1172 +/* "pylibemu.pyx":1171 * return s.data * * def memory_segment_select(self, c_emu_segment segment): # <<<<<<<<<<<<<< @@ -11362,28 +15854,98 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_string(struct __pyx_ */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_67memory_segment_select(PyObject *__pyx_v_self, PyObject *__pyx_arg_segment); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_66memory_segment_select[] = "\n Method used to select a segment\n\n @type segment: Integer\n @param segment: Segment index\n s_cs = 0\n s_ss = 1\n s_ds = 2\n s_es = 3\n s_fs = 4\n s_gs = 5\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_67memory_segment_select(PyObject *__pyx_v_self, PyObject *__pyx_arg_segment) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_67memory_segment_select(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_8pylibemu_8Emulator_66memory_segment_select, "\n Method used to select a segment\n\n @type segment: Integer\n @param segment: Segment index\n s_cs = 0\n s_ss = 1\n s_ds = 2\n s_es = 3\n s_fs = 4\n s_gs = 5\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_67memory_segment_select = {"memory_segment_select", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_67memory_segment_select, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_66memory_segment_select}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_67memory_segment_select(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 +) { enum emu_segment __pyx_v_segment; + #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("memory_segment_select (wrapper)", 0); - assert(__pyx_arg_segment); { - __pyx_v_segment = ((enum emu_segment)__Pyx_PyInt_As_enum__emu_segment(__pyx_arg_segment)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1172, __pyx_L3_error) + #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_segment,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_segment)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1171, __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, "memory_segment_select") < 0)) __PYX_ERR(0, 1171, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_segment = ((enum emu_segment)__Pyx_PyInt_As_enum__emu_segment(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1171, __pyx_L3_error) } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("memory_segment_select", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1171, __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("pylibemu.Emulator.memory_segment_select", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8pylibemu_8Emulator_66memory_segment_select(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((enum emu_segment)__pyx_v_segment)); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_66memory_segment_select(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_segment); /* 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; } @@ -11397,32 +15959,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_segment_select(struct __p int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memory_segment_select", 0); + __Pyx_RefNannySetupContext("memory_segment_select", 1); - /* "pylibemu.pyx":1189 + /* "pylibemu.pyx":1188 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1190 + /* "pylibemu.pyx":1189 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1190, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1190, __pyx_L1_error) + __PYX_ERR(0, 1189, __pyx_L1_error) - /* "pylibemu.pyx":1189 + /* "pylibemu.pyx":1188 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -11431,7 +15993,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_segment_select(struct __p */ } - /* "pylibemu.pyx":1192 + /* "pylibemu.pyx":1191 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -11440,7 +16002,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_segment_select(struct __p */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1193 + /* "pylibemu.pyx":1192 * * _mem = emu_memory_get(self._emu) * emu_memory_segment_select(_mem, segment) # <<<<<<<<<<<<<< @@ -11449,7 +16011,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_segment_select(struct __p */ emu_memory_segment_select(__pyx_v__mem, __pyx_v_segment); - /* "pylibemu.pyx":1172 + /* "pylibemu.pyx":1171 * return s.data * * def memory_segment_select(self, c_emu_segment segment): # <<<<<<<<<<<<<< @@ -11470,7 +16032,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_segment_select(struct __p return __pyx_r; } -/* "pylibemu.pyx":1195 +/* "pylibemu.pyx":1194 * emu_memory_segment_select(_mem, segment) * * def memory_segment_get(self): # <<<<<<<<<<<<<< @@ -11479,12 +16041,40 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_segment_select(struct __p */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_69memory_segment_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_68memory_segment_get[] = "\n Method used to get the current segment\n\n @rtype segment: Integer\n @rparam segment: Segment index\n s_cs = 0\n s_ss = 1\n s_ds = 2\n s_es = 3\n s_fs = 4\n s_gs = 5\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_69memory_segment_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_69memory_segment_get(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_8pylibemu_8Emulator_68memory_segment_get, "\n Method used to get the current segment\n\n @rtype segment: Integer\n @rparam segment: Segment index\n s_cs = 0\n s_ss = 1\n s_ds = 2\n s_es = 3\n s_fs = 4\n s_gs = 5\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_69memory_segment_get = {"memory_segment_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_69memory_segment_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_68memory_segment_get}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_69memory_segment_get(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("memory_segment_get (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("memory_segment_get", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "memory_segment_get", 0))) return NULL; __pyx_r = __pyx_pf_8pylibemu_8Emulator_68memory_segment_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -11501,32 +16091,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_segment_get(struct __pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("memory_segment_get", 0); + __Pyx_RefNannySetupContext("memory_segment_get", 1); - /* "pylibemu.pyx":1212 + /* "pylibemu.pyx":1211 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1213 + /* "pylibemu.pyx":1212 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1213, __pyx_L1_error) + __PYX_ERR(0, 1212, __pyx_L1_error) - /* "pylibemu.pyx":1212 + /* "pylibemu.pyx":1211 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -11535,7 +16125,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_segment_get(struct __pyx_ */ } - /* "pylibemu.pyx":1215 + /* "pylibemu.pyx":1214 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -11544,7 +16134,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_segment_get(struct __pyx_ */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1216 + /* "pylibemu.pyx":1215 * * _mem = emu_memory_get(self._emu) * return emu_memory_segment_get(_mem) # <<<<<<<<<<<<<< @@ -11552,13 +16142,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_segment_get(struct __pyx_ * # Win32 environment */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_enum__emu_segment(emu_memory_segment_get(__pyx_v__mem)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1216, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__emu_segment(emu_memory_segment_get(__pyx_v__mem)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1195 + /* "pylibemu.pyx":1194 * emu_memory_segment_select(_mem, segment) * * def memory_segment_get(self): # <<<<<<<<<<<<<< @@ -11577,7 +16167,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_segment_get(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":1219 +/* "pylibemu.pyx":1218 * * # Win32 environment * def env_w32_hook_check(self): # <<<<<<<<<<<<<< @@ -11586,12 +16176,40 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_segment_get(struct __pyx_ */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_71env_w32_hook_check(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_70env_w32_hook_check[] = "\n Method used to check if a hooked Win32 API is at the\n current eip\n\n @rtype boolean\n @rparam True if a hooked Win32 API is at the current\n eip, False otherwise\n\n Raises RuntimeError if the Emulator is not initialized\n "; -static PyObject *__pyx_pw_8pylibemu_8Emulator_71env_w32_hook_check(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_71env_w32_hook_check(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_8pylibemu_8Emulator_70env_w32_hook_check, "\n Method used to check if a hooked Win32 API is at the\n current eip\n\n @rtype boolean\n @rparam True if a hooked Win32 API is at the current\n eip, False otherwise\n\n Raises RuntimeError if the Emulator is not initialized\n "); +static PyMethodDef __pyx_mdef_8pylibemu_8Emulator_71env_w32_hook_check = {"env_w32_hook_check", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_71env_w32_hook_check, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_70env_w32_hook_check}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_71env_w32_hook_check(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("env_w32_hook_check (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("env_w32_hook_check", 1, 0, 0, __pyx_nargs); return NULL;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "env_w32_hook_check", 0))) return NULL; __pyx_r = __pyx_pf_8pylibemu_8Emulator_70env_w32_hook_check(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -11609,32 +16227,32 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70env_w32_hook_check(struct __pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("env_w32_hook_check", 0); + __Pyx_RefNannySetupContext("env_w32_hook_check", 1); - /* "pylibemu.pyx":1232 + /* "pylibemu.pyx":1231 * cdef c_emu_env *_env * * if self._emu is NULL: # <<<<<<<<<<<<<< * raise RuntimeError('Emulator not initialized') * */ - __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1233 + /* "pylibemu.pyx":1232 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _env = emu_env_new(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1233, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 1233, __pyx_L1_error) + __PYX_ERR(0, 1232, __pyx_L1_error) - /* "pylibemu.pyx":1232 + /* "pylibemu.pyx":1231 * cdef c_emu_env *_env * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -11643,7 +16261,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70env_w32_hook_check(struct __pyx_ */ } - /* "pylibemu.pyx":1235 + /* "pylibemu.pyx":1234 * raise RuntimeError('Emulator not initialized') * * _env = emu_env_new(self._emu) # <<<<<<<<<<<<<< @@ -11652,44 +16270,44 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70env_w32_hook_check(struct __pyx_ */ __pyx_v__env = emu_env_new(__pyx_v_self->_emu); - /* "pylibemu.pyx":1236 + /* "pylibemu.pyx":1235 * * _env = emu_env_new(self._emu) * if _env is NULL: # <<<<<<<<<<<<<< * print(emu_strerror(self._emu)) * raise RuntimeError('Emulator environment error') */ - __pyx_t_1 = ((__pyx_v__env == NULL) != 0); + __pyx_t_1 = (__pyx_v__env == NULL); if (unlikely(__pyx_t_1)) { - /* "pylibemu.pyx":1237 + /* "pylibemu.pyx":1236 * _env = emu_env_new(self._emu) * if _env is NULL: * print(emu_strerror(self._emu)) # <<<<<<<<<<<<<< * raise RuntimeError('Emulator environment error') * */ - __pyx_t_2 = __Pyx_PyBytes_FromString(emu_strerror(__pyx_v_self->_emu)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1237, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromString(emu_strerror(__pyx_v_self->_emu)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1237, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pylibemu.pyx":1238 + /* "pylibemu.pyx":1237 * if _env is NULL: * print(emu_strerror(self._emu)) * raise RuntimeError('Emulator environment error') # <<<<<<<<<<<<<< * * if emu_env_w32_eip_check(_env) is NULL: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1238, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 1238, __pyx_L1_error) + __PYX_ERR(0, 1237, __pyx_L1_error) - /* "pylibemu.pyx":1236 + /* "pylibemu.pyx":1235 * * _env = emu_env_new(self._emu) * if _env is NULL: # <<<<<<<<<<<<<< @@ -11698,17 +16316,17 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70env_w32_hook_check(struct __pyx_ */ } - /* "pylibemu.pyx":1240 + /* "pylibemu.pyx":1239 * raise RuntimeError('Emulator environment error') * * if emu_env_w32_eip_check(_env) is NULL: # <<<<<<<<<<<<<< * return False * */ - __pyx_t_1 = ((emu_env_w32_eip_check(__pyx_v__env) == NULL) != 0); + __pyx_t_1 = (emu_env_w32_eip_check(__pyx_v__env) == NULL); if (__pyx_t_1) { - /* "pylibemu.pyx":1241 + /* "pylibemu.pyx":1240 * * if emu_env_w32_eip_check(_env) is NULL: * return False # <<<<<<<<<<<<<< @@ -11720,7 +16338,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70env_w32_hook_check(struct __pyx_ __pyx_r = Py_False; goto __pyx_L0; - /* "pylibemu.pyx":1240 + /* "pylibemu.pyx":1239 * raise RuntimeError('Emulator environment error') * * if emu_env_w32_eip_check(_env) is NULL: # <<<<<<<<<<<<<< @@ -11729,7 +16347,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70env_w32_hook_check(struct __pyx_ */ } - /* "pylibemu.pyx":1243 + /* "pylibemu.pyx":1242 * return False * * return True # <<<<<<<<<<<<<< @@ -11739,7 +16357,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70env_w32_hook_check(struct __pyx_ __pyx_r = Py_True; goto __pyx_L0; - /* "pylibemu.pyx":1219 + /* "pylibemu.pyx":1218 * * # Win32 environment * def env_w32_hook_check(self): # <<<<<<<<<<<<<< @@ -11761,16 +16379,44 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70env_w32_hook_check(struct __pyx_ /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_73__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8pylibemu_8Emulator_73__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_73__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_8pylibemu_8Emulator_73__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_73__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_73__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_8pylibemu_8Emulator_72__reduce_cython__(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); /* function exit code */ @@ -11781,33 +16427,28 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_73__reduce_cython__(PyObject *__py static PyObject *__pyx_pf_8pylibemu_8Emulator_72__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_8pylibemu_Emulator *__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("__reduce_cython__", 0); + __Pyx_RefNannySetupContext("__reduce_cython__", 1); /* "(tree fragment)":2 * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); __PYX_ERR(1, 2, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("pylibemu.Emulator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); @@ -11817,20 +16458,103 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72__reduce_cython__(CYTHON_UNUSED /* "(tree fragment)":3 * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* Python wrapper */ -static PyObject *__pyx_pw_8pylibemu_8Emulator_75__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ -static PyObject *__pyx_pw_8pylibemu_8Emulator_75__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { +static PyObject *__pyx_pw_8pylibemu_8Emulator_75__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_8pylibemu_8Emulator_75__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_75__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8pylibemu_8Emulator_75__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 +) { + CYTHON_UNUSED 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); - __pyx_r = __pyx_pf_8pylibemu_8Emulator_74__setstate_cython__(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + #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, 3, __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, 3, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __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, 3, __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("pylibemu.Emulator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8pylibemu_8Emulator_74__setstate_cython__(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __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; } @@ -11838,33 +16562,28 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_75__setstate_cython__(PyObject *__ static PyObject *__pyx_pf_8pylibemu_8Emulator_74__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, CYTHON_UNUSED 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__", 0); + __Pyx_RefNannySetupContext("__setstate_cython__", 1); /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0); __PYX_ERR(1, 4, __pyx_L1_error) /* "(tree fragment)":3 * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("pylibemu.Emulator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_XGIVEREF(__pyx_r); @@ -11876,12 +16595,17 @@ static struct __pyx_vtabstruct_8pylibemu_EmuProfile __pyx_vtable_8pylibemu_EmuPr static PyObject *__pyx_tp_new_8pylibemu_EmuProfile(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_8pylibemu_EmuProfile *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #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_8pylibemu_EmuProfile *)o); p->__pyx_vtab = __pyx_vtabptr_8pylibemu_EmuProfile; if (unlikely(__pyx_pw_8pylibemu_10EmuProfile_1__cinit__(o, a, k) < 0)) goto bad; @@ -11893,22 +16617,46 @@ static PyObject *__pyx_tp_new_8pylibemu_EmuProfile(PyTypeObject *t, PyObject *a, static void __pyx_tp_dealloc_8pylibemu_EmuProfile(PyObject *o) { #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) { + if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_8pylibemu_EmuProfile) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif + #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 PyMethodDef __pyx_methods_8pylibemu_EmuProfile[] = { - {"__reduce_cython__", (PyCFunction)__pyx_pw_8pylibemu_10EmuProfile_3__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_8pylibemu_10EmuProfile_5__setstate_cython__, METH_O, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_10EmuProfile_3__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_10EmuProfile_5__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_8pylibemu_EmuProfile_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_8pylibemu_EmuProfile}, + {Py_tp_methods, (void *)__pyx_methods_8pylibemu_EmuProfile}, + {Py_tp_new, (void *)__pyx_tp_new_8pylibemu_EmuProfile}, + {0, 0}, +}; +static PyType_Spec __pyx_type_8pylibemu_EmuProfile_spec = { + "pylibemu.EmuProfile", + sizeof(struct __pyx_obj_8pylibemu_EmuProfile), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_8pylibemu_EmuProfile_slots, +}; +#else static PyTypeObject __pyx_type_8pylibemu_EmuProfile = { PyVarObject_HEAD_INIT(0, 0) - "pylibemu.EmuProfile", /*tp_name*/ + "pylibemu.""EmuProfile", /*tp_name*/ sizeof(struct __pyx_obj_8pylibemu_EmuProfile), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8pylibemu_EmuProfile, /*tp_dealloc*/ @@ -11951,7 +16699,9 @@ static PyTypeObject __pyx_type_8pylibemu_EmuProfile = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8pylibemu_EmuProfile, /*tp_new*/ @@ -11965,29 +16715,42 @@ static PyTypeObject __pyx_type_8pylibemu_EmuProfile = { 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 PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static struct __pyx_vtabstruct_8pylibemu_Emulator __pyx_vtable_8pylibemu_Emulator; static PyObject *__pyx_tp_new_8pylibemu_Emulator(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_8pylibemu_Emulator *p; PyObject *o; - if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + #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_8pylibemu_Emulator *)o); p->__pyx_vtab = __pyx_vtabptr_8pylibemu_Emulator; p->emu_profile = ((struct __pyx_obj_8pylibemu_EmuProfile *)Py_None); Py_INCREF(Py_None); @@ -12001,8 +16764,10 @@ static PyObject *__pyx_tp_new_8pylibemu_Emulator(PyTypeObject *t, PyObject *a, P static void __pyx_tp_dealloc_8pylibemu_Emulator(PyObject *o) { struct __pyx_obj_8pylibemu_Emulator *p = (struct __pyx_obj_8pylibemu_Emulator *)o; #if CYTHON_USE_TP_FINALIZE - if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { - if (PyObject_CallFinalizerFromDealloc(o)) return; + 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_8pylibemu_Emulator) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } } #endif PyObject_GC_UnTrack(o); @@ -12015,9 +16780,16 @@ static void __pyx_tp_dealloc_8pylibemu_Emulator(PyObject *o) { PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->emu_profile); + #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_8pylibemu_Emulator(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_8pylibemu_Emulator *p = (struct __pyx_obj_8pylibemu_Emulator *)o; @@ -12049,42 +16821,40 @@ static PyObject *__pyx_getprop_8pylibemu_8Emulator_emu_profile_truncated(PyObjec } static PyMethodDef __pyx_methods_8pylibemu_Emulator[] = { - {"free", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_5free, METH_NOARGS, 0}, - {"new", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_7new, METH_NOARGS, 0}, - {"set_output_size", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_9set_output_size, METH_O, 0}, - {"shellcode_getpc_test", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test, METH_O, __pyx_doc_8pylibemu_8Emulator_10shellcode_getpc_test}, - {"prepare", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_13prepare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_12prepare}, - {"test", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_15test, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_14test}, - {"run", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_17run, METH_VARARGS|METH_KEYWORDS, 0}, - {"cpu_reg32_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_19cpu_reg32_get, METH_O, __pyx_doc_8pylibemu_8Emulator_18cpu_reg32_get}, - {"cpu_reg32_set", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_21cpu_reg32_set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_20cpu_reg32_set}, - {"cpu_reg16_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_23cpu_reg16_get, METH_O, __pyx_doc_8pylibemu_8Emulator_22cpu_reg16_get}, - {"cpu_reg16_set", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_25cpu_reg16_set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_24cpu_reg16_set}, - {"cpu_reg8_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_27cpu_reg8_get, METH_O, __pyx_doc_8pylibemu_8Emulator_26cpu_reg8_get}, - {"cpu_reg8_set", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_29cpu_reg8_set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_28cpu_reg8_set}, - {"cpu_eflags_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_31cpu_eflags_get, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_30cpu_eflags_get}, - {"cpu_eflags_set", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_33cpu_eflags_set, METH_O, __pyx_doc_8pylibemu_8Emulator_32cpu_eflags_set}, - {"cpu_eip_set", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_35cpu_eip_set, METH_O, __pyx_doc_8pylibemu_8Emulator_34cpu_eip_set}, - {"cpu_eip_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_37cpu_eip_get, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_36cpu_eip_get}, - {"cpu_parse", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_39cpu_parse, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_38cpu_parse}, - {"cpu_step", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_41cpu_step, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_40cpu_step}, - {"cpu_debugflag_set", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_43cpu_debugflag_set, METH_O, __pyx_doc_8pylibemu_8Emulator_42cpu_debugflag_set}, - {"cpu_debugflag_unset", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_45cpu_debugflag_unset, METH_O, __pyx_doc_8pylibemu_8Emulator_44cpu_debugflag_unset}, - {"cpu_get_current_instruction", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_47cpu_get_current_instruction, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_46cpu_get_current_instruction}, - {"memory_write_byte", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_49memory_write_byte, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_48memory_write_byte}, - {"memory_write_word", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_51memory_write_word, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_50memory_write_word}, - {"memory_write_dword", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_53memory_write_dword, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_52memory_write_dword}, - {"memory_write_block", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_55memory_write_block, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_54memory_write_block}, - {"memory_read_byte", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_57memory_read_byte, METH_O, __pyx_doc_8pylibemu_8Emulator_56memory_read_byte}, - {"memory_read_word", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_59memory_read_word, METH_O, __pyx_doc_8pylibemu_8Emulator_58memory_read_word}, - {"memory_read_dword", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_61memory_read_dword, METH_O, __pyx_doc_8pylibemu_8Emulator_60memory_read_dword}, - {"memory_read_block", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_63memory_read_block, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_62memory_read_block}, - {"memory_read_string", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8pylibemu_8Emulator_65memory_read_string, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_64memory_read_string}, - {"memory_segment_select", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_67memory_segment_select, METH_O, __pyx_doc_8pylibemu_8Emulator_66memory_segment_select}, - {"memory_segment_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_69memory_segment_get, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_68memory_segment_get}, - {"env_w32_hook_check", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_71env_w32_hook_check, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_70env_w32_hook_check}, - {"__reduce_cython__", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_73__reduce_cython__, METH_NOARGS, 0}, - {"__setstate_cython__", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_75__setstate_cython__, METH_O, 0}, + {"free", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_5free, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"new", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_7new, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"set_output_size", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_9set_output_size, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"shellcode_getpc_test", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_10shellcode_getpc_test}, + {"prepare", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_13prepare, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_12prepare}, + {"cpu_reg32_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_19cpu_reg32_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_18cpu_reg32_get}, + {"cpu_reg32_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_21cpu_reg32_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_20cpu_reg32_set}, + {"cpu_reg16_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_23cpu_reg16_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_22cpu_reg16_get}, + {"cpu_reg16_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_25cpu_reg16_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_24cpu_reg16_set}, + {"cpu_reg8_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_27cpu_reg8_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_26cpu_reg8_get}, + {"cpu_reg8_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_29cpu_reg8_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_28cpu_reg8_set}, + {"cpu_eflags_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_31cpu_eflags_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_30cpu_eflags_get}, + {"cpu_eflags_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_33cpu_eflags_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_32cpu_eflags_set}, + {"cpu_eip_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_35cpu_eip_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_34cpu_eip_set}, + {"cpu_eip_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_37cpu_eip_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_36cpu_eip_get}, + {"cpu_parse", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_39cpu_parse, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_38cpu_parse}, + {"cpu_step", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_41cpu_step, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_40cpu_step}, + {"cpu_debugflag_set", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_43cpu_debugflag_set, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_42cpu_debugflag_set}, + {"cpu_debugflag_unset", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_45cpu_debugflag_unset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_44cpu_debugflag_unset}, + {"cpu_get_current_instruction", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_47cpu_get_current_instruction, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_46cpu_get_current_instruction}, + {"memory_write_byte", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_49memory_write_byte, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_48memory_write_byte}, + {"memory_write_word", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_51memory_write_word, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_50memory_write_word}, + {"memory_write_dword", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_53memory_write_dword, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_52memory_write_dword}, + {"memory_write_block", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_55memory_write_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_54memory_write_block}, + {"memory_read_byte", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_57memory_read_byte, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_56memory_read_byte}, + {"memory_read_word", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_59memory_read_word, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_58memory_read_word}, + {"memory_read_dword", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_61memory_read_dword, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_60memory_read_dword}, + {"memory_read_block", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_63memory_read_block, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_62memory_read_block}, + {"memory_read_string", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_65memory_read_string, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_64memory_read_string}, + {"memory_segment_select", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_67memory_segment_select, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_66memory_segment_select}, + {"memory_segment_get", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_69memory_segment_get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_68memory_segment_get}, + {"env_w32_hook_check", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_71env_w32_hook_check, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_70env_w32_hook_check}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_73__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_8pylibemu_8Emulator_75__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, {0, 0, 0, 0} }; @@ -12094,10 +16864,28 @@ static struct PyGetSetDef __pyx_getsets_8pylibemu_Emulator[] = { {(char *)"emu_profile_truncated", __pyx_getprop_8pylibemu_8Emulator_emu_profile_truncated, 0, (char *)0, 0}, {0, 0, 0, 0, 0} }; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_8pylibemu_Emulator_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_8pylibemu_Emulator}, + {Py_tp_traverse, (void *)__pyx_tp_traverse_8pylibemu_Emulator}, + {Py_tp_clear, (void *)__pyx_tp_clear_8pylibemu_Emulator}, + {Py_tp_methods, (void *)__pyx_methods_8pylibemu_Emulator}, + {Py_tp_getset, (void *)__pyx_getsets_8pylibemu_Emulator}, + {Py_tp_new, (void *)__pyx_tp_new_8pylibemu_Emulator}, + {0, 0}, +}; +static PyType_Spec __pyx_type_8pylibemu_Emulator_spec = { + "pylibemu.Emulator", + sizeof(struct __pyx_obj_8pylibemu_Emulator), + 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_8pylibemu_Emulator_slots, +}; +#else static PyTypeObject __pyx_type_8pylibemu_Emulator = { PyVarObject_HEAD_INIT(0, 0) - "pylibemu.Emulator", /*tp_name*/ + "pylibemu.""Emulator", /*tp_name*/ sizeof(struct __pyx_obj_8pylibemu_Emulator), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8pylibemu_Emulator, /*tp_dealloc*/ @@ -12140,7 +16928,9 @@ static PyTypeObject __pyx_type_8pylibemu_Emulator = { 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ + #if !CYTHON_USE_TYPE_SPECS 0, /*tp_dictoffset*/ + #endif 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8pylibemu_Emulator, /*tp_new*/ @@ -12154,54 +16944,30 @@ static PyTypeObject __pyx_type_8pylibemu_Emulator = { 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 PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + #if __PYX_NEED_TP_PRINT_SLOT == 1 0, /*tp_print*/ #endif - #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 + #if PY_VERSION_HEX >= 0x030C0000 + 0, /*tp_watched*/ + #endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 0, /*tp_pypy_flags*/ #endif }; +#endif static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_pylibemu(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_pylibemu}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "pylibemu", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif #ifndef CYTHON_SMALL_CODE #if defined(__clang__) #define CYTHON_SMALL_CODE @@ -12211,2529 +16977,5901 @@ static struct PyModuleDef __pyx_moduledef = { #define CYTHON_SMALL_CODE #endif #endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, - {&__pyx_kp_u_0_8, __pyx_k_0_8, sizeof(__pyx_k_0_8), 0, 1, 0, 0}, - {&__pyx_kp_u_Downloading, __pyx_k_Downloading, sizeof(__pyx_k_Downloading), 0, 1, 0, 0}, - {&__pyx_n_s_EMU_REGS, __pyx_k_EMU_REGS, sizeof(__pyx_k_EMU_REGS), 0, 0, 1, 1}, - {&__pyx_n_s_EmuProfile, __pyx_k_EmuProfile, sizeof(__pyx_k_EmuProfile), 0, 0, 1, 1}, - {&__pyx_n_s_Emulator, __pyx_k_Emulator, sizeof(__pyx_k_Emulator), 0, 0, 1, 1}, - {&__pyx_kp_u_Emulator_environment_error, __pyx_k_Emulator_environment_error, sizeof(__pyx_k_Emulator_environment_error), 0, 1, 0, 0}, - {&__pyx_kp_u_Emulator_not_initialized, __pyx_k_Emulator_not_initialized, sizeof(__pyx_k_Emulator_not_initialized), 0, 1, 0, 0}, - {&__pyx_n_u_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 1, 0, 1}, - {&__pyx_kp_u_Error_while_allocating_memory, __pyx_k_Error_while_allocating_memory, sizeof(__pyx_k_Error_while_allocating_memory), 0, 1, 0, 0}, - {&__pyx_kp_u_Error_while_downloading_from, __pyx_k_Error_while_downloading_from, sizeof(__pyx_k_Error_while_downloading_from), 0, 1, 0, 0}, - {&__pyx_kp_u_Error_while_reading_a_byte_at_ad, __pyx_k_Error_while_reading_a_byte_at_ad, sizeof(__pyx_k_Error_while_reading_a_byte_at_ad), 0, 1, 0, 0}, - {&__pyx_kp_u_Error_while_reading_a_dword_at_a, __pyx_k_Error_while_reading_a_dword_at_a, sizeof(__pyx_k_Error_while_reading_a_dword_at_a), 0, 1, 0, 0}, - {&__pyx_kp_u_Error_while_reading_a_string_at, __pyx_k_Error_while_reading_a_string_at, sizeof(__pyx_k_Error_while_reading_a_string_at), 0, 1, 0, 0}, - {&__pyx_kp_u_Error_while_reading_a_word_at_ad, __pyx_k_Error_while_reading_a_word_at_ad, sizeof(__pyx_k_Error_while_reading_a_word_at_ad), 0, 1, 0, 0}, - {&__pyx_n_u_ExitProcess, __pyx_k_ExitProcess, sizeof(__pyx_k_ExitProcess), 0, 1, 0, 1}, - {&__pyx_n_u_ExitThread, __pyx_k_ExitThread, sizeof(__pyx_k_ExitThread), 0, 1, 0, 1}, - {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, - {&__pyx_kp_u_Memory_allocation_error, __pyx_k_Memory_allocation_error, sizeof(__pyx_k_Memory_allocation_error), 0, 1, 0, 0}, - {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_kp_u_Unhooked_call_to, __pyx_k_Unhooked_call_to, sizeof(__pyx_k_Unhooked_call_to), 0, 1, 0, 0}, - {&__pyx_kp_u_Y_m_d_H_M_S, __pyx_k_Y_m_d_H_M_S, sizeof(__pyx_k_Y_m_d_H_M_S), 0, 1, 0, 0}, - {&__pyx_n_s__12, __pyx_k__12, sizeof(__pyx_k__12), 0, 0, 1, 1}, - {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, - {&__pyx_kp_u__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 1, 0, 0}, - {&__pyx_n_s_addr, __pyx_k_addr, sizeof(__pyx_k_addr), 0, 0, 1, 1}, - {&__pyx_kp_u_asctime_s_message_s, __pyx_k_asctime_s_message_s, sizeof(__pyx_k_asctime_s_message_s), 0, 1, 0, 0}, - {&__pyx_n_s_basicConfig, __pyx_k_basicConfig, sizeof(__pyx_k_basicConfig), 0, 0, 1, 1}, - {&__pyx_n_s_byte, __pyx_k_byte, sizeof(__pyx_k_byte), 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_s_cpu_debugflag_set, __pyx_k_cpu_debugflag_set, sizeof(__pyx_k_cpu_debugflag_set), 0, 0, 1, 1}, - {&__pyx_n_s_cpu_debugflag_unset, __pyx_k_cpu_debugflag_unset, sizeof(__pyx_k_cpu_debugflag_unset), 0, 0, 1, 1}, - {&__pyx_n_s_cpu_parse, __pyx_k_cpu_parse, sizeof(__pyx_k_cpu_parse), 0, 0, 1, 1}, - {&__pyx_n_s_datefmt, __pyx_k_datefmt, sizeof(__pyx_k_datefmt), 0, 0, 1, 1}, - {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, - {&__pyx_n_s_dword, __pyx_k_dword, sizeof(__pyx_k_dword), 0, 0, 1, 1}, - {&__pyx_n_s_eax, __pyx_k_eax, sizeof(__pyx_k_eax), 0, 0, 1, 1}, - {&__pyx_n_s_ebp, __pyx_k_ebp, sizeof(__pyx_k_ebp), 0, 0, 1, 1}, - {&__pyx_n_s_ebx, __pyx_k_ebx, sizeof(__pyx_k_ebx), 0, 0, 1, 1}, - {&__pyx_n_s_ecx, __pyx_k_ecx, sizeof(__pyx_k_ecx), 0, 0, 1, 1}, - {&__pyx_n_s_edi, __pyx_k_edi, sizeof(__pyx_k_edi), 0, 0, 1, 1}, - {&__pyx_n_s_edx, __pyx_k_edx, sizeof(__pyx_k_edx), 0, 0, 1, 1}, - {&__pyx_n_s_enable_hooks, __pyx_k_enable_hooks, sizeof(__pyx_k_enable_hooks), 0, 0, 1, 1}, - {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, - {&__pyx_n_s_esi, __pyx_k_esi, sizeof(__pyx_k_esi), 0, 0, 1, 1}, - {&__pyx_n_s_esp, __pyx_k_esp, sizeof(__pyx_k_esp), 0, 0, 1, 1}, - {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, - {&__pyx_n_s_exit_2, __pyx_k_exit_2, sizeof(__pyx_k_exit_2), 0, 0, 1, 1}, - {&__pyx_n_u_exit_3, __pyx_k_exit_3, sizeof(__pyx_k_exit_3), 0, 1, 0, 1}, - {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, - {&__pyx_n_s_free, __pyx_k_free, sizeof(__pyx_k_free), 0, 0, 1, 1}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_n_s_hashlib, __pyx_k_hashlib, sizeof(__pyx_k_hashlib), 0, 0, 1, 1}, - {&__pyx_n_s_hexdigest, __pyx_k_hexdigest, sizeof(__pyx_k_hexdigest), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_len, __pyx_k_len, sizeof(__pyx_k_len), 0, 0, 1, 1}, - {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_maxsize, __pyx_k_maxsize, sizeof(__pyx_k_maxsize), 0, 0, 1, 1}, - {&__pyx_n_s_md5, __pyx_k_md5, sizeof(__pyx_k_md5), 0, 0, 1, 1}, - {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, - {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 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_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1}, - {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, - {&__pyx_n_s_output_size, __pyx_k_output_size, sizeof(__pyx_k_output_size), 0, 0, 1, 1}, - {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_prepare_2, __pyx_k_prepare_2, sizeof(__pyx_k_prepare_2), 0, 0, 1, 1}, - {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, - {&__pyx_n_s_pylibemu, __pyx_k_pylibemu, sizeof(__pyx_k_pylibemu), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, - {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 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_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__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_reg, __pyx_k_reg, sizeof(__pyx_k_reg), 0, 0, 1, 1}, - {&__pyx_n_s_run, __pyx_k_run, sizeof(__pyx_k_run), 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_shellcode, __pyx_k_shellcode, sizeof(__pyx_k_shellcode), 0, 0, 1, 1}, - {&__pyx_n_s_shellcode_getpc_test, __pyx_k_shellcode_getpc_test, sizeof(__pyx_k_shellcode_getpc_test), 0, 0, 1, 1}, - {&__pyx_n_s_src, __pyx_k_src, sizeof(__pyx_k_src), 0, 0, 1, 1}, - {&__pyx_n_s_steps, __pyx_k_steps, sizeof(__pyx_k_steps), 0, 0, 1, 1}, - {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_test_2, __pyx_k_test_2, sizeof(__pyx_k_test_2), 0, 0, 1, 1}, - {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1}, - {&__pyx_n_s_urllib2, __pyx_k_urllib2, sizeof(__pyx_k_urllib2), 0, 0, 1, 1}, - {&__pyx_n_s_urllib_request, __pyx_k_urllib_request, sizeof(__pyx_k_urllib_request), 0, 0, 1, 1}, - {&__pyx_n_s_urlopen, __pyx_k_urlopen, sizeof(__pyx_k_urlopen), 0, 0, 1, 1}, - {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1}, - {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, - {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1}, - {&__pyx_n_u_wb, __pyx_k_wb, sizeof(__pyx_k_wb), 0, 1, 0, 1}, - {&__pyx_n_s_word, __pyx_k_word, sizeof(__pyx_k_word), 0, 0, 1, 1}, - {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1}, - {&__pyx_n_u_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 1, 0, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_kp_u_0_8, __pyx_k_0_8, sizeof(__pyx_k_0_8), 0, 1, 0, 0}, + {&__pyx_kp_u_Downloading, __pyx_k_Downloading, sizeof(__pyx_k_Downloading), 0, 1, 0, 0}, + {&__pyx_n_s_EMU_REGS, __pyx_k_EMU_REGS, sizeof(__pyx_k_EMU_REGS), 0, 0, 1, 1}, + {&__pyx_n_s_EmuProfile, __pyx_k_EmuProfile, sizeof(__pyx_k_EmuProfile), 0, 0, 1, 1}, + {&__pyx_n_s_EmuProfile___reduce_cython, __pyx_k_EmuProfile___reduce_cython, sizeof(__pyx_k_EmuProfile___reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_EmuProfile___setstate_cython, __pyx_k_EmuProfile___setstate_cython, sizeof(__pyx_k_EmuProfile___setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator, __pyx_k_Emulator, sizeof(__pyx_k_Emulator), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator___reduce_cython, __pyx_k_Emulator___reduce_cython, sizeof(__pyx_k_Emulator___reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator___setstate_cython, __pyx_k_Emulator___setstate_cython, sizeof(__pyx_k_Emulator___setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_debugflag_set, __pyx_k_Emulator_cpu_debugflag_set, sizeof(__pyx_k_Emulator_cpu_debugflag_set), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_debugflag_unset, __pyx_k_Emulator_cpu_debugflag_unset, sizeof(__pyx_k_Emulator_cpu_debugflag_unset), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_eflags_get, __pyx_k_Emulator_cpu_eflags_get, sizeof(__pyx_k_Emulator_cpu_eflags_get), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_eflags_set, __pyx_k_Emulator_cpu_eflags_set, sizeof(__pyx_k_Emulator_cpu_eflags_set), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_eip_get, __pyx_k_Emulator_cpu_eip_get, sizeof(__pyx_k_Emulator_cpu_eip_get), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_eip_set, __pyx_k_Emulator_cpu_eip_set, sizeof(__pyx_k_Emulator_cpu_eip_set), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_get_current_instruc, __pyx_k_Emulator_cpu_get_current_instruc, sizeof(__pyx_k_Emulator_cpu_get_current_instruc), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_parse, __pyx_k_Emulator_cpu_parse, sizeof(__pyx_k_Emulator_cpu_parse), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_reg16_get, __pyx_k_Emulator_cpu_reg16_get, sizeof(__pyx_k_Emulator_cpu_reg16_get), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_reg16_set, __pyx_k_Emulator_cpu_reg16_set, sizeof(__pyx_k_Emulator_cpu_reg16_set), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_reg32_get, __pyx_k_Emulator_cpu_reg32_get, sizeof(__pyx_k_Emulator_cpu_reg32_get), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_reg32_set, __pyx_k_Emulator_cpu_reg32_set, sizeof(__pyx_k_Emulator_cpu_reg32_set), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_reg8_get, __pyx_k_Emulator_cpu_reg8_get, sizeof(__pyx_k_Emulator_cpu_reg8_get), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_reg8_set, __pyx_k_Emulator_cpu_reg8_set, sizeof(__pyx_k_Emulator_cpu_reg8_set), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_cpu_step, __pyx_k_Emulator_cpu_step, sizeof(__pyx_k_Emulator_cpu_step), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_env_w32_hook_check, __pyx_k_Emulator_env_w32_hook_check, sizeof(__pyx_k_Emulator_env_w32_hook_check), 0, 0, 1, 1}, + {&__pyx_kp_u_Emulator_environment_error, __pyx_k_Emulator_environment_error, sizeof(__pyx_k_Emulator_environment_error), 0, 1, 0, 0}, + {&__pyx_n_s_Emulator_free, __pyx_k_Emulator_free, sizeof(__pyx_k_Emulator_free), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_memory_read_block, __pyx_k_Emulator_memory_read_block, sizeof(__pyx_k_Emulator_memory_read_block), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_memory_read_byte, __pyx_k_Emulator_memory_read_byte, sizeof(__pyx_k_Emulator_memory_read_byte), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_memory_read_dword, __pyx_k_Emulator_memory_read_dword, sizeof(__pyx_k_Emulator_memory_read_dword), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_memory_read_string, __pyx_k_Emulator_memory_read_string, sizeof(__pyx_k_Emulator_memory_read_string), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_memory_read_word, __pyx_k_Emulator_memory_read_word, sizeof(__pyx_k_Emulator_memory_read_word), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_memory_segment_get, __pyx_k_Emulator_memory_segment_get, sizeof(__pyx_k_Emulator_memory_segment_get), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_memory_segment_select, __pyx_k_Emulator_memory_segment_select, sizeof(__pyx_k_Emulator_memory_segment_select), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_memory_write_block, __pyx_k_Emulator_memory_write_block, sizeof(__pyx_k_Emulator_memory_write_block), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_memory_write_byte, __pyx_k_Emulator_memory_write_byte, sizeof(__pyx_k_Emulator_memory_write_byte), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_memory_write_dword, __pyx_k_Emulator_memory_write_dword, sizeof(__pyx_k_Emulator_memory_write_dword), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_memory_write_word, __pyx_k_Emulator_memory_write_word, sizeof(__pyx_k_Emulator_memory_write_word), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_new, __pyx_k_Emulator_new, sizeof(__pyx_k_Emulator_new), 0, 0, 1, 1}, + {&__pyx_kp_u_Emulator_not_initialized, __pyx_k_Emulator_not_initialized, sizeof(__pyx_k_Emulator_not_initialized), 0, 1, 0, 0}, + {&__pyx_n_s_Emulator_prepare, __pyx_k_Emulator_prepare, sizeof(__pyx_k_Emulator_prepare), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_run, __pyx_k_Emulator_run, sizeof(__pyx_k_Emulator_run), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_set_output_size, __pyx_k_Emulator_set_output_size, sizeof(__pyx_k_Emulator_set_output_size), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_shellcode_getpc_test, __pyx_k_Emulator_shellcode_getpc_test, sizeof(__pyx_k_Emulator_shellcode_getpc_test), 0, 0, 1, 1}, + {&__pyx_n_s_Emulator_test, __pyx_k_Emulator_test, sizeof(__pyx_k_Emulator_test), 0, 0, 1, 1}, + {&__pyx_n_u_Error, __pyx_k_Error, sizeof(__pyx_k_Error), 0, 1, 0, 1}, + {&__pyx_kp_u_Error_while_allocating_memory, __pyx_k_Error_while_allocating_memory, sizeof(__pyx_k_Error_while_allocating_memory), 0, 1, 0, 0}, + {&__pyx_kp_u_Error_while_downloading_from, __pyx_k_Error_while_downloading_from, sizeof(__pyx_k_Error_while_downloading_from), 0, 1, 0, 0}, + {&__pyx_kp_u_Error_while_reading_a_byte_at_ad, __pyx_k_Error_while_reading_a_byte_at_ad, sizeof(__pyx_k_Error_while_reading_a_byte_at_ad), 0, 1, 0, 0}, + {&__pyx_kp_u_Error_while_reading_a_dword_at_a, __pyx_k_Error_while_reading_a_dword_at_a, sizeof(__pyx_k_Error_while_reading_a_dword_at_a), 0, 1, 0, 0}, + {&__pyx_kp_u_Error_while_reading_a_string_at, __pyx_k_Error_while_reading_a_string_at, sizeof(__pyx_k_Error_while_reading_a_string_at), 0, 1, 0, 0}, + {&__pyx_kp_u_Error_while_reading_a_word_at_ad, __pyx_k_Error_while_reading_a_word_at_ad, sizeof(__pyx_k_Error_while_reading_a_word_at_ad), 0, 1, 0, 0}, + {&__pyx_n_u_ExitProcess, __pyx_k_ExitProcess, sizeof(__pyx_k_ExitProcess), 0, 1, 0, 1}, + {&__pyx_n_u_ExitThread, __pyx_k_ExitThread, sizeof(__pyx_k_ExitThread), 0, 1, 0, 1}, + {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1}, + {&__pyx_kp_u_Memory_allocation_error, __pyx_k_Memory_allocation_error, sizeof(__pyx_k_Memory_allocation_error), 0, 1, 0, 0}, + {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_kp_u_Unhooked_call_to, __pyx_k_Unhooked_call_to, sizeof(__pyx_k_Unhooked_call_to), 0, 1, 0, 0}, + {&__pyx_kp_u_Y_m_d_H_M_S, __pyx_k_Y_m_d_H_M_S, sizeof(__pyx_k_Y_m_d_H_M_S), 0, 1, 0, 0}, + {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, + {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0}, + {&__pyx_n_s__75, __pyx_k__75, sizeof(__pyx_k__75), 0, 0, 1, 1}, + {&__pyx_n_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 1}, + {&__pyx_n_s_addr, __pyx_k_addr, sizeof(__pyx_k_addr), 0, 0, 1, 1}, + {&__pyx_kp_u_asctime_s_message_s, __pyx_k_asctime_s_message_s, sizeof(__pyx_k_asctime_s_message_s), 0, 1, 0, 0}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_basicConfig, __pyx_k_basicConfig, sizeof(__pyx_k_basicConfig), 0, 0, 1, 1}, + {&__pyx_n_s_block, __pyx_k_block, sizeof(__pyx_k_block), 0, 0, 1, 1}, + {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_byte, __pyx_k_byte, sizeof(__pyx_k_byte), 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_s_cpu, __pyx_k_cpu, sizeof(__pyx_k_cpu), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_debugflag_set, __pyx_k_cpu_debugflag_set, sizeof(__pyx_k_cpu_debugflag_set), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_debugflag_unset, __pyx_k_cpu_debugflag_unset, sizeof(__pyx_k_cpu_debugflag_unset), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_eflags_get, __pyx_k_cpu_eflags_get, sizeof(__pyx_k_cpu_eflags_get), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_eflags_set, __pyx_k_cpu_eflags_set, sizeof(__pyx_k_cpu_eflags_set), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_eip_get, __pyx_k_cpu_eip_get, sizeof(__pyx_k_cpu_eip_get), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_eip_set, __pyx_k_cpu_eip_set, sizeof(__pyx_k_cpu_eip_set), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_get_current_instruction, __pyx_k_cpu_get_current_instruction, sizeof(__pyx_k_cpu_get_current_instruction), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_parse, __pyx_k_cpu_parse, sizeof(__pyx_k_cpu_parse), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_reg16_get, __pyx_k_cpu_reg16_get, sizeof(__pyx_k_cpu_reg16_get), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_reg16_set, __pyx_k_cpu_reg16_set, sizeof(__pyx_k_cpu_reg16_set), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_reg32_get, __pyx_k_cpu_reg32_get, sizeof(__pyx_k_cpu_reg32_get), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_reg32_set, __pyx_k_cpu_reg32_set, sizeof(__pyx_k_cpu_reg32_set), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_reg8_get, __pyx_k_cpu_reg8_get, sizeof(__pyx_k_cpu_reg8_get), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_reg8_set, __pyx_k_cpu_reg8_set, sizeof(__pyx_k_cpu_reg8_set), 0, 0, 1, 1}, + {&__pyx_n_s_cpu_step, __pyx_k_cpu_step, sizeof(__pyx_k_cpu_step), 0, 0, 1, 1}, + {&__pyx_n_s_datefmt, __pyx_k_datefmt, sizeof(__pyx_k_datefmt), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, + {&__pyx_n_s_dword, __pyx_k_dword, sizeof(__pyx_k_dword), 0, 0, 1, 1}, + {&__pyx_n_s_eax, __pyx_k_eax, sizeof(__pyx_k_eax), 0, 0, 1, 1}, + {&__pyx_n_s_ebp, __pyx_k_ebp, sizeof(__pyx_k_ebp), 0, 0, 1, 1}, + {&__pyx_n_s_ebx, __pyx_k_ebx, sizeof(__pyx_k_ebx), 0, 0, 1, 1}, + {&__pyx_n_s_ecx, __pyx_k_ecx, sizeof(__pyx_k_ecx), 0, 0, 1, 1}, + {&__pyx_n_s_edi, __pyx_k_edi, sizeof(__pyx_k_edi), 0, 0, 1, 1}, + {&__pyx_n_s_edx, __pyx_k_edx, sizeof(__pyx_k_edx), 0, 0, 1, 1}, + {&__pyx_n_s_eip, __pyx_k_eip, sizeof(__pyx_k_eip), 0, 0, 1, 1}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_enable_hooks, __pyx_k_enable_hooks, sizeof(__pyx_k_enable_hooks), 0, 0, 1, 1}, + {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, + {&__pyx_n_s_env, __pyx_k_env, sizeof(__pyx_k_env), 0, 0, 1, 1}, + {&__pyx_n_s_env_w32_hook_check, __pyx_k_env_w32_hook_check, sizeof(__pyx_k_env_w32_hook_check), 0, 0, 1, 1}, + {&__pyx_n_s_esi, __pyx_k_esi, sizeof(__pyx_k_esi), 0, 0, 1, 1}, + {&__pyx_n_s_esp, __pyx_k_esp, sizeof(__pyx_k_esp), 0, 0, 1, 1}, + {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, + {&__pyx_n_s_exit_2, __pyx_k_exit_2, sizeof(__pyx_k_exit_2), 0, 0, 1, 1}, + {&__pyx_n_u_exit_3, __pyx_k_exit_3, sizeof(__pyx_k_exit_3), 0, 1, 0, 1}, + {&__pyx_n_s_flag, __pyx_k_flag, sizeof(__pyx_k_flag), 0, 0, 1, 1}, + {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, + {&__pyx_n_s_free, __pyx_k_free, sizeof(__pyx_k_free), 0, 0, 1, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_n_s_hashlib, __pyx_k_hashlib, sizeof(__pyx_k_hashlib), 0, 0, 1, 1}, + {&__pyx_n_s_hexdigest, __pyx_k_hexdigest, sizeof(__pyx_k_hexdigest), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_init_subclass, __pyx_k_init_subclass, sizeof(__pyx_k_init_subclass), 0, 0, 1, 1}, + {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1}, + {&__pyx_n_s_instr_string, __pyx_k_instr_string, sizeof(__pyx_k_instr_string), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, + {&__pyx_n_s_len, __pyx_k_len, sizeof(__pyx_k_len), 0, 0, 1, 1}, + {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_maxsize, __pyx_k_maxsize, sizeof(__pyx_k_maxsize), 0, 0, 1, 1}, + {&__pyx_n_s_md5, __pyx_k_md5, sizeof(__pyx_k_md5), 0, 0, 1, 1}, + {&__pyx_n_s_mem, __pyx_k_mem, sizeof(__pyx_k_mem), 0, 0, 1, 1}, + {&__pyx_n_s_memory_read_block, __pyx_k_memory_read_block, sizeof(__pyx_k_memory_read_block), 0, 0, 1, 1}, + {&__pyx_n_s_memory_read_byte, __pyx_k_memory_read_byte, sizeof(__pyx_k_memory_read_byte), 0, 0, 1, 1}, + {&__pyx_n_s_memory_read_dword, __pyx_k_memory_read_dword, sizeof(__pyx_k_memory_read_dword), 0, 0, 1, 1}, + {&__pyx_n_s_memory_read_string, __pyx_k_memory_read_string, sizeof(__pyx_k_memory_read_string), 0, 0, 1, 1}, + {&__pyx_n_s_memory_read_word, __pyx_k_memory_read_word, sizeof(__pyx_k_memory_read_word), 0, 0, 1, 1}, + {&__pyx_n_s_memory_segment_get, __pyx_k_memory_segment_get, sizeof(__pyx_k_memory_segment_get), 0, 0, 1, 1}, + {&__pyx_n_s_memory_segment_select, __pyx_k_memory_segment_select, sizeof(__pyx_k_memory_segment_select), 0, 0, 1, 1}, + {&__pyx_n_s_memory_write_block, __pyx_k_memory_write_block, sizeof(__pyx_k_memory_write_block), 0, 0, 1, 1}, + {&__pyx_n_s_memory_write_byte, __pyx_k_memory_write_byte, sizeof(__pyx_k_memory_write_byte), 0, 0, 1, 1}, + {&__pyx_n_s_memory_write_dword, __pyx_k_memory_write_dword, sizeof(__pyx_k_memory_write_dword), 0, 0, 1, 1}, + {&__pyx_n_s_memory_write_word, __pyx_k_memory_write_word, sizeof(__pyx_k_memory_write_word), 0, 0, 1, 1}, + {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, + {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1}, + {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 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_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1}, + {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, + {&__pyx_n_s_output_size, __pyx_k_output_size, sizeof(__pyx_k_output_size), 0, 0, 1, 1}, + {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, + {&__pyx_n_s_prepare_2, __pyx_k_prepare_2, sizeof(__pyx_k_prepare_2), 0, 0, 1, 1}, + {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, + {&__pyx_n_s_pylibemu, __pyx_k_pylibemu, sizeof(__pyx_k_pylibemu), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, + {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 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_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__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_reg, __pyx_k_reg, sizeof(__pyx_k_reg), 0, 0, 1, 1}, + {&__pyx_n_s_request, __pyx_k_request, sizeof(__pyx_k_request), 0, 0, 1, 1}, + {&__pyx_n_s_run, __pyx_k_run, sizeof(__pyx_k_run), 0, 0, 1, 1}, + {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1}, + {&__pyx_n_s_sclen, __pyx_k_sclen, sizeof(__pyx_k_sclen), 0, 0, 1, 1}, + {&__pyx_n_s_scode, __pyx_k_scode, sizeof(__pyx_k_scode), 0, 0, 1, 1}, + {&__pyx_n_s_segment, __pyx_k_segment, sizeof(__pyx_k_segment), 0, 0, 1, 1}, + {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_n_s_set_name, __pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 0, 1, 1}, + {&__pyx_n_s_set_output_size, __pyx_k_set_output_size, sizeof(__pyx_k_set_output_size), 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_shellcode, __pyx_k_shellcode, sizeof(__pyx_k_shellcode), 0, 0, 1, 1}, + {&__pyx_n_s_shellcode_getpc_test, __pyx_k_shellcode_getpc_test, sizeof(__pyx_k_shellcode_getpc_test), 0, 0, 1, 1}, + {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1}, + {&__pyx_n_s_src, __pyx_k_src, sizeof(__pyx_k_src), 0, 0, 1, 1}, + {&__pyx_kp_s_src_pylibemu_pyx, __pyx_k_src_pylibemu_pyx, sizeof(__pyx_k_src_pylibemu_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_static_offset, __pyx_k_static_offset, sizeof(__pyx_k_static_offset), 0, 0, 1, 1}, + {&__pyx_n_s_steps, __pyx_k_steps, sizeof(__pyx_k_steps), 0, 0, 1, 1}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, + {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_test_2, __pyx_k_test_2, sizeof(__pyx_k_test_2), 0, 0, 1, 1}, + {&__pyx_n_s_timeout, __pyx_k_timeout, sizeof(__pyx_k_timeout), 0, 0, 1, 1}, + {&__pyx_n_s_urllib, __pyx_k_urllib, sizeof(__pyx_k_urllib), 0, 0, 1, 1}, + {&__pyx_n_s_urllib2, __pyx_k_urllib2, sizeof(__pyx_k_urllib2), 0, 0, 1, 1}, + {&__pyx_n_s_urllib_request, __pyx_k_urllib_request, sizeof(__pyx_k_urllib_request), 0, 0, 1, 1}, + {&__pyx_n_s_urlopen, __pyx_k_urlopen, sizeof(__pyx_k_urlopen), 0, 0, 1, 1}, + {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1}, + {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1}, + {&__pyx_n_s_warning, __pyx_k_warning, sizeof(__pyx_k_warning), 0, 0, 1, 1}, + {&__pyx_n_u_wb, __pyx_k_wb, sizeof(__pyx_k_wb), 0, 1, 0, 1}, + {&__pyx_n_s_word, __pyx_k_word, sizeof(__pyx_k_word), 0, 0, 1, 1}, + {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1}, + {&__pyx_n_u_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 1, 0, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 30, __pyx_L1_error) - __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 98, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 151, __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_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 569, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 664, __pyx_L1_error) + __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 568, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 663, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } +/* #### Code section: cached_constants ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "pylibemu.pyx":98 + /* "pylibemu.pyx":97 * * m = hashlib.md5(content) * with open(str(m.hexdigest()), mode = 'wb') as fd: # <<<<<<<<<<<<<< * fd.write(content) * */ - __pyx_tuple__3 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "pylibemu.pyx":664 + /* "pylibemu.pyx":663 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Emulator_not_initialized); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 664, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Emulator_not_initialized); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 663, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); - /* "pylibemu.pyx":1137 + /* "pylibemu.pyx":1136 * block = malloc(_len) * if block is NULL: * raise RuntimeError('Error while allocating memory') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_Error_while_allocating_memory); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 1137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Error_while_allocating_memory); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 1136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); - /* "pylibemu.pyx":1238 + /* "pylibemu.pyx":1237 * if _env is NULL: * print(emu_strerror(self._emu)) * raise RuntimeError('Emulator environment error') # <<<<<<<<<<<<<< * * if emu_env_w32_eip_check(_env) is NULL: */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_Emulator_environment_error); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 1238, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Emulator_environment_error); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 1237, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + + /* "pylibemu.pyx":29 + * + * try: + * import urllib.request as urllib2 # <<<<<<<<<<<<<< + * except ImportError: + * import urllib2 + */ + __pyx_tuple__9 = PyTuple_Pack(2, __pyx_n_s_urllib, __pyx_n_s_request); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(1, 1, __pyx_L1_error) - /* "(tree fragment)":4 - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") - * def __setstate_cython__(self, __pyx_state): - * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} + __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(1, 3, __pyx_L1_error) -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __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_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1000000 = PyInt_FromLong(1000000L); if (unlikely(!__pyx_int_1000000)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1048576 = PyInt_FromLong(1048576L); if (unlikely(!__pyx_int_1048576)) __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:; - return -1; -} + /* "pylibemu.pyx":449 + * self.free() + * + * def free(self): # <<<<<<<<<<<<<< + * if self._emu is not NULL: + * emu_free(self._emu) + */ + __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_free, 449, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 449, __pyx_L1_error) -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + /* "pylibemu.pyx":454 + * self._emu = NULL + * + * def new(self): # <<<<<<<<<<<<<< + * self._emu = emu_new() + * self.emu_profile = EmuProfile(self.output_size) + */ + __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_new, 454, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 454, __pyx_L1_error) -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "pylibemu.pyx":458 + * self.emu_profile = EmuProfile(self.output_size) + * + * def set_output_size(self, output_size): # <<<<<<<<<<<<<< + * self.free() + * self.output_size = output_size + */ + __pyx_tuple__16 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_output_size); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_set_output_size, 458, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 458, __pyx_L1_error) -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "pylibemu.pyx":463 + * self.new() + * + * def shellcode_getpc_test(self, shellcode): # <<<<<<<<<<<<<< + * ''' + * GetPC code is code that determines its own location in a process address + */ + __pyx_tuple__18 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_shellcode, __pyx_n_s_buffer, __pyx_n_s_sclen); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_shellcode_getpc_test, 463, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 463, __pyx_L1_error) -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "pylibemu.pyx":491 + * return self._offset + * + * def prepare(self, shellcode, offset): # <<<<<<<<<<<<<< + * ''' + * Method used to prepare the execution environment. The offset parameter + */ + __pyx_tuple__20 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_shellcode, __pyx_n_s_offset, __pyx_n_s_cpu, __pyx_n_s_mem, __pyx_n_s_scode, __pyx_n_s_j, __pyx_n_s_static_offset); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 491, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_prepare, 491, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 491, __pyx_L1_error) -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __pyx_vtabptr_8pylibemu_EmuProfile = &__pyx_vtable_8pylibemu_EmuProfile; - __pyx_vtable_8pylibemu_EmuProfile.check_memalloc = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *))__pyx_f_8pylibemu_10EmuProfile_check_memalloc; - __pyx_vtable_8pylibemu_EmuProfile.concatenate = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, char *, char *, unsigned long))__pyx_f_8pylibemu_10EmuProfile_concatenate; - __pyx_vtable_8pylibemu_EmuProfile.build_sep = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *))__pyx_f_8pylibemu_10EmuProfile_build_sep; - __pyx_vtable_8pylibemu_EmuProfile.log_function_header = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_function *))__pyx_f_8pylibemu_10EmuProfile_log_function_header; - __pyx_vtable_8pylibemu_EmuProfile.log_bracket_closed = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *))__pyx_f_8pylibemu_10EmuProfile_log_bracket_closed; - __pyx_vtable_8pylibemu_EmuProfile.log_array_start = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_log_array_start; - __pyx_vtable_8pylibemu_EmuProfile.log_array_end = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_log_array_end; - __pyx_vtable_8pylibemu_EmuProfile.log_struct_start = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_log_struct_start; - __pyx_vtable_8pylibemu_EmuProfile.log_struct_end = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_log_struct_end; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_int = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_int; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_string = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_string; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_bytea = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_bytea; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_ptr = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_ip = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_port = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_port; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_none = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_function_render_none = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *))__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_none; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_function_render_int = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_int; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_function_render_ptr = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, void *))__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_ptr; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_debug = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_function_debug = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_function *))__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug; - __pyx_vtable_8pylibemu_EmuProfile.emu_profile_debug = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_env *))__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug; - if (PyType_Ready(&__pyx_type_8pylibemu_EmuProfile) < 0) __PYX_ERR(0, 109, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_8pylibemu_EmuProfile.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8pylibemu_EmuProfile.tp_dictoffset && __pyx_type_8pylibemu_EmuProfile.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_8pylibemu_EmuProfile.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_SetVtable(__pyx_type_8pylibemu_EmuProfile.tp_dict, __pyx_vtabptr_8pylibemu_EmuProfile) < 0) __PYX_ERR(0, 109, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_EmuProfile, (PyObject *)&__pyx_type_8pylibemu_EmuProfile) < 0) __PYX_ERR(0, 109, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_8pylibemu_EmuProfile) < 0) __PYX_ERR(0, 109, __pyx_L1_error) - __pyx_ptype_8pylibemu_EmuProfile = &__pyx_type_8pylibemu_EmuProfile; - __pyx_vtabptr_8pylibemu_Emulator = &__pyx_vtable_8pylibemu_Emulator; - __pyx_vtable_8pylibemu_Emulator.check_stop_emulation = (PyObject *(*)(struct __pyx_obj_8pylibemu_Emulator *, struct emu_env_hook *))__pyx_f_8pylibemu_8Emulator_check_stop_emulation; - __pyx_vtable_8pylibemu_Emulator.test = (int (*)(struct __pyx_obj_8pylibemu_Emulator *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_test *__pyx_optional_args))__pyx_f_8pylibemu_8Emulator_test; - __pyx_vtable_8pylibemu_Emulator.run = (int (*)(struct __pyx_obj_8pylibemu_Emulator *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_run *__pyx_optional_args))__pyx_f_8pylibemu_8Emulator_run; - if (PyType_Ready(&__pyx_type_8pylibemu_Emulator) < 0) __PYX_ERR(0, 435, __pyx_L1_error) - #if PY_VERSION_HEX < 0x030800B1 - __pyx_type_8pylibemu_Emulator.tp_print = 0; - #endif - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_8pylibemu_Emulator.tp_dictoffset && __pyx_type_8pylibemu_Emulator.tp_getattro == PyObject_GenericGetAttr)) { - __pyx_type_8pylibemu_Emulator.tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - if (__Pyx_SetVtable(__pyx_type_8pylibemu_Emulator.tp_dict, __pyx_vtabptr_8pylibemu_Emulator) < 0) __PYX_ERR(0, 435, __pyx_L1_error) - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Emulator, (PyObject *)&__pyx_type_8pylibemu_Emulator) < 0) __PYX_ERR(0, 435, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type_8pylibemu_Emulator) < 0) __PYX_ERR(0, 435, __pyx_L1_error) - __pyx_ptype_8pylibemu_Emulator = &__pyx_type_8pylibemu_Emulator; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} + /* "pylibemu.pyx":545 + * return hook.hook.win.fnname.decode('utf-8') in ('ExitProcess', 'ExitThread', 'exit') + * + * cpdef int test(self, steps = 1000000): # <<<<<<<<<<<<<< + * ''' + * Method used to test and emulate the shellcode. The method must be always + */ + __pyx_tuple__22 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_steps); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_test, 545, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 545, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_int_1000000); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", - #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 - sizeof(PyTypeObject), - #else - sizeof(PyHeapTypeObject), - #endif - __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(3, 8, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn); - if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(4, 15, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} + /* "pylibemu.pyx":617 + * return 0 + * + * cpdef int run(self, shellcode, steps = 1000000): # <<<<<<<<<<<<<< + * cdef int32_t offset + * + */ + __pyx_tuple__25 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_shellcode, __pyx_n_s_steps); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 3, 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_src_pylibemu_pyx, __pyx_n_s_run, 617, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 617, __pyx_L1_error) -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "pylibemu.pyx":640 + * + * # CPU methods + * def cpu_reg32_get(self, c_emu_reg32 reg): # <<<<<<<<<<<<<< + * ''' + * Method used to get the 32-bit value stored in a register + */ + __pyx_tuple__27 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_reg, __pyx_n_s_cpu); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 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_src_pylibemu_pyx, __pyx_n_s_cpu_reg32_get, 640, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 640, __pyx_L1_error) -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif -#else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initpylibemu(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initpylibemu(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_pylibemu(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_pylibemu(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { - result = PyDict_SetItemString(moddict, to_name, value); - } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; - } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; -} - - -static CYTHON_SMALL_CODE int __pyx_pymod_exec_pylibemu(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - 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; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'pylibemu' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_pylibemu(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - PyEval_InitThreads(); - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("pylibemu", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_pylibemu) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "pylibemu")) { - if (unlikely(PyDict_SetItemString(modules, "pylibemu", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "pylibemu.pyx":24 - * cimport pylibemu - * - * __version__ = '0.8' # <<<<<<<<<<<<<< + /* "pylibemu.pyx":668 + * return emu_cpu_reg32_get(_cpu, reg) * - * import sys + * def cpu_reg32_set(self, c_emu_reg32 reg, uint32_t val): # <<<<<<<<<<<<<< + * ''' + * Method used to set a register with a 32-bit value */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_u_0_8) < 0) __PYX_ERR(0, 24, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_reg, __pyx_n_s_val, __pyx_n_s_cpu); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_cpu_reg32_set, 668, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 668, __pyx_L1_error) - /* "pylibemu.pyx":26 - * __version__ = '0.8' + /* "pylibemu.pyx":696 + * emu_cpu_reg32_set(_cpu, reg, val) * - * import sys # <<<<<<<<<<<<<< + * def cpu_reg16_get(self, c_emu_reg16 reg): # <<<<<<<<<<<<<< + * ''' + * Method used to get the 16-bit value stored in a register + */ + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 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_src_pylibemu_pyx, __pyx_n_s_cpu_reg16_get, 696, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 696, __pyx_L1_error) + + /* "pylibemu.pyx":724 + * return emu_cpu_reg16_get(_cpu, reg) * - * try: + * def cpu_reg16_set(self, c_emu_reg16 reg, uint16_t val): # <<<<<<<<<<<<<< + * ''' + * Method used to set a register with a 16-bit value */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_cpu_reg16_set, 724, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 724, __pyx_L1_error) - /* "pylibemu.pyx":28 - * import sys + /* "pylibemu.pyx":752 + * emu_cpu_reg16_set(_cpu, reg, val) * - * try: # <<<<<<<<<<<<<< - * import urllib.request as urllib2 - * except ImportError: + * def cpu_reg8_get(self, c_emu_reg8 reg): # <<<<<<<<<<<<<< + * ''' + * Method used to get the 8-bit value stored in a register */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_4); - /*try:*/ { + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 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_src_pylibemu_pyx, __pyx_n_s_cpu_reg8_get, 752, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 752, __pyx_L1_error) - /* "pylibemu.pyx":29 + /* "pylibemu.pyx":780 + * return emu_cpu_reg8_get(_cpu, reg) * - * try: - * import urllib.request as urllib2 # <<<<<<<<<<<<<< - * except ImportError: - * import urllib2 + * def cpu_reg8_set(self, c_emu_reg8 reg, uint8_t val): # <<<<<<<<<<<<<< + * ''' + * Method used to set a register with a 8-bit value */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s__12); - __Pyx_GIVEREF(__pyx_n_s__12); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__12); - __pyx_t_5 = __Pyx_Import(__pyx_n_s_urllib_request, __pyx_t_1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 29, __pyx_L2_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_urllib2, __pyx_t_5) < 0) __PYX_ERR(0, 29, __pyx_L2_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_cpu_reg8_set, 780, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 780, __pyx_L1_error) - /* "pylibemu.pyx":28 - * import sys + /* "pylibemu.pyx":808 + * emu_cpu_reg8_set(_cpu, reg, val) * - * try: # <<<<<<<<<<<<<< - * import urllib.request as urllib2 - * except ImportError: + * def cpu_eflags_get(self): # <<<<<<<<<<<<<< + * ''' + * Method used to get the 32-bit value stored in the register eflags */ - } - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - goto __pyx_L7_try_end; - __pyx_L2_error:; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_cpu); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 808, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 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_src_pylibemu_pyx, __pyx_n_s_cpu_eflags_get, 808, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 808, __pyx_L1_error) - /* "pylibemu.pyx":30 - * try: - * import urllib.request as urllib2 - * except ImportError: # <<<<<<<<<<<<<< - * import urllib2 + /* "pylibemu.pyx":825 + * return emu_cpu_eflags_get(_cpu) * + * def cpu_eflags_set(self, uint32_t val): # <<<<<<<<<<<<<< + * ''' + * Method used to set the register eflags with a 32-bit value */ - __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError); - if (__pyx_t_6) { - __Pyx_AddTraceback("pylibemu", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_1, &__pyx_t_7) < 0) __PYX_ERR(0, 30, __pyx_L4_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_7); + __pyx_tuple__37 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_val, __pyx_n_s_cpu); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 825, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_cpu_eflags_set, 825, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 825, __pyx_L1_error) - /* "pylibemu.pyx":31 - * import urllib.request as urllib2 - * except ImportError: - * import urllib2 # <<<<<<<<<<<<<< + /* "pylibemu.pyx":842 + * emu_cpu_eflags_set(_cpu, val) * - * import hashlib + * def cpu_eip_set(self, uint32_t eip): # <<<<<<<<<<<<<< + * ''' + * Method used to set the register eip with a 32-bit value */ - __pyx_t_8 = __Pyx_Import(__pyx_n_s_urllib2, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 31, __pyx_L4_except_error) - __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_urllib2, __pyx_t_8) < 0) __PYX_ERR(0, 31, __pyx_L4_except_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L3_exception_handled; - } - goto __pyx_L4_except_error; - __pyx_L4_except_error:; + __pyx_tuple__39 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_eip, __pyx_n_s_cpu); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_cpu_eip_set, 842, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 842, __pyx_L1_error) - /* "pylibemu.pyx":28 - * import sys + /* "pylibemu.pyx":859 + * emu_cpu_eip_set(_cpu, eip) * - * try: # <<<<<<<<<<<<<< - * import urllib.request as urllib2 - * except ImportError: + * def cpu_eip_get(self): # <<<<<<<<<<<<<< + * ''' + * Method used to get the 32-bit value stored in the register eip */ - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - goto __pyx_L1_error; - __pyx_L3_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_XGIVEREF(__pyx_t_4); - __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); - __pyx_L7_try_end:; - } + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 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_src_pylibemu_pyx, __pyx_n_s_cpu_eip_get, 859, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 859, __pyx_L1_error) - /* "pylibemu.pyx":33 - * import urllib2 - * - * import hashlib # <<<<<<<<<<<<<< - * import logging + /* "pylibemu.pyx":876 + * return emu_cpu_eip_get(_cpu) * + * def cpu_parse(self): # <<<<<<<<<<<<<< + * ''' + * Method used to parse an instruction at eip */ - __pyx_t_7 = __Pyx_Import(__pyx_n_s_hashlib, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_hashlib, __pyx_t_7) < 0) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 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_src_pylibemu_pyx, __pyx_n_s_cpu_parse, 876, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 876, __pyx_L1_error) - /* "pylibemu.pyx":34 - * - * import hashlib - * import logging # <<<<<<<<<<<<<< + /* "pylibemu.pyx":890 + * return emu_cpu_parse(_cpu) * - * logging.basicConfig(format = '%(asctime)s %(message)s', datefmt = '[%Y-%m-%d %H:%M:%S]') + * def cpu_step(self): # <<<<<<<<<<<<<< + * ''' + * Method used to step the last instruction */ - __pyx_t_7 = __Pyx_Import(__pyx_n_s_logging, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_7) < 0) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 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_src_pylibemu_pyx, __pyx_n_s_cpu_step, 890, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 890, __pyx_L1_error) - /* "pylibemu.pyx":36 - * import logging + /* "pylibemu.pyx":904 + * return emu_cpu_step(_cpu) * - * logging.basicConfig(format = '%(asctime)s %(message)s', datefmt = '[%Y-%m-%d %H:%M:%S]') # <<<<<<<<<<<<<< + * def cpu_debugflag_set(self, uint8_t flag): # <<<<<<<<<<<<<< + * ''' + * Method used to set a cpu debug flag + */ + __pyx_tuple__44 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_flag, __pyx_n_s_cpu); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 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_src_pylibemu_pyx, __pyx_n_s_cpu_debugflag_set, 904, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 904, __pyx_L1_error) + + /* "pylibemu.pyx":921 + * emu_cpu_debugflag_set(_cpu, flag) * + * def cpu_debugflag_unset(self, uint8_t flag): # <<<<<<<<<<<<<< + * ''' + * Method used to unset a cpu debug flag + */ + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 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_src_pylibemu_pyx, __pyx_n_s_cpu_debugflag_unset, 921, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 921, __pyx_L1_error) + + /* "pylibemu.pyx":938 + * emu_cpu_debugflag_unset(_cpu, flag) * + * def cpu_get_current_instruction(self): # <<<<<<<<<<<<<< + * ''' + * Method used to disassemble the current instruction */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_logging); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_basicConfig); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_format, __pyx_kp_u_asctime_s_message_s) < 0) __PYX_ERR(0, 36, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_datefmt, __pyx_kp_u_Y_m_d_H_M_S) < 0) __PYX_ERR(0, 36, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_tuple__47 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_instr_string); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 938, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__47); + __Pyx_GIVEREF(__pyx_tuple__47); + __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_cpu_get_current_instruction, 938, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 938, __pyx_L1_error) - /* "pylibemu.pyx":40 + /* "pylibemu.pyx":958 * - * # export register numbers - * class EMU_REGS: # <<<<<<<<<<<<<< - * eax = 0 - * ecx = 1 + * # Memory methods + * def memory_write_byte(self, uint32_t addr, uint8_t byte): # <<<<<<<<<<<<<< + * ''' + * Method used to write a byte at a memory location */ - __pyx_t_5 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_EMU_REGS, __pyx_n_s_EMU_REGS, (PyObject *) NULL, __pyx_n_s_pylibemu, (PyObject *) NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_tuple__49 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_addr, __pyx_n_s_byte, __pyx_n_s_mem); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 958, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__49); + __Pyx_GIVEREF(__pyx_tuple__49); + __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_memory_write_byte, 958, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 958, __pyx_L1_error) - /* "pylibemu.pyx":41 - * # export register numbers - * class EMU_REGS: - * eax = 0 # <<<<<<<<<<<<<< - * ecx = 1 - * edx = 2 + /* "pylibemu.pyx":978 + * emu_memory_write_byte(_mem, addr, byte) + * + * def memory_write_word(self, uint32_t addr, uint16_t word): # <<<<<<<<<<<<<< + * ''' + * Method used to write a word at a memory location */ - if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_eax, __pyx_int_0) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_tuple__51 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_addr, __pyx_n_s_word, __pyx_n_s_mem); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 978, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__51); + __Pyx_GIVEREF(__pyx_tuple__51); + __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_memory_write_word, 978, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 978, __pyx_L1_error) - /* "pylibemu.pyx":42 - * class EMU_REGS: - * eax = 0 - * ecx = 1 # <<<<<<<<<<<<<< - * edx = 2 - * ebx = 3 + /* "pylibemu.pyx":998 + * emu_memory_write_word(_mem, addr, word) + * + * def memory_write_dword(self, uint32_t addr, uint32_t dword): # <<<<<<<<<<<<<< + * ''' + * Method used to write a dword at a memory location */ - if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_ecx, __pyx_int_1) < 0) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_tuple__53 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_addr, __pyx_n_s_dword, __pyx_n_s_mem); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 998, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__53); + __Pyx_GIVEREF(__pyx_tuple__53); + __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_memory_write_dword, 998, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 998, __pyx_L1_error) - /* "pylibemu.pyx":43 - * eax = 0 - * ecx = 1 - * edx = 2 # <<<<<<<<<<<<<< - * ebx = 3 - * esp = 4 + /* "pylibemu.pyx":1018 + * emu_memory_write_dword(_mem, addr, dword) + * + * def memory_write_block(self, uint32_t addr, src, size_t _len): # <<<<<<<<<<<<<< + * ''' + * Method used to write a block at a memory location */ - if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_edx, __pyx_int_2) < 0) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_tuple__55 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_addr, __pyx_n_s_src, __pyx_n_s_len, __pyx_n_s_mem); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 1018, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__55); + __Pyx_GIVEREF(__pyx_tuple__55); + __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_memory_write_block, 1018, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 1018, __pyx_L1_error) - /* "pylibemu.pyx":44 - * ecx = 1 - * edx = 2 - * ebx = 3 # <<<<<<<<<<<<<< - * esp = 4 - * ebp = 5 + /* "pylibemu.pyx":1041 + * emu_memory_write_block(_mem, addr, src, _len) + * + * def memory_read_byte(self, uint32_t addr): # <<<<<<<<<<<<<< + * ''' + * Method used to read a byte at a memory location */ - if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_ebx, __pyx_int_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_tuple__57 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_addr, __pyx_n_s_mem, __pyx_n_s_byte); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 1041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__57); + __Pyx_GIVEREF(__pyx_tuple__57); + __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_memory_read_byte, 1041, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 1041, __pyx_L1_error) - /* "pylibemu.pyx":45 - * edx = 2 - * ebx = 3 - * esp = 4 # <<<<<<<<<<<<<< - * ebp = 5 - * esi = 6 + /* "pylibemu.pyx":1065 + * return byte + * + * def memory_read_word(self, uint32_t addr): # <<<<<<<<<<<<<< + * ''' + * Method used to read a word at a memory location */ - if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_esp, __pyx_int_4) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_tuple__59 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_addr, __pyx_n_s_mem, __pyx_n_s_word); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__59); + __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_memory_read_word, 1065, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 1065, __pyx_L1_error) - /* "pylibemu.pyx":46 - * ebx = 3 - * esp = 4 - * ebp = 5 # <<<<<<<<<<<<<< - * esi = 6 - * edi = 7 + /* "pylibemu.pyx":1089 + * return word + * + * def memory_read_dword(self, uint32_t addr): # <<<<<<<<<<<<<< + * ''' + * Method used to read a dword at a memory location */ - if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_ebp, __pyx_int_5) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_tuple__61 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_addr, __pyx_n_s_mem, __pyx_n_s_dword); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 1089, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__61); + __Pyx_GIVEREF(__pyx_tuple__61); + __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_memory_read_dword, 1089, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 1089, __pyx_L1_error) - /* "pylibemu.pyx":47 - * esp = 4 - * ebp = 5 - * esi = 6 # <<<<<<<<<<<<<< - * edi = 7 + /* "pylibemu.pyx":1113 + * return dword * + * def memory_read_block(self, uint32_t addr, size_t _len): # <<<<<<<<<<<<<< + * ''' + * Method used to read a block at a memory location */ - if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_esi, __pyx_int_6) < 0) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_tuple__63 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_addr, __pyx_n_s_len, __pyx_n_s_mem, __pyx_n_s_block); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 1113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__63); + __Pyx_GIVEREF(__pyx_tuple__63); + __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_memory_read_block, 1113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 1113, __pyx_L1_error) - /* "pylibemu.pyx":48 - * ebp = 5 - * esi = 6 - * edi = 7 # <<<<<<<<<<<<<< + /* "pylibemu.pyx":1144 + * return block * + * def memory_read_string(self, uint32_t addr, uint32_t maxsize): # <<<<<<<<<<<<<< + * ''' + * Method used to read a string at a memory location + */ + __pyx_tuple__65 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_addr, __pyx_n_s_maxsize, __pyx_n_s_mem, __pyx_n_s_s); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 1144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__65); + __Pyx_GIVEREF(__pyx_tuple__65); + __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_memory_read_string, 1144, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(0, 1144, __pyx_L1_error) + + /* "pylibemu.pyx":1171 + * return s.data * + * def memory_segment_select(self, c_emu_segment segment): # <<<<<<<<<<<<<< + * ''' + * Method used to select a segment */ - if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_edi, __pyx_int_7) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_tuple__67 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_segment, __pyx_n_s_mem); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 1171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__67); + __Pyx_GIVEREF(__pyx_tuple__67); + __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_memory_segment_select, 1171, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 1171, __pyx_L1_error) - /* "pylibemu.pyx":40 + /* "pylibemu.pyx":1194 + * emu_memory_segment_select(_mem, segment) * - * # export register numbers - * class EMU_REGS: # <<<<<<<<<<<<<< - * eax = 0 - * ecx = 1 + * def memory_segment_get(self): # <<<<<<<<<<<<<< + * ''' + * Method used to get the current segment */ - __pyx_t_7 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_EMU_REGS, __pyx_empty_tuple, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EMU_REGS, __pyx_t_7) < 0) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_tuple__69 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_mem); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 1194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__69); + __Pyx_GIVEREF(__pyx_tuple__69); + __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_memory_segment_get, 1194, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 1194, __pyx_L1_error) - /* "pylibemu.pyx":1 - * # # <<<<<<<<<<<<<< - * # pylibemu.pyx - * # + /* "pylibemu.pyx":1218 + * + * # Win32 environment + * def env_w32_hook_check(self): # <<<<<<<<<<<<<< + * ''' + * Method used to check if a hooked Win32 API is at the */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_2, __pyx_t_5) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_tuple__71 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_env); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 1218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__71); + __Pyx_GIVEREF(__pyx_tuple__71); + __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pylibemu_pyx, __pyx_n_s_env_w32_hook_check, 1218, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) __PYX_ERR(0, 1218, __pyx_L1_error) - /*--- Wrapped vars code ---*/ + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(1, 1, __pyx_L1_error) - goto __pyx_L0; + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init pylibemu", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_CLEAR(__pyx_m); - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init pylibemu"); - } - __pyx_L0:; __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; + return -1; +} +/* #### Code section: init_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __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_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1000000 = PyInt_FromLong(1000000L); if (unlikely(!__pyx_int_1000000)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1048576 = PyInt_FromLong(1048576L); if (unlikely(!__pyx_int_1048576)) __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:; + return -1; +} +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + return 0; +} +/* #### Code section: init_module ### */ + +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __pyx_vtabptr_8pylibemu_EmuProfile = &__pyx_vtable_8pylibemu_EmuProfile; + __pyx_vtable_8pylibemu_EmuProfile.check_memalloc = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *))__pyx_f_8pylibemu_10EmuProfile_check_memalloc; + __pyx_vtable_8pylibemu_EmuProfile.concatenate = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, char *, char *, unsigned long))__pyx_f_8pylibemu_10EmuProfile_concatenate; + __pyx_vtable_8pylibemu_EmuProfile.build_sep = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *))__pyx_f_8pylibemu_10EmuProfile_build_sep; + __pyx_vtable_8pylibemu_EmuProfile.log_function_header = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_function *))__pyx_f_8pylibemu_10EmuProfile_log_function_header; + __pyx_vtable_8pylibemu_EmuProfile.log_bracket_closed = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *))__pyx_f_8pylibemu_10EmuProfile_log_bracket_closed; + __pyx_vtable_8pylibemu_EmuProfile.log_array_start = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_log_array_start; + __pyx_vtable_8pylibemu_EmuProfile.log_array_end = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_log_array_end; + __pyx_vtable_8pylibemu_EmuProfile.log_struct_start = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_log_struct_start; + __pyx_vtable_8pylibemu_EmuProfile.log_struct_end = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_log_struct_end; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_int = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_int; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_string = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_string; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_bytea = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_bytea; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_ptr = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_ip = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_port = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_port; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_render_none = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_function_render_none = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *))__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_none; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_function_render_int = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_int; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_function_render_ptr = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, void *))__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_ptr; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_argument_debug = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_argument *, int))__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_function_debug = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_profile_function *))__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug; + __pyx_vtable_8pylibemu_EmuProfile.emu_profile_debug = (PyObject *(*)(struct __pyx_obj_8pylibemu_EmuProfile *, struct emu_env *))__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug; + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_8pylibemu_EmuProfile = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_8pylibemu_EmuProfile_spec, NULL); if (unlikely(!__pyx_ptype_8pylibemu_EmuProfile)) __PYX_ERR(0, 108, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_8pylibemu_EmuProfile_spec, __pyx_ptype_8pylibemu_EmuProfile) < 0) __PYX_ERR(0, 108, __pyx_L1_error) #else - return; + __pyx_ptype_8pylibemu_EmuProfile = &__pyx_type_8pylibemu_EmuProfile; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_8pylibemu_EmuProfile) < 0) __PYX_ERR(0, 108, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_8pylibemu_EmuProfile->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_8pylibemu_EmuProfile->tp_dictoffset && __pyx_ptype_8pylibemu_EmuProfile->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_8pylibemu_EmuProfile->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_ptype_8pylibemu_EmuProfile, __pyx_vtabptr_8pylibemu_EmuProfile) < 0) __PYX_ERR(0, 108, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_ptype_8pylibemu_EmuProfile) < 0) __PYX_ERR(0, 108, __pyx_L1_error) + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_EmuProfile, (PyObject *) __pyx_ptype_8pylibemu_EmuProfile) < 0) __PYX_ERR(0, 108, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_8pylibemu_EmuProfile) < 0) __PYX_ERR(0, 108, __pyx_L1_error) #endif + __pyx_vtabptr_8pylibemu_Emulator = &__pyx_vtable_8pylibemu_Emulator; + __pyx_vtable_8pylibemu_Emulator.check_stop_emulation = (PyObject *(*)(struct __pyx_obj_8pylibemu_Emulator *, struct emu_env_hook *))__pyx_f_8pylibemu_8Emulator_check_stop_emulation; + __pyx_vtable_8pylibemu_Emulator.test = (int (*)(struct __pyx_obj_8pylibemu_Emulator *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_test *__pyx_optional_args))__pyx_f_8pylibemu_8Emulator_test; + __pyx_vtable_8pylibemu_Emulator.run = (int (*)(struct __pyx_obj_8pylibemu_Emulator *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_run *__pyx_optional_args))__pyx_f_8pylibemu_8Emulator_run; + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_8pylibemu_Emulator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_8pylibemu_Emulator_spec, NULL); if (unlikely(!__pyx_ptype_8pylibemu_Emulator)) __PYX_ERR(0, 434, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_8pylibemu_Emulator_spec, __pyx_ptype_8pylibemu_Emulator) < 0) __PYX_ERR(0, 434, __pyx_L1_error) + #else + __pyx_ptype_8pylibemu_Emulator = &__pyx_type_8pylibemu_Emulator; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_8pylibemu_Emulator) < 0) __PYX_ERR(0, 434, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_8pylibemu_Emulator->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_8pylibemu_Emulator->tp_dictoffset && __pyx_ptype_8pylibemu_Emulator->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_8pylibemu_Emulator->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (__Pyx_SetVtable(__pyx_ptype_8pylibemu_Emulator, __pyx_vtabptr_8pylibemu_Emulator) < 0) __PYX_ERR(0, 434, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_MergeVtables(__pyx_ptype_8pylibemu_Emulator) < 0) __PYX_ERR(0, 434, __pyx_L1_error) + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Emulator, (PyObject *) __pyx_ptype_8pylibemu_Emulator) < 0) __PYX_ERR(0, 434, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_8pylibemu_Emulator) < 0) __PYX_ERR(0, 434, __pyx_L1_error) + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; } -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_6(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", + #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_6(PyTypeObject), + #elif CYTHON_COMPILING_IN_LIMITED_API + sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_6(PyTypeObject), + #else + sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_6(PyHeapTypeObject), + #endif + __Pyx_ImportType_CheckSize_Warn_3_0_6); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_0_6(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_6(PyBoolObject),__Pyx_ImportType_CheckSize_Warn_3_0_6); if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(4, 8, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_0_6(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_6(PyComplexObject),__Pyx_ImportType_CheckSize_Warn_3_0_6); if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(5, 15, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; } + + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_pylibemu(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_pylibemu}, + {0, NULL} +}; #endif -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "pylibemu", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #if CYTHON_USE_MODULE_STATE + __pyx_m_traverse, /* m_traverse */ + __pyx_m_clear, /* m_clear */ + NULL /* m_free */ + #else + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ + #endif + }; + #ifdef __cplusplus +} /* anonymous namespace */ +#endif +#endif + +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void +#endif +#else +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif +#endif + + #if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +__Pyx_PyMODINIT_FUNC initpylibemu(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initpylibemu(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_pylibemu(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_pylibemu(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) #endif - return PyObject_GetAttr(obj, attr_name); +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else + result = PyDict_SetItemString(moddict, to_name, value); +#endif + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + CYTHON_UNUSED_VAR(def); + if (__Pyx_check_single_interpreter()) + return NULL; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; +#endif + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_pylibemu(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'pylibemu' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("pylibemu", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to pylibemu pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_pylibemu(void)", 0); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + PyEval_InitThreads(); + #endif + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_pylibemu) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "pylibemu")) { + if (unlikely((PyDict_SetItemString(modules, "pylibemu", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "pylibemu.pyx":24 + * cimport pylibemu + * + * __version__ = '0.8' # <<<<<<<<<<<<<< + * + * import sys + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_u_0_8) < 0) __PYX_ERR(0, 24, __pyx_L1_error) + + /* "pylibemu.pyx":26 + * __version__ = '0.8' + * + * import sys # <<<<<<<<<<<<<< + * + * try: + */ + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_sys, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pylibemu.pyx":28 + * import sys + * + * try: # <<<<<<<<<<<<<< + * import urllib.request as urllib2 + * except ImportError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + /*try:*/ { + + /* "pylibemu.pyx":29 + * + * try: + * import urllib.request as urllib2 # <<<<<<<<<<<<<< + * except ImportError: + * import urllib2 + */ + __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_urllib_request, __pyx_tuple__9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L2_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_urllib2, __pyx_t_2) < 0) __PYX_ERR(0, 29, __pyx_L2_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pylibemu.pyx":28 + * import sys + * + * try: # <<<<<<<<<<<<<< + * import urllib.request as urllib2 + * except ImportError: + */ + } + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L7_try_end; + __pyx_L2_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pylibemu.pyx":30 + * try: + * import urllib.request as urllib2 + * except ImportError: # <<<<<<<<<<<<<< + * import urllib2 + * + */ + __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError); + if (__pyx_t_5) { + __Pyx_AddTraceback("pylibemu", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 30, __pyx_L4_except_error) + __Pyx_XGOTREF(__pyx_t_2); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + + /* "pylibemu.pyx":31 + * import urllib.request as urllib2 + * except ImportError: + * import urllib2 # <<<<<<<<<<<<<< + * + * import hashlib + */ + __pyx_t_8 = __Pyx_ImportDottedModule(__pyx_n_s_urllib2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 31, __pyx_L4_except_error) + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_urllib2, __pyx_t_8) < 0) __PYX_ERR(0, 31, __pyx_L4_except_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L3_exception_handled; + } + goto __pyx_L4_except_error; + + /* "pylibemu.pyx":28 + * import sys + * + * try: # <<<<<<<<<<<<<< + * import urllib.request as urllib2 + * except ImportError: + */ + __pyx_L4_except_error:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_3, __pyx_t_4); + goto __pyx_L1_error; + __pyx_L3_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_3, __pyx_t_4); + __pyx_L7_try_end:; + } + + /* "pylibemu.pyx":33 + * import urllib2 + * + * import hashlib # <<<<<<<<<<<<<< + * import logging + * + */ + __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_hashlib, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_hashlib, __pyx_t_7) < 0) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "pylibemu.pyx":34 + * + * import hashlib + * import logging # <<<<<<<<<<<<<< + * + * logging.basicConfig(format = '%(asctime)s %(message)s', datefmt = '[%Y-%m-%d %H:%M:%S]') + */ + __pyx_t_7 = __Pyx_ImportDottedModule(__pyx_n_s_logging, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_7) < 0) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "pylibemu.pyx":36 + * import logging + * + * logging.basicConfig(format = '%(asctime)s %(message)s', datefmt = '[%Y-%m-%d %H:%M:%S]') # <<<<<<<<<<<<<< + * + * + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_logging); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_basicConfig); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_format, __pyx_kp_u_asctime_s_message_s) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_datefmt, __pyx_kp_u_Y_m_d_H_M_S) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pylibemu.pyx":40 + * + * # export register numbers + * class EMU_REGS: # <<<<<<<<<<<<<< + * eax = 0 + * ecx = 1 + */ + __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_EMU_REGS, __pyx_n_s_EMU_REGS, (PyObject *) NULL, __pyx_n_s_pylibemu, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "pylibemu.pyx":41 + * # export register numbers + * class EMU_REGS: + * eax = 0 # <<<<<<<<<<<<<< + * ecx = 1 + * edx = 2 + */ + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_eax, __pyx_int_0) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + + /* "pylibemu.pyx":42 + * class EMU_REGS: + * eax = 0 + * ecx = 1 # <<<<<<<<<<<<<< + * edx = 2 + * ebx = 3 + */ + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_ecx, __pyx_int_1) < 0) __PYX_ERR(0, 42, __pyx_L1_error) + + /* "pylibemu.pyx":43 + * eax = 0 + * ecx = 1 + * edx = 2 # <<<<<<<<<<<<<< + * ebx = 3 + * esp = 4 + */ + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_edx, __pyx_int_2) < 0) __PYX_ERR(0, 43, __pyx_L1_error) + + /* "pylibemu.pyx":44 + * ecx = 1 + * edx = 2 + * ebx = 3 # <<<<<<<<<<<<<< + * esp = 4 + * ebp = 5 + */ + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_ebx, __pyx_int_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + + /* "pylibemu.pyx":45 + * edx = 2 + * ebx = 3 + * esp = 4 # <<<<<<<<<<<<<< + * ebp = 5 + * esi = 6 + */ + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_esp, __pyx_int_4) < 0) __PYX_ERR(0, 45, __pyx_L1_error) + + /* "pylibemu.pyx":46 + * ebx = 3 + * esp = 4 + * ebp = 5 # <<<<<<<<<<<<<< + * esi = 6 + * edi = 7 + */ + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_ebp, __pyx_int_5) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + + /* "pylibemu.pyx":47 + * esp = 4 + * ebp = 5 + * esi = 6 # <<<<<<<<<<<<<< + * edi = 7 + * + */ + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_esi, __pyx_int_6) < 0) __PYX_ERR(0, 47, __pyx_L1_error) + + /* "pylibemu.pyx":48 + * ebp = 5 + * esi = 6 + * edi = 7 # <<<<<<<<<<<<<< + * + * + */ + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_edi, __pyx_int_7) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + + /* "pylibemu.pyx":40 + * + * # export register numbers + * class EMU_REGS: # <<<<<<<<<<<<<< + * eax = 0 + * ecx = 1 + */ + __pyx_t_7 = __Pyx_Py3ClassCreate(((PyObject*)&PyType_Type), __pyx_n_s_EMU_REGS, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EMU_REGS, __pyx_t_7) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_10EmuProfile_3__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_EmuProfile___reduce_cython, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_10EmuProfile_5__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_EmuProfile___setstate_cython, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pylibemu.pyx":449 + * self.free() + * + * def free(self): # <<<<<<<<<<<<<< + * if self._emu is not NULL: + * emu_free(self._emu) + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_5free, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_free, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_free, __pyx_t_2) < 0) __PYX_ERR(0, 449, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":454 + * self._emu = NULL + * + * def new(self): # <<<<<<<<<<<<<< + * self._emu = emu_new() + * self.emu_profile = EmuProfile(self.output_size) + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_7new, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_new, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_new, __pyx_t_2) < 0) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":458 + * self.emu_profile = EmuProfile(self.output_size) + * + * def set_output_size(self, output_size): # <<<<<<<<<<<<<< + * self.free() + * self.output_size = output_size + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_9set_output_size, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_set_output_size, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_set_output_size, __pyx_t_2) < 0) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":463 + * self.new() + * + * def shellcode_getpc_test(self, shellcode): # <<<<<<<<<<<<<< + * ''' + * GetPC code is code that determines its own location in a process address + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_11shellcode_getpc_test, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_shellcode_getpc_test, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_shellcode_getpc_test, __pyx_t_2) < 0) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":491 + * return self._offset + * + * def prepare(self, shellcode, offset): # <<<<<<<<<<<<<< + * ''' + * Method used to prepare the execution environment. The offset parameter + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_13prepare, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_prepare, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 491, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_prepare, __pyx_t_2) < 0) __PYX_ERR(0, 491, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":545 + * return hook.hook.win.fnname.decode('utf-8') in ('ExitProcess', 'ExitThread', 'exit') + * + * cpdef int test(self, steps = 1000000): # <<<<<<<<<<<<<< + * ''' + * Method used to test and emulate the shellcode. The method must be always + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_15test, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_test, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__24); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 545, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":617 + * return 0 + * + * cpdef int run(self, shellcode, steps = 1000000): # <<<<<<<<<<<<<< + * cdef int32_t offset + * + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_17run, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_run, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__24); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_run, __pyx_t_2) < 0) __PYX_ERR(0, 617, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":640 + * + * # CPU methods + * def cpu_reg32_get(self, c_emu_reg32 reg): # <<<<<<<<<<<<<< + * ''' + * Method used to get the 32-bit value stored in a register + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_19cpu_reg32_get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_reg32_get, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_reg32_get, __pyx_t_2) < 0) __PYX_ERR(0, 640, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":668 + * return emu_cpu_reg32_get(_cpu, reg) + * + * def cpu_reg32_set(self, c_emu_reg32 reg, uint32_t val): # <<<<<<<<<<<<<< + * ''' + * Method used to set a register with a 32-bit value + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_21cpu_reg32_set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_reg32_set, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_reg32_set, __pyx_t_2) < 0) __PYX_ERR(0, 668, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":696 + * emu_cpu_reg32_set(_cpu, reg, val) + * + * def cpu_reg16_get(self, c_emu_reg16 reg): # <<<<<<<<<<<<<< + * ''' + * Method used to get the 16-bit value stored in a register + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_23cpu_reg16_get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_reg16_get, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_reg16_get, __pyx_t_2) < 0) __PYX_ERR(0, 696, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":724 + * return emu_cpu_reg16_get(_cpu, reg) + * + * def cpu_reg16_set(self, c_emu_reg16 reg, uint16_t val): # <<<<<<<<<<<<<< + * ''' + * Method used to set a register with a 16-bit value + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_25cpu_reg16_set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_reg16_set, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_reg16_set, __pyx_t_2) < 0) __PYX_ERR(0, 724, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":752 + * emu_cpu_reg16_set(_cpu, reg, val) + * + * def cpu_reg8_get(self, c_emu_reg8 reg): # <<<<<<<<<<<<<< + * ''' + * Method used to get the 8-bit value stored in a register + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_27cpu_reg8_get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_reg8_get, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_reg8_get, __pyx_t_2) < 0) __PYX_ERR(0, 752, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":780 + * return emu_cpu_reg8_get(_cpu, reg) + * + * def cpu_reg8_set(self, c_emu_reg8 reg, uint8_t val): # <<<<<<<<<<<<<< + * ''' + * Method used to set a register with a 8-bit value + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_29cpu_reg8_set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_reg8_set, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_reg8_set, __pyx_t_2) < 0) __PYX_ERR(0, 780, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":808 + * emu_cpu_reg8_set(_cpu, reg, val) + * + * def cpu_eflags_get(self): # <<<<<<<<<<<<<< + * ''' + * Method used to get the 32-bit value stored in the register eflags + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_31cpu_eflags_get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_eflags_get, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 808, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_eflags_get, __pyx_t_2) < 0) __PYX_ERR(0, 808, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":825 + * return emu_cpu_eflags_get(_cpu) + * + * def cpu_eflags_set(self, uint32_t val): # <<<<<<<<<<<<<< + * ''' + * Method used to set the register eflags with a 32-bit value + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_33cpu_eflags_set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_eflags_set, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_eflags_set, __pyx_t_2) < 0) __PYX_ERR(0, 825, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":842 + * emu_cpu_eflags_set(_cpu, val) + * + * def cpu_eip_set(self, uint32_t eip): # <<<<<<<<<<<<<< + * ''' + * Method used to set the register eip with a 32-bit value + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_35cpu_eip_set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_eip_set, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_eip_set, __pyx_t_2) < 0) __PYX_ERR(0, 842, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":859 + * emu_cpu_eip_set(_cpu, eip) + * + * def cpu_eip_get(self): # <<<<<<<<<<<<<< + * ''' + * Method used to get the 32-bit value stored in the register eip + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_37cpu_eip_get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_eip_get, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_eip_get, __pyx_t_2) < 0) __PYX_ERR(0, 859, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":876 + * return emu_cpu_eip_get(_cpu) + * + * def cpu_parse(self): # <<<<<<<<<<<<<< + * ''' + * Method used to parse an instruction at eip + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_39cpu_parse, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_parse, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_parse, __pyx_t_2) < 0) __PYX_ERR(0, 876, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":890 + * return emu_cpu_parse(_cpu) + * + * def cpu_step(self): # <<<<<<<<<<<<<< + * ''' + * Method used to step the last instruction + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_41cpu_step, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_step, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_step, __pyx_t_2) < 0) __PYX_ERR(0, 890, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":904 + * return emu_cpu_step(_cpu) + * + * def cpu_debugflag_set(self, uint8_t flag): # <<<<<<<<<<<<<< + * ''' + * Method used to set a cpu debug flag + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_43cpu_debugflag_set, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_debugflag_set, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_debugflag_set, __pyx_t_2) < 0) __PYX_ERR(0, 904, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":921 + * emu_cpu_debugflag_set(_cpu, flag) + * + * def cpu_debugflag_unset(self, uint8_t flag): # <<<<<<<<<<<<<< + * ''' + * Method used to unset a cpu debug flag + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_45cpu_debugflag_unset, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_debugflag_unset, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__46)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 921, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_debugflag_unset, __pyx_t_2) < 0) __PYX_ERR(0, 921, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":938 + * emu_cpu_debugflag_unset(_cpu, flag) + * + * def cpu_get_current_instruction(self): # <<<<<<<<<<<<<< + * ''' + * Method used to disassemble the current instruction + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_47cpu_get_current_instruction, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_cpu_get_current_instruc, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 938, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_cpu_get_current_instruction, __pyx_t_2) < 0) __PYX_ERR(0, 938, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":958 + * + * # Memory methods + * def memory_write_byte(self, uint32_t addr, uint8_t byte): # <<<<<<<<<<<<<< + * ''' + * Method used to write a byte at a memory location + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_49memory_write_byte, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_memory_write_byte, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 958, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_memory_write_byte, __pyx_t_2) < 0) __PYX_ERR(0, 958, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":978 + * emu_memory_write_byte(_mem, addr, byte) + * + * def memory_write_word(self, uint32_t addr, uint16_t word): # <<<<<<<<<<<<<< + * ''' + * Method used to write a word at a memory location + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_51memory_write_word, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_memory_write_word, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 978, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_memory_write_word, __pyx_t_2) < 0) __PYX_ERR(0, 978, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":998 + * emu_memory_write_word(_mem, addr, word) + * + * def memory_write_dword(self, uint32_t addr, uint32_t dword): # <<<<<<<<<<<<<< + * ''' + * Method used to write a dword at a memory location + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_53memory_write_dword, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_memory_write_dword, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 998, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_memory_write_dword, __pyx_t_2) < 0) __PYX_ERR(0, 998, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":1018 + * emu_memory_write_dword(_mem, addr, dword) + * + * def memory_write_block(self, uint32_t addr, src, size_t _len): # <<<<<<<<<<<<<< + * ''' + * Method used to write a block at a memory location + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_55memory_write_block, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_memory_write_block, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1018, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_memory_write_block, __pyx_t_2) < 0) __PYX_ERR(0, 1018, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":1041 + * emu_memory_write_block(_mem, addr, src, _len) + * + * def memory_read_byte(self, uint32_t addr): # <<<<<<<<<<<<<< + * ''' + * Method used to read a byte at a memory location + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_57memory_read_byte, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_memory_read_byte, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__58)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1041, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_memory_read_byte, __pyx_t_2) < 0) __PYX_ERR(0, 1041, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":1065 + * return byte + * + * def memory_read_word(self, uint32_t addr): # <<<<<<<<<<<<<< + * ''' + * Method used to read a word at a memory location + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_59memory_read_word, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_memory_read_word, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_memory_read_word, __pyx_t_2) < 0) __PYX_ERR(0, 1065, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":1089 + * return word + * + * def memory_read_dword(self, uint32_t addr): # <<<<<<<<<<<<<< + * ''' + * Method used to read a dword at a memory location + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_61memory_read_dword, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_memory_read_dword, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1089, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_memory_read_dword, __pyx_t_2) < 0) __PYX_ERR(0, 1089, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":1113 + * return dword + * + * def memory_read_block(self, uint32_t addr, size_t _len): # <<<<<<<<<<<<<< + * ''' + * Method used to read a block at a memory location + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_63memory_read_block, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_memory_read_block, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_memory_read_block, __pyx_t_2) < 0) __PYX_ERR(0, 1113, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":1144 + * return block + * + * def memory_read_string(self, uint32_t addr, uint32_t maxsize): # <<<<<<<<<<<<<< + * ''' + * Method used to read a string at a memory location + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_65memory_read_string, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_memory_read_string, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_memory_read_string, __pyx_t_2) < 0) __PYX_ERR(0, 1144, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":1171 + * return s.data + * + * def memory_segment_select(self, c_emu_segment segment): # <<<<<<<<<<<<<< + * ''' + * Method used to select a segment + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_67memory_segment_select, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_memory_segment_select, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1171, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_memory_segment_select, __pyx_t_2) < 0) __PYX_ERR(0, 1171, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":1194 + * emu_memory_segment_select(_mem, segment) + * + * def memory_segment_get(self): # <<<<<<<<<<<<<< + * ''' + * Method used to get the current segment + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_69memory_segment_get, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_memory_segment_get, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_memory_segment_get, __pyx_t_2) < 0) __PYX_ERR(0, 1194, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "pylibemu.pyx":1218 + * + * # Win32 environment + * def env_w32_hook_check(self): # <<<<<<<<<<<<<< + * ''' + * Method used to check if a hooked Win32 API is at the + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_71env_w32_hook_check, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator_env_w32_hook_check, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1218, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_env_w32_hook_check, __pyx_t_2) < 0) __PYX_ERR(0, 1218, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_8pylibemu_Emulator); + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_73__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator___reduce_cython, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__73)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_8pylibemu_8Emulator_75__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Emulator___setstate_cython, NULL, __pyx_n_s_pylibemu, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(1, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "pylibemu.pyx":1 + * # # <<<<<<<<<<<<<< + * # pylibemu.pyx + * # + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_2, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + if (__pyx_m) { + if (__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init pylibemu", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + #if !CYTHON_USE_MODULE_STATE + Py_CLEAR(__pyx_m); + #else + Py_DECREF(__pyx_m); + if (pystate_addmodule_run) { + PyObject *tp, *value, *tb; + PyErr_Fetch(&tp, &value, &tb); + PyState_RemoveModule(&__pyx_moduledef); + PyErr_Restore(tp, value, tb); + } + #endif + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init pylibemu"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} +/* #### Code section: cleanup_globals ### */ +/* #### Code section: cleanup_module ### */ +/* #### Code section: main_method ### */ +/* #### Code section: utility_code_pragmas ### */ +#ifdef _MSC_VER +#pragma warning( push ) +/* Warning 4127: conditional expression is constant + * Cython uses constant conditional expressions to allow in inline functions to be optimized at + * compile-time, so this warning is not useful + */ +#pragma warning( disable : 4127 ) +#endif + + + +/* #### Code section: utility_code_def ### */ + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030C00A6 + PyObject *current_exception = tstate->current_exception; + if (unlikely(!current_exception)) return 0; + exc_type = (PyObject*) Py_TYPE(current_exception); + if (exc_type == err) return 1; +#else + exc_type = tstate->curexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; +#endif + #if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(exc_type); + #endif + if (unlikely(PyTuple_Check(err))) { + result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + } else { + result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); + } + #if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(exc_type); + #endif + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject *tmp_value; + assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); + if (value) { + #if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) + #endif + PyException_SetTraceback(value, tb); + } + tmp_value = tstate->current_exception; + tstate->current_exception = value; + Py_XDECREF(tmp_value); + Py_XDECREF(type); + Py_XDECREF(tb); +#else + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { +#if PY_VERSION_HEX >= 0x030C00A6 + PyObject* exc_value; + exc_value = tstate->current_exception; + tstate->current_exception = 0; + *value = exc_value; + *type = NULL; + *tb = NULL; + if (exc_value) { + *type = (PyObject*) Py_TYPE(exc_value); + Py_INCREF(*type); + #if CYTHON_COMPILING_IN_CPYTHON + *tb = ((PyBaseExceptionObject*) exc_value)->traceback; + Py_XINCREF(*tb); + #else + *tb = PyException_GetTraceback(exc_value); + #endif + } +#else + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#endif +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#elif CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(!__pyx_m)) { + return NULL; + } + result = PyObject_GetAttr(__pyx_m, name); + if (likely(result)) { + return result; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* decode_c_string */ +static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + const char* cstring, 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)) { + Py_ssize_t length; + if (unlikely((start < 0) | (stop < 0))) { + size_t slen = strlen(cstring); + if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, + "c-string too long to convert to Python"); + return NULL; + } + length = (Py_ssize_t) slen; + if (start < 0) { + start += length; + if (start < 0) + start = 0; + } + if (stop < 0) + 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); + } +} + +/* JoinPyUnicode */ +static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, + Py_UCS4 max_char) { +#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyObject *result_uval; + int result_ukind, kind_shift; + Py_ssize_t i, char_pos; + void *result_udata; + CYTHON_MAYBE_UNUSED_VAR(max_char); +#if CYTHON_PEP393_ENABLED + result_uval = PyUnicode_New(result_ulength, max_char); + if (unlikely(!result_uval)) return NULL; + result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; + kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1; + result_udata = PyUnicode_DATA(result_uval); +#else + result_uval = PyUnicode_FromUnicode(NULL, result_ulength); + if (unlikely(!result_uval)) return NULL; + result_ukind = sizeof(Py_UNICODE); + kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1; + result_udata = PyUnicode_AS_UNICODE(result_uval); +#endif + assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0); + char_pos = 0; + for (i=0; i < value_count; i++) { + int ukind; + Py_ssize_t ulength; + void *udata; + PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); + if (unlikely(__Pyx_PyUnicode_READY(uval))) + goto bad; + ulength = __Pyx_PyUnicode_GET_LENGTH(uval); + if (unlikely(!ulength)) + continue; + if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos)) + goto overflow; + ukind = __Pyx_PyUnicode_KIND(uval); + udata = __Pyx_PyUnicode_DATA(uval); + if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { + memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift)); + } else { + #if PY_VERSION_HEX >= 0x030d0000 + if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad; + #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) + _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); + #else + Py_ssize_t j; + for (j=0; j < ulength; j++) { + Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); + __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); + } + #endif + } + char_pos += ulength; + } + return result_uval; +overflow: + PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); +bad: + Py_DECREF(result_uval); + return NULL; +#else + CYTHON_UNUSED_VAR(max_char); + CYTHON_UNUSED_VAR(result_ulength); + CYTHON_UNUSED_VAR(value_count); + return PyUnicode_Join(__pyx_empty_unicode, value_tuple); +#endif +} + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { + return NULL; + } + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) { + return NULL; + } + #endif + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + #endif + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + #endif + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectFastCall */ +#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API +static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { + PyObject *argstuple; + PyObject *result = 0; + size_t i; + argstuple = PyTuple_New((Py_ssize_t)nargs); + if (unlikely(!argstuple)) return NULL; + for (i = 0; i < nargs; i++) { + Py_INCREF(args[i]); + if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; + } + result = __Pyx_PyObject_Call(func, argstuple, kwargs); + bad: + Py_DECREF(argstuple); + return result; +} +#endif +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { + Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); +#if CYTHON_COMPILING_IN_CPYTHON + if (nargs == 0 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) + return __Pyx_PyObject_CallMethO(func, NULL); + } + else if (nargs == 1 && kwargs == NULL) { + if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) + return __Pyx_PyObject_CallMethO(func, args[0]); + } +#endif + #if PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if PY_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, NULL); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, NULL); + } + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); + } + #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API + return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); + #else + return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); + #endif +} + +/* 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 + +/* GetException */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +#else +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) +#endif +{ + PyObject *local_type = NULL, *local_value, *local_tb = NULL; +#if CYTHON_FAST_THREAD_STATE + PyObject *tmp_type, *tmp_value, *tmp_tb; + #if PY_VERSION_HEX >= 0x030C00A6 + local_value = tstate->current_exception; + tstate->current_exception = 0; + if (likely(local_value)) { + local_type = (PyObject*) Py_TYPE(local_value); + Py_INCREF(local_type); + local_tb = PyException_GetTraceback(local_value); + } + #else + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + #endif +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6 + if (unlikely(tstate->current_exception)) +#elif CYTHON_FAST_THREAD_STATE + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; + } + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_FAST_THREAD_STATE + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + #if PY_VERSION_HEX >= 0x030B00a4 + tmp_value = exc_info->exc_value; + exc_info->exc_value = local_value; + tmp_type = NULL; + tmp_tb = NULL; + Py_XDECREF(local_type); + Py_XDECREF(local_tb); + #else + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + #endif + } + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; +} + +/* PyObjectFormatAndDecref */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) { + if (unlikely(!s)) return NULL; + if (likely(PyUnicode_CheckExact(s))) return s; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(s))) { + PyObject *result = PyUnicode_FromEncodedObject(s, NULL, "strict"); + Py_DECREF(s); + return result; + } + #endif + return __Pyx_PyObject_FormatAndDecref(s, f); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) { + PyObject *result; + if (unlikely(!s)) return NULL; + result = PyObject_Format(s, f); + Py_DECREF(s); + return result; +} + +/* PyObjectLookupSpecial */ +#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) { + PyObject *res; + PyTypeObject *tp = Py_TYPE(obj); +#if PY_MAJOR_VERSION < 3 + if (unlikely(PyInstance_Check(obj))) + return with_error ? __Pyx_PyObject_GetAttrStr(obj, attr_name) : __Pyx_PyObject_GetAttrStrNoError(obj, attr_name); +#endif + res = _PyType_Lookup(tp, attr_name); + if (likely(res)) { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (!f) { + Py_INCREF(res); + } else { + res = f(res, obj, (PyObject *)tp); + } + } else if (with_error) { + PyErr_SetObject(PyExc_AttributeError, attr_name); + } + return res; +} +#endif + +/* WriteUnraisableException */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_PyThreadState_declare +#ifdef WITH_THREAD + PyGILState_STATE state; + if (nogil) + state = PyGILState_Ensure(); + else state = (PyGILState_STATE)0; +#endif + CYTHON_UNUSED_VAR(clineno); + CYTHON_UNUSED_VAR(lineno); + CYTHON_UNUSED_VAR(filename); + CYTHON_MAYBE_UNUSED_VAR(nogil); + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +#ifdef WITH_THREAD + if (nogil) + PyGILState_Release(state); +#endif +} + +/* TupleAndListFromArray */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { + PyObject *v; + Py_ssize_t i; + for (i = 0; i < length; i++) { + v = dest[i] = src[i]; + Py_INCREF(v); + } +} +static CYTHON_INLINE PyObject * +__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + Py_INCREF(__pyx_empty_tuple); + return __pyx_empty_tuple; + } + res = PyTuple_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); + return res; +} +static CYTHON_INLINE PyObject * +__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) +{ + PyObject *res; + if (n <= 0) { + return PyList_New(0); + } + res = PyList_New(n); + if (unlikely(res == NULL)) return NULL; + __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); + return res; +} +#endif + +/* BytesEquals */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); + if (unlikely(eq != 0)) { + if (unlikely(eq < 0)) return NULL; // error + return kwvalues[i]; + } + } + return NULL; // not found (no exception set) +} +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 +CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames); + PyObject *dict; + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; i= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); // transfer ownership of value to values + Py_DECREF(key); +#endif + key = NULL; + value = NULL; + continue; + } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = ( + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key) + ); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; // ownership transferred to values +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + Py_XDECREF(key); + Py_XDECREF(value); + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + Py_XDECREF(key); + Py_XDECREF(value); + return -1; } -#endif -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; } - return result; -} - -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif + if (exact) { + more_or_less = "exactly"; } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); } -#endif -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; #else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + Py_ssize_t kwsize; +#if CYTHON_ASSUME_SAFE_MACROS + kwsize = PyTuple_GET_SIZE(kw); #else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); + kwsize = PyTuple_Size(kw); + if (kwsize < 0) return 0; #endif - return __Pyx_GetBuiltinName(name); -} - -/* decode_c_string */ -static CYTHON_INLINE PyObject* __Pyx_decode_c_string( - const char* cstring, 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)) { - Py_ssize_t length; - if (unlikely((start < 0) | (stop < 0))) { - size_t slen = strlen(cstring); - if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { - PyErr_SetString(PyExc_OverflowError, - "c-string too long to convert to Python"); - return NULL; - } - length = (Py_ssize_t) slen; - if (start < 0) { - start += length; - if (start < 0) - start = 0; - } - if (stop < 0) - 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); - } -} - -/* JoinPyUnicode */ -static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength, - CYTHON_UNUSED Py_UCS4 max_char) { -#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - PyObject *result_uval; - int result_ukind; - Py_ssize_t i, char_pos; - void *result_udata; -#if CYTHON_PEP393_ENABLED - result_uval = PyUnicode_New(result_ulength, max_char); - if (unlikely(!result_uval)) return NULL; - result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND; - result_udata = PyUnicode_DATA(result_uval); + if (unlikely(kwsize == 0)) + return 1; + if (!kw_allowed) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, 0); #else - result_uval = PyUnicode_FromUnicode(NULL, result_ulength); - if (unlikely(!result_uval)) return NULL; - result_ukind = sizeof(Py_UNICODE); - result_udata = PyUnicode_AS_UNICODE(result_uval); + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; #endif - char_pos = 0; - for (i=0; i < value_count; i++) { - int ukind; - Py_ssize_t ulength; - void *udata; - PyObject *uval = PyTuple_GET_ITEM(value_tuple, i); - if (unlikely(__Pyx_PyUnicode_READY(uval))) - goto bad; - ulength = __Pyx_PyUnicode_GET_LENGTH(uval); - if (unlikely(!ulength)) - continue; - if (unlikely(char_pos + ulength < 0)) - goto overflow; - ukind = __Pyx_PyUnicode_KIND(uval); - udata = __Pyx_PyUnicode_DATA(uval); - if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) { - memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind)); - } else { - #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters) - _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength); - #else - Py_ssize_t j; - for (j=0; j < ulength; j++) { - Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j); - __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar); - } - #endif + goto invalid_keyword; } - char_pos += ulength; - } - return result_uval; -overflow: - PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string"); -bad: - Py_DECREF(result_uval); - return NULL; +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < kwsize; pos++) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); #else - result_ulength++; - value_count++; - return PyUnicode_Join(__pyx_empty_unicode, value_tuple); + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; #endif -} - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); - } -} + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } #endif - -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; + return 1; } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; #endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } #endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; } } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; } - else { - d = NULL; - nd = 0; + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); + PyErr_SetObject(type, value); + if (tb) { + #if PY_VERSION_HEX >= 0x030C00A6 + PyException_SetTraceback(value, tb); + #elif CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } #else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); #endif - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); } - return result; +bad: + Py_XDECREF(owned_instance); + return; } #endif -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); } -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) +/* PyObjectFormat */ +#if CYTHON_USE_UNICODE_WRITER +static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { + int ret; + _PyUnicodeWriter writer; + if (likely(PyFloat_CheckExact(obj))) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000 + _PyUnicodeWriter_Init(&writer, 0); +#else + _PyUnicodeWriter_Init(&writer); +#endif + ret = _PyFloat_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else if (likely(PyLong_CheckExact(obj))) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000 + _PyUnicodeWriter_Init(&writer, 0); +#else + _PyUnicodeWriter_Init(&writer); +#endif + ret = _PyLong_FormatAdvancedWriter( + &writer, + obj, + format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); + } else { + return PyObject_Format(obj, format_spec); + } + if (unlikely(ret == -1)) { + _PyUnicodeWriter_Dealloc(&writer); return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); } - return result; + return _PyUnicodeWriter_Finish(&writer); } #endif -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } +/* FixUpExtensionType */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + if (strcmp(memb->name, "__weaklistoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_weaklistoffset = memb->offset; + changed = 1; + } + else if (strcmp(memb->name, "__dictoffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); + type->tp_dictoffset = memb->offset; + changed = 1; + } +#if CYTHON_METH_FASTCALL + else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { + assert(memb->type == T_PYSSIZET); + assert(memb->flags == READONLY); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } #endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + else if (strcmp(memb->name, "__module__") == 0) { + PyObject *descr; + assert(memb->type == T_OBJECT); + assert(memb->flags == 0 || memb->flags == READONLY); + descr = PyDescr_NewMember(type, memb); + if (unlikely(!descr)) + return -1; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } #endif + } + memb++; } + if (changed) + PyType_Modified(type); } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; +#endif + return 0; } #endif /* PyObjectCallNoArg */ -#if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); + PyObject *arg[2] = {NULL, NULL}; + return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* PyObjectGetMethod */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __Pyx_TypeName type_name; + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR + if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) +#elif PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) + #endif #else - if (likely(PyCFunction_Check(func))) + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif #endif - { - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } } } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); #endif - -/* GetTopmostException */ -#if CYTHON_USE_EXC_INFO_STACK -static _PyErr_StackItem * -__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) -{ - _PyErr_StackItem *exc_info = tstate->exc_info; - while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && - exc_info->previous_item != NULL) - { - exc_info = exc_info->previous_item; + __Pyx_DECREF_TypeName(type_name); + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; } - 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 - _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); - *type = exc_info->exc_type; - *value = exc_info->exc_value; - *tb = exc_info->exc_traceback; - #else - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - #endif - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); + *method = attr; + return 0; } -static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - 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); + +/* PyObjectCallMethod0 */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; } -#endif -/* GetException */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) +/* ValidateBasesTuple */ +#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS +static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { + Py_ssize_t i, n; +#if CYTHON_ASSUME_SAFE_MACROS + n = PyTuple_GET_SIZE(bases); #else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) + n = PyTuple_Size(bases); + if (n < 0) return -1; #endif -{ - PyObject *local_type, *local_value, *local_tb; -#if CYTHON_FAST_THREAD_STATE - PyObject *tmp_type, *tmp_value, *tmp_tb; - local_type = tstate->curexc_type; - local_value = tstate->curexc_value; - local_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; + for (i = 1; i < n; i++) + { +#if CYTHON_AVOID_BORROWED_REFS + PyObject *b0 = PySequence_GetItem(bases, i); + if (!b0) return -1; +#elif CYTHON_ASSUME_SAFE_MACROS + PyObject *b0 = PyTuple_GET_ITEM(bases, i); #else - PyErr_Fetch(&local_type, &local_value, &local_tb); + PyObject *b0 = PyTuple_GetItem(bases, i); + if (!b0) return -1; #endif - PyErr_NormalizeException(&local_type, &local_value, &local_tb); -#if CYTHON_FAST_THREAD_STATE - if (unlikely(tstate->curexc_type)) -#else - if (unlikely(PyErr_Occurred())) + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); #endif - goto bad; - #if PY_MAJOR_VERSION >= 3 - if (local_tb) { - if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) - goto bad; - } - #endif - Py_XINCREF(local_tb); - Py_XINCREF(local_type); - Py_XINCREF(local_value); - *type = local_type; - *value = local_value; - *tb = local_tb; -#if CYTHON_FAST_THREAD_STATE - #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 = local_type; - exc_info->exc_value = local_value; - exc_info->exc_traceback = local_tb; - } - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); + __Pyx_DECREF_TypeName(b_name); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + if (dictoffset == 0) + { + Py_ssize_t b_dictoffset = 0; +#if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + b_dictoffset = b->tp_dictoffset; #else - PyErr_SetExcInfo(local_type, local_value, local_tb); + PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__"); + if (!py_b_dictoffset) goto dictoffset_return; + b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset); + Py_DECREF(py_b_dictoffset); + if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return; +#endif + if (b_dictoffset) { + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(b); + PyErr_Format(PyExc_TypeError, + "extension type '%.200s' has no __dict__ slot, " + "but base type '" __Pyx_FMT_TYPENAME "' has: " + "either add 'cdef dict __dict__' to the extension type " + "or add '__slots__ = [...]' to the base type", + type_name, b_name); + __Pyx_DECREF_TypeName(b_name); + } +#if !(CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY) + dictoffset_return: +#endif +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } + } +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); #endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; -} - -/* PyObjectFormatAndDecref */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatSimpleAndDecref(PyObject* s, PyObject* f) { - if (unlikely(!s)) return NULL; - if (likely(PyUnicode_CheckExact(s))) return s; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(s))) { - PyObject *result = PyUnicode_FromEncodedObject(s, NULL, "strict"); - Py_DECREF(s); - return result; } - #endif - return __Pyx_PyObject_FormatAndDecref(s, f); -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_FormatAndDecref(PyObject* s, PyObject* f) { - PyObject *result = PyObject_Format(s, f); - Py_DECREF(s); - return result; + return 0; } +#endif -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} +/* PyType_Ready */ +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) + (void)__Pyx_PyObject_CallMethod0; +#if CYTHON_USE_TYPE_SPECS + (void)__Pyx_validate_bases_tuple; +#endif + return PyType_Ready(t); +#else + int r; + PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); + if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) + return -1; +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + { + int gc_was_enabled; + #if PY_VERSION_HEX >= 0x030A00b1 + gc_was_enabled = PyGC_Disable(); + (void)__Pyx_PyObject_CallMethod0; + #else + PyObject *ret, *py_status; + PyObject *gc = NULL; + #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); + if (unlikely(!py_status)) { + Py_DECREF(gc); + return -1; + } + gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); + Py_DECREF(py_status); + if (gc_was_enabled > 0) { + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); + if (unlikely(!ret)) { + Py_DECREF(gc); + return -1; + } + Py_DECREF(ret); + } else if (unlikely(gc_was_enabled == -1)) { + Py_DECREF(gc); + return -1; + } + #endif + t->tp_flags |= Py_TPFLAGS_HEAPTYPE; +#if PY_VERSION_HEX >= 0x030A0000 + t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; #endif - -/* WriteUnraisableException */ -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; +#else + (void)__Pyx_PyObject_CallMethod0; +#endif + r = PyType_Ready(t); +#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) + t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; + #if PY_VERSION_HEX >= 0x030A00b1 + if (gc_was_enabled) + PyGC_Enable(); + #else + if (gc_was_enabled) { + PyObject *tp, *v, *tb; + PyErr_Fetch(&tp, &v, &tb); + ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); + if (likely(ret || r == -1)) { + Py_XDECREF(ret); + PyErr_Restore(tp, v, tb); + } else { + Py_XDECREF(tp); + Py_XDECREF(v); + Py_XDECREF(tb); + r = -1; + } + } + Py_DECREF(gc); + #endif + } #endif + return r; #endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); +} + +/* PyObject_GenericGetAttrNoDict */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); +#endif + __Pyx_DECREF_TypeName(type_name); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); + } + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); } + Py_INCREF(descr); #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); + { + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; + } } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); + return descr; +} #endif + +/* PyObject_GenericGetAttr */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { + if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { + return PyObject_GenericGetAttr(obj, attr_name); + } + return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); } +#endif -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif +/* SetVTable */ +static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) { + PyObject *ob = PyCapsule_New(vtable, 0, 0); + if (unlikely(!ob)) + goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0)) +#else + if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0)) +#endif + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; } -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; +/* GetVTable */ +static void* __Pyx_GetVtable(PyTypeObject *type) { + void* ptr; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable); +#else + PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable); +#endif + if (!ob) + goto bad; + ptr = PyCapsule_GetPointer(ob, 0); + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +/* MergeVTables */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_MergeVtables(PyTypeObject *type) { + int i; + void** base_vtables; + __Pyx_TypeName tp_base_name; + __Pyx_TypeName base_name; + void* unknown = (void*)-1; + PyObject* bases = type->tp_bases; + int base_depth = 0; + { + PyTypeObject* base = type->tp_base; + while (base) { + base_depth += 1; + base = base->tp_base; } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; + } + base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1)); + base_vtables[0] = unknown; + for (i = 1; i < PyTuple_GET_SIZE(bases); i++) { + void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i))); + if (base_vtable != NULL) { + int j; + PyTypeObject* base = type->tp_base; + for (j = 0; j < base_depth; j++) { + if (base_vtables[j] == unknown) { + base_vtables[j] = __Pyx_GetVtable(base); + base_vtables[j + 1] = unknown; } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; + if (base_vtables[j] == base_vtable) { break; + } else if (base_vtables[j] == NULL) { + goto bad; } - name++; + base = base->tp_base; } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; + } + } + PyErr_Clear(); + free(base_vtables); + return 0; +bad: + tp_base_name = __Pyx_PyType_GetName(type->tp_base); + base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i)); + PyErr_Format(PyExc_TypeError, + "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name); + __Pyx_DECREF_TypeName(tp_base_name); + __Pyx_DECREF_TypeName(base_name); + free(base_vtables); + return -1; +} +#endif + +/* SetupReduce */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); +#else + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (getstate) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); +#else + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (object_getstate != getstate) { + goto __PYX_GOOD; + } + } +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); + if (likely(reduce_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); + if (likely(setstate_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; } } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + PyType_Modified((PyTypeObject*)type_obj); } } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((PyTypeObject*)type_obj); + PyErr_Format(PyExc_RuntimeError, + "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name); + __Pyx_DECREF_TypeName(type_obj_name); } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); + ret = -1; +__PYX_GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); + Py_XDECREF(object_getstate); + Py_XDECREF(getstate); +#endif + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; } +#endif -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_0_6 +#define __PYX_HAVE_RT_ImportType_3_0_6 +static PyTypeObject *__Pyx_ImportType_3_0_6(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_6 check_size) +{ + PyObject *result = 0; + char warning[200]; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + PyObject *py_itemsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } +#if !CYTHON_COMPILING_IN_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; #endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); goto bad; } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_6 && + ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd-%zd from PyObject", + module_name, class_name, size, basicsize, basicsize+itemsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_6 && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; +} +#endif + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) + goto bad; + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; + from_list = empty_list; + } + #endif + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.') != NULL) { + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); } } + level = 0; } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) goto bad; - } + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + return module; +} + +/* ImportDottedModule */ +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) { + PyObject *partial_name = NULL, *slice = NULL, *sep = NULL; + if (unlikely(PyErr_Occurred())) { + PyErr_Clear(); + } + if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) { + partial_name = name; + } else { + slice = PySequence_GetSlice(parts_tuple, 0, count); + if (unlikely(!slice)) goto bad; - } - PyException_SetCause(value, fixed_cause); + sep = PyUnicode_FromStringAndSize(".", 1); + if (unlikely(!sep)) + goto bad; + partial_name = PyUnicode_Join(sep, slice); } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); + PyErr_Format( +#if PY_MAJOR_VERSION < 3 + PyExc_ImportError, + "No module named '%s'", PyString_AS_STRING(partial_name)); #else - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } +#if PY_VERSION_HEX >= 0x030600B1 + PyExc_ModuleNotFoundError, +#else + PyExc_ImportError, +#endif + "No module named '%U'", partial_name); #endif - } bad: - Py_XDECREF(owned_instance); - return; + Py_XDECREF(sep); + Py_XDECREF(slice); + Py_XDECREF(partial_name); + return NULL; } #endif - -/* BytesEquals */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) { + PyObject *imported_module; +#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + PyObject *modules = PyImport_GetModuleDict(); + if (unlikely(!modules)) + return NULL; + imported_module = __Pyx_PyDict_GetItemStr(modules, name); + Py_XINCREF(imported_module); #else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } + imported_module = PyImport_GetModule(name); #endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); + return imported_module; +} +#endif +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) { + Py_ssize_t i, nparts; + nparts = PyTuple_GET_SIZE(parts_tuple); + for (i=1; i < nparts && module; i++) { + PyObject *part, *submodule; +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + part = PyTuple_GET_ITEM(parts_tuple, i); +#else + part = PySequence_ITEM(parts_tuple, i); +#endif + submodule = __Pyx_PyObject_GetAttrStrNoError(module, part); +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(part); +#endif + Py_DECREF(module); + module = submodule; + } + if (unlikely(!module)) { + return __Pyx__ImportDottedModule_Error(name, parts_tuple, i); + } + return module; +} +#endif +static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if PY_MAJOR_VERSION < 3 + PyObject *module, *from_list, *star = __pyx_n_s__8; + CYTHON_UNUSED_VAR(parts_tuple); + from_list = PyList_New(1); + if (unlikely(!from_list)) + return NULL; + Py_INCREF(star); + PyList_SET_ITEM(from_list, 0, star); + module = __Pyx_Import(name, from_list, 0); + Py_DECREF(from_list); + return module; +#else + PyObject *imported_module; + PyObject *module = __Pyx_Import(name, NULL, 0); + if (!parts_tuple || unlikely(!module)) + return module; + imported_module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(imported_module)) { + Py_DECREF(module); + return imported_module; + } + PyErr_Clear(); + return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple); +#endif +} +static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1 + PyObject *module = __Pyx__ImportDottedModule_Lookup(name); + if (likely(module)) { + PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec); + if (likely(spec)) { + PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing); + if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) { + Py_DECREF(spec); + spec = NULL; + } + Py_XDECREF(unsafe); } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; + if (likely(!spec)) { + PyErr_Clear(); + return module; + } + Py_DECREF(spec); + Py_DECREF(module); + } else if (PyErr_Occurred()) { + PyErr_Clear(); } #endif + return __Pyx__ImportDottedModule(name, parts_tuple); } -/* UnicodeEquals */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); +/* CalculateMetaclass */ +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + Py_ssize_t i, nbases; +#if CYTHON_ASSUME_SAFE_MACROS + nbases = PyTuple_GET_SIZE(bases); +#else + nbases = PyTuple_Size(bases); + if (nbases < 0) return NULL; +#endif + for (i=0; i < nbases; i++) { + PyTypeObject *tmptype; +#if CYTHON_ASSUME_SAFE_MACROS + PyObject *tmp = PyTuple_GET_ITEM(bases, i); #else + PyObject *tmp = PyTuple_GetItem(bases, i); + if (!tmp) return NULL; +#endif + tmptype = Py_TYPE(tmp); #if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; + if (tmptype == &PyClass_Type) + continue; #endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; + if (!metaclass) { + metaclass = tmptype; + continue; + } + if (PyType_IsSubtype(metaclass, tmptype)) + continue; + if (PyType_IsSubtype(tmptype, metaclass)) { + metaclass = tmptype; + continue; + } + PyErr_SetString(PyExc_TypeError, + "metaclass conflict: " + "the metaclass of a derived class " + "must be a (non-strict) subclass " + "of the metaclasses of all its bases"); + return NULL; } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); + if (!metaclass) { #if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); + metaclass = &PyClass_Type; +#else + metaclass = &PyType_Type; +#endif + } + Py_INCREF((PyObject*) metaclass); + return (PyObject*) metaclass; +} + +/* PyObjectCall2Args */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args[3] = {NULL, arg1, arg2}; + return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + +/* Py3ClassCreate */ +static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, + PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { + PyObject *ns; + if (metaclass) { + PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_n_s_prepare_2); + if (prep) { + PyObject *pargs[3] = {NULL, name, bases}; + ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw); + Py_DECREF(prep); + } else { + if (unlikely(PyErr_Occurred())) + return NULL; + ns = PyDict_New(); + } + } else { + ns = PyDict_New(); } + if (unlikely(!ns)) + return NULL; + if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; +#if PY_VERSION_HEX >= 0x03030000 + if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; +#else + CYTHON_MAYBE_UNUSED_VAR(qualname); #endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; + if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; + return ns; +bad: + Py_DECREF(ns); + return NULL; +} +#if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS +static int __Pyx_SetNamesPEP487(PyObject *type_obj) { + PyTypeObject *type = (PyTypeObject*) type_obj; + PyObject *names_to_set, *key, *value, *set_name, *tmp; + Py_ssize_t i = 0; +#if CYTHON_USE_TYPE_SLOTS + names_to_set = PyDict_Copy(type->tp_dict); +#else + { + PyObject *d = PyObject_GetAttr(type_obj, __pyx_n_s_dict); + names_to_set = NULL; + if (likely(d)) { + PyObject *names_to_set = PyDict_New(); + int ret = likely(names_to_set) ? PyDict_Update(names_to_set, d) : -1; + Py_DECREF(d); + if (unlikely(ret < 0)) + Py_CLEAR(names_to_set); } -#if CYTHON_USE_UNICODE_INTERNALS - { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; - #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; + } +#endif + if (unlikely(names_to_set == NULL)) + goto bad; + while (PyDict_Next(names_to_set, &i, &key, &value)) { + set_name = __Pyx_PyObject_LookupSpecialNoError(value, __pyx_n_s_set_name); + if (unlikely(set_name != NULL)) { + tmp = __Pyx_PyObject_Call2Args(set_name, type_obj, key); + Py_DECREF(set_name); + if (unlikely(tmp == NULL)) { + __Pyx_TypeName value_type_name = + __Pyx_PyType_GetName(Py_TYPE(value)); + __Pyx_TypeName type_name = __Pyx_PyType_GetName(type); + PyErr_Format(PyExc_RuntimeError, +#if PY_MAJOR_VERSION >= 3 + "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %R " "in '" __Pyx_FMT_TYPENAME "'", + value_type_name, key, type_name); +#else + "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %.100s in '" __Pyx_FMT_TYPENAME "'", + value_type_name, + PyString_Check(key) ? PyString_AS_STRING(key) : "?", + type_name); +#endif + goto bad; + } else { + Py_DECREF(tmp); + } + } + else if (unlikely(PyErr_Occurred())) { + goto bad; + } + } + Py_DECREF(names_to_set); + return 0; +bad: + Py_XDECREF(names_to_set); + return -1; +} +static PyObject *__Pyx_InitSubclassPEP487(PyObject *type_obj, PyObject *mkw) { +#if CYTHON_USE_TYPE_SLOTS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyTypeObject *type = (PyTypeObject*) type_obj; + PyObject *mro = type->tp_mro; + Py_ssize_t i, nbases; + if (unlikely(!mro)) goto done; + (void) &__Pyx_GetBuiltinName; + Py_INCREF(mro); + nbases = PyTuple_GET_SIZE(mro); + assert(PyTuple_GET_ITEM(mro, 0) == type_obj); + for (i = 1; i < nbases-1; i++) { + PyObject *base, *dict, *meth; + base = PyTuple_GET_ITEM(mro, i); + dict = ((PyTypeObject *)base)->tp_dict; + meth = __Pyx_PyDict_GetItemStrWithError(dict, __pyx_n_s_init_subclass); + if (unlikely(meth)) { + descrgetfunc f = Py_TYPE(meth)->tp_descr_get; + PyObject *res; + Py_INCREF(meth); + if (likely(f)) { + res = f(meth, NULL, type_obj); + Py_DECREF(meth); + if (unlikely(!res)) goto bad; + meth = res; } + res = __Pyx_PyObject_FastCallDict(meth, NULL, 0, mkw); + Py_DECREF(meth); + if (unlikely(!res)) goto bad; + Py_DECREF(res); + goto done; + } else if (unlikely(PyErr_Occurred())) { + goto bad; } + } +done: + Py_XDECREF(mro); + return type_obj; +bad: + Py_XDECREF(mro); + Py_DECREF(type_obj); + return NULL; +#else + PyObject *super_type, *super, *func, *res; +#if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type) + super_type = __Pyx_GetBuiltinName(__pyx_n_s_super); +#else + super_type = (PyObject*) &PySuper_Type; + (void) &__Pyx_GetBuiltinName; #endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; + super = likely(super_type) ? __Pyx_PyObject_Call2Args(super_type, type_obj, type_obj) : NULL; +#if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type) + Py_XDECREF(super_type); +#endif + if (unlikely(!super)) { + Py_CLEAR(type_obj); + goto done; + } + func = __Pyx_PyObject_GetAttrStrNoError(super, __pyx_n_s_init_subclass); + Py_DECREF(super); + if (likely(!func)) { + if (unlikely(PyErr_Occurred())) + Py_CLEAR(type_obj); + goto done; + } + res = __Pyx_PyObject_FastCallDict(func, NULL, 0, mkw); + Py_DECREF(func); + if (unlikely(!res)) + Py_CLEAR(type_obj); + Py_XDECREF(res); +done: + return type_obj; +#endif +} +#endif +static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, + PyObject *dict, PyObject *mkw, + int calculate_metaclass, int allow_py2_metaclass) { + PyObject *result; + PyObject *owned_metaclass = NULL; + PyObject *margs[4] = {NULL, name, bases, dict}; + if (allow_py2_metaclass) { + owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); + if (owned_metaclass) { + metaclass = owned_metaclass; + } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { + PyErr_Clear(); + } else { + return NULL; } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; + } + if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { + metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); + Py_XDECREF(owned_metaclass); + if (unlikely(!metaclass)) + return NULL; + owned_metaclass = metaclass; + } + result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, +#if PY_VERSION_HEX < 0x030600A4 + (metaclass == (PyObject*)&PyType_Type) ? NULL : mkw +#else + mkw +#endif + ); + Py_XDECREF(owned_metaclass); +#if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS + if (likely(result) && likely(PyType_Check(result))) { + if (unlikely(__Pyx_SetNamesPEP487(result) < 0)) { + Py_CLEAR(result); } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); + result = __Pyx_InitSubclassPEP487(result, mkw); } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); +#else + (void) &__Pyx_GetBuiltinName; #endif + return result; } -/* PyObjectFormat */ -#if CYTHON_USE_UNICODE_WRITER -static PyObject* __Pyx_PyObject_Format(PyObject* obj, PyObject* format_spec) { - int ret; - _PyUnicodeWriter writer; - if (likely(PyFloat_CheckExact(obj))) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000 - _PyUnicodeWriter_Init(&writer, 0); +/* FetchSharedCythonModule */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType */ +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { + goto bad; + } + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} #else - _PyUnicodeWriter_Init(&writer); -#endif - ret = _PyFloat_FormatAdvancedWriter( - &writer, - obj, - format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); - } else if (likely(PyLong_CheckExact(obj))) { -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x03040000 - _PyUnicodeWriter_Init(&writer, 0); +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; #else - _PyUnicodeWriter_Init(&writer); + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; #endif - ret = _PyLong_FormatAdvancedWriter( - &writer, - obj, - format_spec, 0, PyUnicode_GET_LENGTH(format_spec)); - } else { - return PyObject_Format(obj, format_spec); + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { + goto bad; + } + goto done; } - if (unlikely(ret == -1)) { - _PyUnicodeWriter_Dealloc(&writer); + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); + if (unlikely(!cached_type)) goto bad; + if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; +done: + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#endif + +/* PyVectorcallFastCallDict */ +#if CYTHON_METH_FASTCALL +static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + PyObject *res = NULL; + PyObject *kwnames; + PyObject **newargs; + PyObject **kwvalues; + Py_ssize_t i, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); + if (unlikely(newargs == NULL)) { + PyErr_NoMemory(); return NULL; } - return _PyUnicodeWriter_Finish(&writer); + for (j = 0; j < nargs; j++) newargs[j] = args[j]; + kwnames = PyTuple_New(nkw); + if (unlikely(kwnames == NULL)) { + PyMem_Free(newargs); + return NULL; + } + kwvalues = newargs + nargs; + pos = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + kwvalues[i] = value; + i++; + } + if (unlikely(!keys_are_strings)) { + PyErr_SetString(PyExc_TypeError, "keywords must be strings"); + goto cleanup; + } + res = vc(func, newargs, nargs, kwnames); +cleanup: + Py_DECREF(kwnames); + for (i = 0; i < nkw; i++) + Py_DECREF(kwvalues[i]); + PyMem_Free(newargs); + return res; +} +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); } #endif -/* PyObject_GenericGetAttrNoDict */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'%.50s' object has no attribute '%U'", - tp->tp_name, attr_name); +/* CythonFunctionShared */ +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { + if (__Pyx_CyFunction_Check(func)) { + return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; + } else if (PyCFunction_Check(func)) { + return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; + } + return 0; +} #else - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(attr_name)); +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { + return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; +} +#endif +static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + __Pyx_Py_XDECREF_SET( + __Pyx_CyFunction_GetClassObj(f), + ((classobj) ? __Pyx_NewRef(classobj) : NULL)); +#else + __Pyx_Py_XDECREF_SET( + ((PyCMethodObject *) (f))->mm_class, + (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); #endif - return NULL; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { - PyObject *descr; - PyTypeObject *tp = Py_TYPE(obj); - if (unlikely(!PyString_Check(attr_name))) { - return PyObject_GenericGetAttr(obj, attr_name); - } - assert(!tp->tp_dictoffset); - descr = _PyType_Lookup(tp, attr_name); - if (unlikely(!descr)) { - return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); - } - Py_INCREF(descr); - #if PY_MAJOR_VERSION < 3 - if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) - #endif - { - descrgetfunc f = Py_TYPE(descr)->tp_descr_get; - if (unlikely(f)) { - PyObject *res = f(descr, obj, (PyObject *)tp); - Py_DECREF(descr); - return res; +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) +{ + CYTHON_UNUSED_VAR(closure); + if (unlikely(op->func_doc == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); + if (unlikely(!op->func_doc)) return NULL; +#else + if (((PyCFunctionObject*)op)->m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; } +#endif } - return descr; + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_doc, value); + return 0; } +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#elif PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); #endif - -/* PyObject_GenericGetAttr */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { - if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { - return PyObject_GenericGetAttr(obj, attr_name); + if (unlikely(op->func_name == NULL)) + return NULL; } - return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); + Py_INCREF(op->func_name); + return op->func_name; } +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) #endif - -/* SetVTable */ -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 - PyObject *ob = PyCapsule_New(vtable, 0, 0); + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_name, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) #else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); + if (unlikely(value == NULL || !PyString_Check(value))) #endif - if (!ob) - goto bad; - if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) - goto bad; - Py_DECREF(ob); + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_dict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(op); + CYTHON_UNUSED_VAR(context); + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + CYTHON_UNUSED_VAR(context); + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value) { + value = Py_None; + } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " + "currently affect the values used in function calls", 1); + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); return 0; -bad: - Py_XDECREF(ob); - return -1; } - -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; idefaults_tuple; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } } -#endif - for (i=0; idefaults_kwdict, value); return 0; } -static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { - PyObject *exc_type = tstate->curexc_type; - if (exc_type == err) return 1; - if (unlikely(!exc_type)) return 0; - if (unlikely(PyTuple_Check(err))) - return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); - return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); -} -#endif - -/* PyObjectGetAttrStrNoError */ -static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) - __Pyx_PyErr_Clear(); +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); + if (unlikely(!result)) { + if (op->defaults_getter) { + if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + if (!value || value == Py_None) { + value = NULL; + } else if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + Py_XINCREF(value); + __Pyx_Py_XDECREF_SET(op->func_annotations, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; } + Py_INCREF(result); return result; } - -/* SetupReduce */ -static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { - int ret; - PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name); - if (likely(name_attr)) { - ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); - } else { - ret = -1; - } - if (unlikely(ret < 0)) { - PyErr_Clear(); - ret = 0; - } - Py_XDECREF(name_attr); - return ret; -} -static int __Pyx_setup_reduce(PyObject* type_obj) { - int ret = 0; - PyObject *object_reduce = NULL; - PyObject *object_getstate = NULL; - PyObject *object_reduce_ex = NULL; - PyObject *reduce = NULL; - PyObject *reduce_ex = NULL; - PyObject *reduce_cython = NULL; - PyObject *setstate = NULL; - PyObject *setstate_cython = NULL; - PyObject *getstate = NULL; -#if CYTHON_USE_PYTYPE_LOOKUP - getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); -#else - getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); - if (!getstate && PyErr_Occurred()) { - goto __PYX_BAD; +static PyObject * +__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); } -#endif - if (getstate) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; + fromlist = PyList_New(1); + if (unlikely(!fromlist)) return NULL; + Py_INCREF(marker); +#if CYTHON_ASSUME_SAFE_MACROS + PyList_SET_ITEM(fromlist, 0, marker); #else - object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); - if (!object_getstate && PyErr_Occurred()) { - goto __PYX_BAD; + if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { + Py_DECREF(marker); + Py_DECREF(fromlist); + return NULL; } #endif - if (object_getstate != getstate) { - goto __PYX_GOOD; + module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); } +ignore: + PyErr_Clear(); } -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject * +__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_GetAttrString(op->func, "__module__"); +} +static int +__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { + CYTHON_UNUSED_VAR(context); + return PyObject_SetAttrString(op->func, "__module__", value); +} +#endif +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, +#if CYTHON_COMPILING_IN_LIMITED_API + {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, +#endif + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, #else - object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, #endif - reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; - if (reduce_ex == object_reduce_ex) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, #else - object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, #endif - reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; - if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { - reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); - if (likely(reduce_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (reduce == object_reduce || PyErr_Occurred()) { - goto __PYX_BAD; - } - setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); - if (!setstate) PyErr_Clear(); - if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { - setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); - if (likely(setstate_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (!setstate || PyErr_Occurred()) { - goto __PYX_BAD; - } - } - PyType_Modified((PyTypeObject*)type_obj); - } - } - goto __PYX_GOOD; -__PYX_BAD: - if (!PyErr_Occurred()) - PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); - ret = -1; -__PYX_GOOD: -#if !CYTHON_USE_PYTYPE_LOOKUP - Py_XDECREF(object_reduce); - Py_XDECREF(object_reduce_ex); - Py_XDECREF(object_getstate); - Py_XDECREF(getstate); #endif - Py_XDECREF(reduce); - Py_XDECREF(reduce_ex); - Py_XDECREF(reduce_cython); - Py_XDECREF(setstate); - Py_XDECREF(setstate_cython); - return ret; -} - -/* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, - size_t size, enum __Pyx_ImportType_CheckSize check_size) + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) { - PyObject *result = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - result = PyObject_GetAttrString(module, class_name); - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; + CYTHON_UNUSED_VAR(args); +#if PY_MAJOR_VERSION >= 3 + Py_INCREF(m->func_qualname); + return m->func_qualname; #else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); #endif - if ((size_t)basicsize < size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; - } - if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - goto bad; - } - else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(result); - return NULL; } +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) +#else +#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) #endif - -/* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; +static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { +#if !CYTHON_COMPILING_IN_LIMITED_API + PyCFunctionObject *cf = (PyCFunctionObject*) op; +#endif + if (unlikely(op == NULL)) + return NULL; +#if CYTHON_COMPILING_IN_LIMITED_API + op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); + if (unlikely(!op->func)) return NULL; +#endif + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; +#if !CYTHON_COMPILING_IN_LIMITED_API + cf->m_ml = ml; + cf->m_self = (PyObject *) op; +#endif + Py_XINCREF(closure); + op->func_closure = closure; +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_XINCREF(module); + cf->m_module = module; +#endif + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + op->func_classobj = NULL; +#else + ((PyCMethodObject*)op)->mm_class = NULL; +#endif + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults_size = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + op->func_is_coroutine = NULL; +#if CYTHON_METH_FASTCALL + switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { + case METH_NOARGS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; + break; + case METH_O: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; + break; + case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; + break; + case METH_FASTCALL | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; + break; + case METH_VARARGS | METH_KEYWORDS: + __Pyx_CyFunction_func_vectorcall(op) = NULL; + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + Py_DECREF(op); + return NULL; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; +#endif + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_CLEAR(m->func); +#else + Py_CLEAR(((PyCFunctionObject*)m)->m_module); +#endif + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API +#if PY_VERSION_HEX < 0x030900B1 + Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); +#else { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } + PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; + ((PyCMethodObject *) (m))->mm_class = NULL; + Py_XDECREF(cls); + } +#endif +#endif + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + Py_CLEAR(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; + return 0; } - -/* CalculateMetaclass */ -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { - Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); - for (i=0; i < nbases; i++) { - PyTypeObject *tmptype; - PyObject *tmp = PyTuple_GET_ITEM(bases, i); - tmptype = Py_TYPE(tmp); -#if PY_MAJOR_VERSION < 3 - if (tmptype == &PyClass_Type) - continue; +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __Pyx_PyHeapTypeObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); +#if !CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); +#endif + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + Py_VISIT(m->func_is_coroutine); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyObject *py_name = NULL; + PyCFunction meth; + int flags; + meth = PyCFunction_GetFunction(f); + if (unlikely(!meth)) return NULL; + flags = PyCFunction_GetFlags(f); + if (unlikely(flags < 0)) return NULL; +#else + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + int flags = f->m_ml->ml_flags; +#endif + Py_ssize_t size; + switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 0)) + return (*meth)(self, NULL); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); #endif - if (!metaclass) { - metaclass = tmptype; - continue; + return NULL; } - if (PyType_IsSubtype(metaclass, tmptype)) - continue; - if (PyType_IsSubtype(tmptype, metaclass)) { - metaclass = tmptype; - continue; + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(arg); +#else + size = PyTuple_Size(arg); + if (unlikely(size < 0)) return NULL; +#endif + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); +#endif + return NULL; } - PyErr_SetString(PyExc_TypeError, - "metaclass conflict: " - "the metaclass of a derived class " - "must be a (non-strict) subclass " - "of the metaclasses of all its bases"); + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); return NULL; } - if (!metaclass) { -#if PY_MAJOR_VERSION < 3 - metaclass = &PyClass_Type; +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", + py_name); + Py_DECREF(py_name); #else - metaclass = &PyType_Type; + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); #endif - } - Py_INCREF((PyObject*) metaclass); - return (PyObject*) metaclass; + return NULL; } - -/* Py3ClassCreate */ -static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, - PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { - PyObject *ns; - if (metaclass) { - PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare_2); - if (prep) { - PyObject *pargs = PyTuple_Pack(2, name, bases); - if (unlikely(!pargs)) { - Py_DECREF(prep); - return NULL; - } - ns = PyObject_Call(prep, pargs, mkw); - Py_DECREF(prep); - Py_DECREF(pargs); - } else { - if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - PyErr_Clear(); - ns = PyDict_New(); +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *self, *result; +#if CYTHON_COMPILING_IN_LIMITED_API + self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); + if (unlikely(!self) && PyErr_Occurred()) return NULL; +#else + self = ((PyCFunctionObject*)func)->m_self; +#endif + result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); + return result; +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; +#if CYTHON_METH_FASTCALL + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); +#else + (void) &__Pyx_PyVectorcall_FastCallDict; + return PyVectorcall_Call(func, args, kw); +#endif + } +#endif + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; +#if CYTHON_ASSUME_SAFE_MACROS + argc = PyTuple_GET_SIZE(args); +#else + argc = PyTuple_Size(args); + if (unlikely(!argc) < 0) return NULL; +#endif + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); +#else + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); +#endif + return NULL; } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); } else { - ns = PyDict_New(); + result = __Pyx_CyFunction_Call(func, args, kw); } - if (unlikely(!ns)) - return NULL; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; - if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; - return ns; -bad: - Py_DECREF(ns); - return NULL; + return result; } -static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, - PyObject *dict, PyObject *mkw, - int calculate_metaclass, int allow_py2_metaclass) { - PyObject *result, *margs; - PyObject *owned_metaclass = NULL; - if (allow_py2_metaclass) { - owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); - if (owned_metaclass) { - metaclass = owned_metaclass; - } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { - PyErr_Clear(); - } else { - return NULL; +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) +{ + int ret = 0; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + if (unlikely(nargs < 1)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; } + ret = 1; } - if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { - metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); - Py_XDECREF(owned_metaclass); - if (unlikely(!metaclass)) - return NULL; - owned_metaclass = metaclass; + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; } - margs = PyTuple_Pack(3, name, bases, dict); - if (unlikely(!margs)) { - result = NULL; - } else { - result = PyObject_Call(metaclass, margs, mkw); - Py_DECREF(margs); + return ret; +} +static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; } - Py_XDECREF(owned_metaclass); - return result; + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, NULL); +} +static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_meth(self, args[0]); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); +} +static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) +{ + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_CyFunctionType_slots[] = { + {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, + {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, + {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, + {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, + {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, + {Py_tp_methods, (void *)__pyx_CyFunction_methods}, + {Py_tp_members, (void *)__pyx_CyFunction_members}, + {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, + {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, + {0, 0}, +}; +static PyType_Spec __pyx_CyFunctionType_spec = { + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL + 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_PyMethod_New, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, +#endif +}; +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + m->defaults_size = size; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; } /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON PyObject **cython_runtime_dict; #endif + CYTHON_MAYBE_UNUSED_VAR(tstate); if (unlikely(!__pyx_cython_runtime)) { return c_line; } @@ -14747,7 +22885,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } else #endif { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); if (use_cline_obj) { use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; Py_DECREF(use_cline_obj); @@ -14769,6 +22907,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int #endif /* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { @@ -14847,17 +22986,101 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { __pyx_code_cache.count++; Py_INCREF(code_object); } +#endif /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API #ifndef Py_BUILD_CORE #define Py_BUILD_CORE 1 #endif #include "internal/pycore_frame.h" #endif +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, + PyObject *firstlineno, PyObject *name) { + PyObject *replace = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; + replace = PyObject_GetAttrString(code, "replace"); + if (likely(replace)) { + PyObject *result; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #else + return NULL; + #endif +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; + PyObject *replace = NULL, *getframe = NULL, *frame = NULL; + PyObject *exc_type, *exc_value, *exc_traceback; + int success = 0; + if (c_line) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + code_object = Py_CompileString("_getframe()", filename, Py_eval_input); + if (unlikely(!code_object)) goto bad; + py_py_line = PyLong_FromLong(py_line); + if (unlikely(!py_py_line)) goto bad; + py_funcname = PyUnicode_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; + dict = PyDict_New(); + if (unlikely(!dict)) goto bad; + { + PyObject *old_code_object = code_object; + code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); + Py_DECREF(old_code_object); + } + if (unlikely(!code_object)) goto bad; + getframe = PySys_GetObject("_getframe"); + if (unlikely(!getframe)) goto bad; + if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; + frame = PyEval_EvalCode(code_object, dict, dict); + if (unlikely(!frame) || frame == Py_None) goto bad; + success = 1; + bad: + PyErr_Restore(exc_type, exc_value, exc_traceback); + Py_XDECREF(code_object); + Py_XDECREF(py_py_line); + Py_XDECREF(py_funcname); + Py_XDECREF(dict); + Py_XDECREF(replace); + if (success) { + PyTraceBack_Here( + (struct _frame*)frame); + } + Py_XDECREF(frame); +} +#else static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { @@ -14892,6 +23115,7 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, 0, 0, + 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ @@ -14954,6 +23178,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, Py_XDECREF(py_code); Py_XDECREF(py_frame); } +#endif /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ @@ -14990,7 +23215,7 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(size_t) < sizeof(long)) { + if ((sizeof(size_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -15004,40 +23229,45 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) - case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { - return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_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(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 2 * PyLong_SHIFT)) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { - return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) >= 3 * PyLong_SHIFT)) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_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(size_t) >= 4 * PyLong_SHIFT) { - return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_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(size_t) >= 4 * PyLong_SHIFT)) { + return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -15050,109 +23280,181 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(size_t) <= sizeof(unsigned long)) { + if ((sizeof(size_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) - case -2: - if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(size_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(size_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(size_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(size_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_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(size_t) - 1 > 4 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_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(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_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(size_t) - 1 > 4 * PyLong_SHIFT) { - return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(size_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(size_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(size_t) - 1 > 4 * PyLong_SHIFT)) { + return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(size_t) <= sizeof(long)) { + if ((sizeof(size_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(size_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else size_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if 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; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (size_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (size_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (size_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (size_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (size_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(size_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((size_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(size_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((size_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((size_t) 1) << (sizeof(size_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (size_t) -1; } } else { @@ -15186,7 +23488,7 @@ static CYTHON_INLINE enum emu_reg32 __Pyx_PyInt_As_enum__emu_reg32(PyObject *x) const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(enum emu_reg32) < sizeof(long)) { + if ((sizeof(enum emu_reg32) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(enum emu_reg32, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -15200,40 +23502,45 @@ static CYTHON_INLINE enum emu_reg32 __Pyx_PyInt_As_enum__emu_reg32(PyObject *x) if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (enum emu_reg32) 0; - case 1: __PYX_VERIFY_RETURN_INT(enum emu_reg32, digit, digits[0]) - case 2: - if (8 * sizeof(enum emu_reg32) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg32) >= 2 * PyLong_SHIFT) { - return (enum emu_reg32) (((((enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg32, __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(enum emu_reg32) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg32) >= 2 * PyLong_SHIFT)) { + return (enum emu_reg32) (((((enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(enum emu_reg32) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg32) >= 3 * PyLong_SHIFT) { - return (enum emu_reg32) (((((((enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0])); + break; + case 3: + if ((8 * sizeof(enum emu_reg32) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg32) >= 3 * PyLong_SHIFT)) { + return (enum emu_reg32) (((((((enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(enum emu_reg32) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg32, 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(enum emu_reg32) >= 4 * PyLong_SHIFT) { - return (enum emu_reg32) (((((((((enum emu_reg32)digits[3]) << PyLong_SHIFT) | (enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0])); + break; + case 4: + if ((8 * sizeof(enum emu_reg32) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg32, 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(enum emu_reg32) >= 4 * PyLong_SHIFT)) { + return (enum emu_reg32) (((((((((enum emu_reg32)digits[3]) << PyLong_SHIFT) | (enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -15246,111 +23553,89 @@ static CYTHON_INLINE enum emu_reg32 __Pyx_PyInt_As_enum__emu_reg32(PyObject *x) goto raise_neg_overflow; } #endif - if (sizeof(enum emu_reg32) <= sizeof(unsigned long)) { + if ((sizeof(enum emu_reg32) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg32, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(enum emu_reg32) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(enum emu_reg32) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg32, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (enum emu_reg32) 0; - case -1: __PYX_VERIFY_RETURN_INT(enum emu_reg32, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(enum emu_reg32, digit, +digits[0]) - case -2: - if (8 * sizeof(enum emu_reg32) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg32) - 1 > 2 * PyLong_SHIFT) { - return (enum emu_reg32) (((enum emu_reg32)-1)*(((((enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg32, __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(enum emu_reg32) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg32, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg32) - 1 > 2 * PyLong_SHIFT)) { + return (enum emu_reg32) (((enum emu_reg32)-1)*(((((enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(enum emu_reg32) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg32) - 1 > 2 * PyLong_SHIFT) { - return (enum emu_reg32) ((((((enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + break; + case 2: + if ((8 * sizeof(enum emu_reg32) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg32, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg32) - 1 > 2 * PyLong_SHIFT)) { + return (enum emu_reg32) ((((((enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(enum emu_reg32) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg32) - 1 > 3 * PyLong_SHIFT) { - return (enum emu_reg32) (((enum emu_reg32)-1)*(((((((enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + break; + case -3: + if ((8 * sizeof(enum emu_reg32) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg32, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg32) - 1 > 3 * PyLong_SHIFT)) { + return (enum emu_reg32) (((enum emu_reg32)-1)*(((((((enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(enum emu_reg32) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg32) - 1 > 3 * PyLong_SHIFT) { - return (enum emu_reg32) ((((((((enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + break; + case 3: + if ((8 * sizeof(enum emu_reg32) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg32, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg32) - 1 > 3 * PyLong_SHIFT)) { + return (enum emu_reg32) ((((((((enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(enum emu_reg32) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg32, 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(enum emu_reg32) - 1 > 4 * PyLong_SHIFT) { - return (enum emu_reg32) (((enum emu_reg32)-1)*(((((((((enum emu_reg32)digits[3]) << PyLong_SHIFT) | (enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + break; + case -4: + if ((8 * sizeof(enum emu_reg32) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg32, 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(enum emu_reg32) - 1 > 4 * PyLong_SHIFT)) { + return (enum emu_reg32) (((enum emu_reg32)-1)*(((((((((enum emu_reg32)digits[3]) << PyLong_SHIFT) | (enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(enum emu_reg32) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg32, 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(enum emu_reg32) - 1 > 4 * PyLong_SHIFT) { - return (enum emu_reg32) ((((((((((enum emu_reg32)digits[3]) << PyLong_SHIFT) | (enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + break; + case 4: + if ((8 * sizeof(enum emu_reg32) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg32, 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(enum emu_reg32) - 1 > 4 * PyLong_SHIFT)) { + return (enum emu_reg32) ((((((((((enum emu_reg32)digits[3]) << PyLong_SHIFT) | (enum emu_reg32)digits[2]) << PyLong_SHIFT) | (enum emu_reg32)digits[1]) << PyLong_SHIFT) | (enum emu_reg32)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(enum emu_reg32) <= sizeof(long)) { + if ((sizeof(enum emu_reg32) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg32, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(enum emu_reg32) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(enum emu_reg32) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg32, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - enum emu_reg32 val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (enum emu_reg32) -1; - } + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available, cannot convert large enums"); + return (enum emu_reg32) -1; } else { enum emu_reg32 val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); @@ -15382,7 +23667,7 @@ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(uint32_t) < sizeof(long)) { + if ((sizeof(uint32_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -15396,40 +23681,45 @@ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint32_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) - case 2: - if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __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])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(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(uint32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __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(uint32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __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 3: + if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __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(uint32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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; + case 4: + if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __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; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -15442,109 +23732,181 @@ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(uint32_t) <= sizeof(unsigned long)) { + 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(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + } 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 - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint32_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) - case -2: - if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __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]))); + if (__Pyx_PyLong_IsCompact(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(uint32_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __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(uint32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __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 2: + if ((8 * sizeof(uint32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __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(uint32_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __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(uint32_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __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(uint32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __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 3: + if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __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(uint32_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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(uint32_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __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(uint32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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; + case 4: + if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __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; + break; + } } #endif - if (sizeof(uint32_t) <= sizeof(long)) { + if ((sizeof(uint32_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(uint32_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else uint32_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if 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; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (uint32_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (uint32_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint32_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (uint32_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + 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(uint32_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((uint32_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint32_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint32_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((uint32_t) 1) << (sizeof(uint32_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (uint32_t) -1; } } else { @@ -15578,7 +23940,7 @@ static CYTHON_INLINE enum emu_reg16 __Pyx_PyInt_As_enum__emu_reg16(PyObject *x) const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(enum emu_reg16) < sizeof(long)) { + if ((sizeof(enum emu_reg16) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(enum emu_reg16, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -15592,40 +23954,45 @@ static CYTHON_INLINE enum emu_reg16 __Pyx_PyInt_As_enum__emu_reg16(PyObject *x) if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (enum emu_reg16) 0; - case 1: __PYX_VERIFY_RETURN_INT(enum emu_reg16, digit, digits[0]) - case 2: - if (8 * sizeof(enum emu_reg16) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg16, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg16) >= 2 * PyLong_SHIFT) { - return (enum emu_reg16) (((((enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg16, __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(enum emu_reg16) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg16, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg16) >= 2 * PyLong_SHIFT)) { + return (enum emu_reg16) (((((enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(enum emu_reg16) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg16, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg16) >= 3 * PyLong_SHIFT) { - return (enum emu_reg16) (((((((enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0])); + break; + case 3: + if ((8 * sizeof(enum emu_reg16) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg16, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg16) >= 3 * PyLong_SHIFT)) { + return (enum emu_reg16) (((((((enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(enum emu_reg16) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg16, 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(enum emu_reg16) >= 4 * PyLong_SHIFT) { - return (enum emu_reg16) (((((((((enum emu_reg16)digits[3]) << PyLong_SHIFT) | (enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0])); + break; + case 4: + if ((8 * sizeof(enum emu_reg16) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg16, 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(enum emu_reg16) >= 4 * PyLong_SHIFT)) { + return (enum emu_reg16) (((((((((enum emu_reg16)digits[3]) << PyLong_SHIFT) | (enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -15638,111 +24005,89 @@ static CYTHON_INLINE enum emu_reg16 __Pyx_PyInt_As_enum__emu_reg16(PyObject *x) goto raise_neg_overflow; } #endif - if (sizeof(enum emu_reg16) <= sizeof(unsigned long)) { + if ((sizeof(enum emu_reg16) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg16, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(enum emu_reg16) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(enum emu_reg16) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg16, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (enum emu_reg16) 0; - case -1: __PYX_VERIFY_RETURN_INT(enum emu_reg16, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(enum emu_reg16, digit, +digits[0]) - case -2: - if (8 * sizeof(enum emu_reg16) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg16, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg16) - 1 > 2 * PyLong_SHIFT) { - return (enum emu_reg16) (((enum emu_reg16)-1)*(((((enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg16, __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(enum emu_reg16) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg16, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg16) - 1 > 2 * PyLong_SHIFT)) { + return (enum emu_reg16) (((enum emu_reg16)-1)*(((((enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(enum emu_reg16) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg16, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg16) - 1 > 2 * PyLong_SHIFT) { - return (enum emu_reg16) ((((((enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + break; + case 2: + if ((8 * sizeof(enum emu_reg16) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg16, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg16) - 1 > 2 * PyLong_SHIFT)) { + return (enum emu_reg16) ((((((enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(enum emu_reg16) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg16, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg16) - 1 > 3 * PyLong_SHIFT) { - return (enum emu_reg16) (((enum emu_reg16)-1)*(((((((enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + break; + case -3: + if ((8 * sizeof(enum emu_reg16) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg16, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg16) - 1 > 3 * PyLong_SHIFT)) { + return (enum emu_reg16) (((enum emu_reg16)-1)*(((((((enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(enum emu_reg16) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg16, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg16) - 1 > 3 * PyLong_SHIFT) { - return (enum emu_reg16) ((((((((enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + break; + case 3: + if ((8 * sizeof(enum emu_reg16) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg16, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg16) - 1 > 3 * PyLong_SHIFT)) { + return (enum emu_reg16) ((((((((enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(enum emu_reg16) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg16, 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(enum emu_reg16) - 1 > 4 * PyLong_SHIFT) { - return (enum emu_reg16) (((enum emu_reg16)-1)*(((((((((enum emu_reg16)digits[3]) << PyLong_SHIFT) | (enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + break; + case -4: + if ((8 * sizeof(enum emu_reg16) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg16, 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(enum emu_reg16) - 1 > 4 * PyLong_SHIFT)) { + return (enum emu_reg16) (((enum emu_reg16)-1)*(((((((((enum emu_reg16)digits[3]) << PyLong_SHIFT) | (enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(enum emu_reg16) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg16, 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(enum emu_reg16) - 1 > 4 * PyLong_SHIFT) { - return (enum emu_reg16) ((((((((((enum emu_reg16)digits[3]) << PyLong_SHIFT) | (enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + break; + case 4: + if ((8 * sizeof(enum emu_reg16) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg16, 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(enum emu_reg16) - 1 > 4 * PyLong_SHIFT)) { + return (enum emu_reg16) ((((((((((enum emu_reg16)digits[3]) << PyLong_SHIFT) | (enum emu_reg16)digits[2]) << PyLong_SHIFT) | (enum emu_reg16)digits[1]) << PyLong_SHIFT) | (enum emu_reg16)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(enum emu_reg16) <= sizeof(long)) { + if ((sizeof(enum emu_reg16) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg16, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(enum emu_reg16) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(enum emu_reg16) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg16, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - enum emu_reg16 val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (enum emu_reg16) -1; - } + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available, cannot convert large enums"); + return (enum emu_reg16) -1; } else { enum emu_reg16 val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); @@ -15774,7 +24119,7 @@ static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(uint16_t) < sizeof(long)) { + if ((sizeof(uint16_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(uint16_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -15788,40 +24133,45 @@ static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint16_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint16_t, digit, digits[0]) - 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])); + 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 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; + 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; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -15834,109 +24184,181 @@ static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(uint16_t) <= sizeof(unsigned long)) { + 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)) { + } 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 - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint16_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint16_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint16_t, digit, +digits[0]) - 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]))); + 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 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) - 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 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) - 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; + 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; + break; + } } #endif - if (sizeof(uint16_t) <= sizeof(long)) { + 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)) { + } else if ((sizeof(uint16_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint16_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else uint16_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if 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; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (uint16_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (uint16_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint16_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (uint16_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + 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; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((uint16_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + 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 CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + 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 Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (uint16_t) -1; } } else { @@ -15970,7 +24392,7 @@ static CYTHON_INLINE enum emu_reg8 __Pyx_PyInt_As_enum__emu_reg8(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(enum emu_reg8) < sizeof(long)) { + if ((sizeof(enum emu_reg8) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(enum emu_reg8, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -15984,40 +24406,45 @@ static CYTHON_INLINE enum emu_reg8 __Pyx_PyInt_As_enum__emu_reg8(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (enum emu_reg8) 0; - case 1: __PYX_VERIFY_RETURN_INT(enum emu_reg8, digit, digits[0]) - case 2: - if (8 * sizeof(enum emu_reg8) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg8) >= 2 * PyLong_SHIFT) { - return (enum emu_reg8) (((((enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg8, __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(enum emu_reg8) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg8) >= 2 * PyLong_SHIFT)) { + return (enum emu_reg8) (((((enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(enum emu_reg8) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg8) >= 3 * PyLong_SHIFT) { - return (enum emu_reg8) (((((((enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0])); + break; + case 3: + if ((8 * sizeof(enum emu_reg8) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg8) >= 3 * PyLong_SHIFT)) { + return (enum emu_reg8) (((((((enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(enum emu_reg8) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg8, 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(enum emu_reg8) >= 4 * PyLong_SHIFT) { - return (enum emu_reg8) (((((((((enum emu_reg8)digits[3]) << PyLong_SHIFT) | (enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0])); + break; + case 4: + if ((8 * sizeof(enum emu_reg8) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg8, 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(enum emu_reg8) >= 4 * PyLong_SHIFT)) { + return (enum emu_reg8) (((((((((enum emu_reg8)digits[3]) << PyLong_SHIFT) | (enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -16030,111 +24457,89 @@ static CYTHON_INLINE enum emu_reg8 __Pyx_PyInt_As_enum__emu_reg8(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(enum emu_reg8) <= sizeof(unsigned long)) { + if ((sizeof(enum emu_reg8) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg8, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(enum emu_reg8) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(enum emu_reg8) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg8, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (enum emu_reg8) 0; - case -1: __PYX_VERIFY_RETURN_INT(enum emu_reg8, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(enum emu_reg8, digit, +digits[0]) - case -2: - if (8 * sizeof(enum emu_reg8) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg8, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg8) - 1 > 2 * PyLong_SHIFT) { - return (enum emu_reg8) (((enum emu_reg8)-1)*(((((enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg8, __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(enum emu_reg8) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg8, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg8) - 1 > 2 * PyLong_SHIFT)) { + return (enum emu_reg8) (((enum emu_reg8)-1)*(((((enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(enum emu_reg8) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg8) - 1 > 2 * PyLong_SHIFT) { - return (enum emu_reg8) ((((((enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + break; + case 2: + if ((8 * sizeof(enum emu_reg8) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg8, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg8) - 1 > 2 * PyLong_SHIFT)) { + return (enum emu_reg8) ((((((enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(enum emu_reg8) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg8, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg8) - 1 > 3 * PyLong_SHIFT) { - return (enum emu_reg8) (((enum emu_reg8)-1)*(((((((enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + break; + case -3: + if ((8 * sizeof(enum emu_reg8) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg8, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg8) - 1 > 3 * PyLong_SHIFT)) { + return (enum emu_reg8) (((enum emu_reg8)-1)*(((((((enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(enum emu_reg8) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_reg8) - 1 > 3 * PyLong_SHIFT) { - return (enum emu_reg8) ((((((((enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + break; + case 3: + if ((8 * sizeof(enum emu_reg8) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg8, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_reg8) - 1 > 3 * PyLong_SHIFT)) { + return (enum emu_reg8) ((((((((enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(enum emu_reg8) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg8, 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(enum emu_reg8) - 1 > 4 * PyLong_SHIFT) { - return (enum emu_reg8) (((enum emu_reg8)-1)*(((((((((enum emu_reg8)digits[3]) << PyLong_SHIFT) | (enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + break; + case -4: + if ((8 * sizeof(enum emu_reg8) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg8, 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(enum emu_reg8) - 1 > 4 * PyLong_SHIFT)) { + return (enum emu_reg8) (((enum emu_reg8)-1)*(((((((((enum emu_reg8)digits[3]) << PyLong_SHIFT) | (enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(enum emu_reg8) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_reg8, 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(enum emu_reg8) - 1 > 4 * PyLong_SHIFT) { - return (enum emu_reg8) ((((((((((enum emu_reg8)digits[3]) << PyLong_SHIFT) | (enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + break; + case 4: + if ((8 * sizeof(enum emu_reg8) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_reg8, 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(enum emu_reg8) - 1 > 4 * PyLong_SHIFT)) { + return (enum emu_reg8) ((((((((((enum emu_reg8)digits[3]) << PyLong_SHIFT) | (enum emu_reg8)digits[2]) << PyLong_SHIFT) | (enum emu_reg8)digits[1]) << PyLong_SHIFT) | (enum emu_reg8)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(enum emu_reg8) <= sizeof(long)) { + if ((sizeof(enum emu_reg8) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg8, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(enum emu_reg8) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(enum emu_reg8) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_reg8, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - enum emu_reg8 val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (enum emu_reg8) -1; - } + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available, cannot convert large enums"); + return (enum emu_reg8) -1; } else { enum emu_reg8 val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); @@ -16166,7 +24571,7 @@ static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(uint8_t) < sizeof(long)) { + if ((sizeof(uint8_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(uint8_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -16180,40 +24585,45 @@ static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint8_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, digits[0]) - case 2: - if (8 * sizeof(uint8_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) >= 2 * PyLong_SHIFT) { - return (uint8_t) (((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) >= 2 * PyLong_SHIFT)) { + return (uint8_t) (((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(uint8_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) >= 3 * PyLong_SHIFT) { - return (uint8_t) (((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + break; + case 3: + if ((8 * sizeof(uint8_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) >= 3 * PyLong_SHIFT)) { + return (uint8_t) (((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(uint8_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) >= 4 * PyLong_SHIFT) { - return (uint8_t) (((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + break; + case 4: + if ((8 * sizeof(uint8_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) >= 4 * PyLong_SHIFT)) { + return (uint8_t) (((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -16226,109 +24636,181 @@ static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(uint8_t) <= sizeof(unsigned long)) { + if ((sizeof(uint8_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (uint8_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint8_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, +digits[0]) - case -2: - if (8 * sizeof(uint8_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint8_t) (((uint8_t)-1)*(((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(uint8_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { - return (uint8_t) ((((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(uint8_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT)) { + return (uint8_t) ((((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint8_t) (((uint8_t)-1)*(((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(uint8_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { - return (uint8_t) ((((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(uint8_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT)) { + return (uint8_t) ((((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) - 1 > 4 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint8_t) (((uint8_t)-1)*(((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(uint8_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) - 1 > 4 * PyLong_SHIFT) { - return (uint8_t) ((((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(uint8_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) - 1 > 4 * PyLong_SHIFT)) { + return (uint8_t) ((((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(uint8_t) <= sizeof(long)) { + if ((sizeof(uint8_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(uint8_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint8_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(uint8_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(uint8_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else uint8_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if 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; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (uint8_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (uint8_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (uint8_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (uint8_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (uint8_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(uint8_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((uint8_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(uint8_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((uint8_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((uint8_t) 1) << (sizeof(uint8_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (uint8_t) -1; } } else { @@ -16362,7 +24844,7 @@ static CYTHON_INLINE enum emu_segment __Pyx_PyInt_As_enum__emu_segment(PyObject const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(enum emu_segment) < sizeof(long)) { + if ((sizeof(enum emu_segment) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(enum emu_segment, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -16376,40 +24858,45 @@ static CYTHON_INLINE enum emu_segment __Pyx_PyInt_As_enum__emu_segment(PyObject if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (enum emu_segment) 0; - case 1: __PYX_VERIFY_RETURN_INT(enum emu_segment, digit, digits[0]) - case 2: - if (8 * sizeof(enum emu_segment) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_segment, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_segment) >= 2 * PyLong_SHIFT) { - return (enum emu_segment) (((((enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(enum emu_segment) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_segment, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_segment) >= 3 * PyLong_SHIFT) { - return (enum emu_segment) (((((((enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum emu_segment, __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(enum emu_segment) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_segment, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_segment) >= 2 * PyLong_SHIFT)) { + return (enum emu_segment) (((((enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(enum emu_segment) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_segment, 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(enum emu_segment) >= 4 * PyLong_SHIFT) { - return (enum emu_segment) (((((((((enum emu_segment)digits[3]) << PyLong_SHIFT) | (enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0])); + break; + case 3: + if ((8 * sizeof(enum emu_segment) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_segment, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_segment) >= 3 * PyLong_SHIFT)) { + return (enum emu_segment) (((((((enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0])); + } } - } - break; + break; + case 4: + if ((8 * sizeof(enum emu_segment) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_segment, 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(enum emu_segment) >= 4 * PyLong_SHIFT)) { + return (enum emu_segment) (((((((((enum emu_segment)digits[3]) << PyLong_SHIFT) | (enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0])); + } + } + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -16422,111 +24909,89 @@ static CYTHON_INLINE enum emu_segment __Pyx_PyInt_As_enum__emu_segment(PyObject goto raise_neg_overflow; } #endif - if (sizeof(enum emu_segment) <= sizeof(unsigned long)) { + if ((sizeof(enum emu_segment) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_segment, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(enum emu_segment) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(enum emu_segment) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_segment, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (enum emu_segment) 0; - case -1: __PYX_VERIFY_RETURN_INT(enum emu_segment, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(enum emu_segment, digit, +digits[0]) - case -2: - if (8 * sizeof(enum emu_segment) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_segment, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_segment) - 1 > 2 * PyLong_SHIFT) { - return (enum emu_segment) (((enum emu_segment)-1)*(((((enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(enum emu_segment, __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(enum emu_segment) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_segment, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_segment) - 1 > 2 * PyLong_SHIFT)) { + return (enum emu_segment) (((enum emu_segment)-1)*(((((enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(enum emu_segment) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_segment, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_segment) - 1 > 2 * PyLong_SHIFT) { - return (enum emu_segment) ((((((enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + break; + case 2: + if ((8 * sizeof(enum emu_segment) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_segment, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_segment) - 1 > 2 * PyLong_SHIFT)) { + return (enum emu_segment) ((((((enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(enum emu_segment) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_segment, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_segment) - 1 > 3 * PyLong_SHIFT) { - return (enum emu_segment) (((enum emu_segment)-1)*(((((((enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + break; + case -3: + if ((8 * sizeof(enum emu_segment) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_segment, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_segment) - 1 > 3 * PyLong_SHIFT)) { + return (enum emu_segment) (((enum emu_segment)-1)*(((((((enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(enum emu_segment) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_segment, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum emu_segment) - 1 > 3 * PyLong_SHIFT) { - return (enum emu_segment) ((((((((enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + break; + case 3: + if ((8 * sizeof(enum emu_segment) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_segment, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(enum emu_segment) - 1 > 3 * PyLong_SHIFT)) { + return (enum emu_segment) ((((((((enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(enum emu_segment) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_segment, 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(enum emu_segment) - 1 > 4 * PyLong_SHIFT) { - return (enum emu_segment) (((enum emu_segment)-1)*(((((((((enum emu_segment)digits[3]) << PyLong_SHIFT) | (enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + break; + case -4: + if ((8 * sizeof(enum emu_segment) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_segment, 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(enum emu_segment) - 1 > 4 * PyLong_SHIFT)) { + return (enum emu_segment) (((enum emu_segment)-1)*(((((((((enum emu_segment)digits[3]) << PyLong_SHIFT) | (enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(enum emu_segment) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum emu_segment, 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(enum emu_segment) - 1 > 4 * PyLong_SHIFT) { - return (enum emu_segment) ((((((((((enum emu_segment)digits[3]) << PyLong_SHIFT) | (enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + break; + case 4: + if ((8 * sizeof(enum emu_segment) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(enum emu_segment, 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(enum emu_segment) - 1 > 4 * PyLong_SHIFT)) { + return (enum emu_segment) ((((((((((enum emu_segment)digits[3]) << PyLong_SHIFT) | (enum emu_segment)digits[2]) << PyLong_SHIFT) | (enum emu_segment)digits[1]) << PyLong_SHIFT) | (enum emu_segment)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(enum emu_segment) <= sizeof(long)) { + if ((sizeof(enum emu_segment) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_segment, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(enum emu_segment) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(enum emu_segment) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(enum emu_segment, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - enum emu_segment val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (enum emu_segment) -1; - } + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available, cannot convert large enums"); + return (enum emu_segment) -1; } else { enum emu_segment val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); @@ -16558,7 +25023,7 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { + if ((sizeof(int) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -16572,40 +25037,45 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - 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])); + 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 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; + 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; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -16618,109 +25088,181 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { + 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)) { + } 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 - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - 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]))); + 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 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) - 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 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) - 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; + 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; + break; + } } #endif - if (sizeof(int) <= sizeof(long)) { + 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)) { + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if 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; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + 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; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + 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 CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + 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 Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int) -1; } } else { @@ -16774,8 +25316,34 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 return _PyLong_FromByteArray(bytes, sizeof(int32_t), little, !is_unsigned); +#else + 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(int32_t)); + 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 } } @@ -16812,8 +25380,34 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); +#else + 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; + 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 } } @@ -16830,7 +25424,7 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int32_t) < sizeof(long)) { + if ((sizeof(int32_t) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -16844,40 +25438,45 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int32_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, digits[0]) - case 2: - if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) >= 2 * PyLong_SHIFT) { - return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + if (unlikely(__Pyx_PyLong_IsNeg(x))) { + goto raise_neg_overflow; + } else if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int32_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(int32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) >= 2 * PyLong_SHIFT)) { + return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } } - } - break; - case 3: - if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) >= 3 * PyLong_SHIFT) { - return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + break; + case 3: + if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) >= 3 * PyLong_SHIFT)) { + return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } } - } - break; - case 4: - if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_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(int32_t) >= 4 * PyLong_SHIFT) { - return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + break; + case 4: + if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_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(int32_t) >= 4 * PyLong_SHIFT)) { + return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -16890,109 +25489,181 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(int32_t) <= sizeof(unsigned long)) { + if ((sizeof(int32_t) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int32_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(int32_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, +digits[0]) - case -2: - if (8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { - return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + if (__Pyx_PyLong_IsCompact(x)) { + __PYX_VERIFY_RETURN_INT(int32_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(int32_t) - 1 > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case 2: - if (8 * sizeof(int32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { - return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case 2: + if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case -3: - if (8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { - return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case -3: + if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case 3: - if (8 * sizeof(int32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { - return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case 3: + if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case -4: - if (8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_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(int32_t) - 1 > 4 * PyLong_SHIFT) { - return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case -4: + if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_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(int32_t) - 1 > 4 * PyLong_SHIFT)) { + return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; - case 4: - if (8 * sizeof(int32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int32_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(int32_t) - 1 > 4 * PyLong_SHIFT) { - return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + break; + case 4: + if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) { + if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { + __PYX_VERIFY_RETURN_INT(int32_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(int32_t) - 1 > 4 * PyLong_SHIFT)) { + return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]))); + } } - } - break; + break; + } } #endif - if (sizeof(int32_t) <= sizeof(long)) { + if ((sizeof(int32_t) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(int32_t) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(int32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else int32_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if 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; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int32_t) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int32_t) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int32_t) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int32_t) -1; + } else { + stepval = __Pyx_NewRef(v); + } + val = (int32_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(int32_t) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int32_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(int32_t) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((int32_t) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((int32_t) 1) << (sizeof(int32_t) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (int32_t) -1; } } else { @@ -17046,8 +25717,34 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 return _PyLong_FromByteArray(bytes, sizeof(uint32_t), little, !is_unsigned); +#else + 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(uint32_t)); + 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 } } @@ -17084,8 +25781,34 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 return _PyLong_FromByteArray(bytes, sizeof(uint16_t), little, !is_unsigned); +#else + 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(uint16_t)); + 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 } } @@ -17122,8 +25845,34 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 return _PyLong_FromByteArray(bytes, sizeof(uint8_t), little, !is_unsigned); +#else + 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(uint8_t)); + 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 } } @@ -17160,8 +25909,34 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__emu_segment(enum emu_segme { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 return _PyLong_FromByteArray(bytes, sizeof(enum emu_segment), little, !is_unsigned); +#else + 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(enum emu_segment)); + 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 } } @@ -17178,7 +25953,7 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { + if ((sizeof(long) < sizeof(long))) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); @@ -17192,40 +25967,45 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 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])); + 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)) + } 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(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])); + } } - } - break; - case 3: - if (8 * sizeof(long) > 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])); + break; + case 3: + if ((8 * sizeof(long) > 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])); + } } - } - break; - case 4: - if (8 * sizeof(long) > 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])); + break; + case 4: + if ((8 * sizeof(long) > 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])); + } } - } - break; + break; + } } #endif -#if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } @@ -17238,109 +26018,181 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { goto raise_neg_overflow; } #endif - if (sizeof(long) <= sizeof(unsigned long)) { + if ((sizeof(long) <= sizeof(unsigned long))) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + } 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 - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 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]))); + if (__Pyx_PyLong_IsCompact(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(long) - 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]))); + } } - } - break; - case 2: - if (8 * sizeof(long) > 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]))); + break; + case 2: + if ((8 * sizeof(long) > 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]))); + } } - } - break; - case -3: - if (8 * sizeof(long) - 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]))); + break; + case -3: + if ((8 * sizeof(long) - 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]))); + } } - } - break; - case 3: - if (8 * sizeof(long) > 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]))); + break; + case 3: + if ((8 * sizeof(long) > 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]))); + } } - } - break; - case -4: - if (8 * sizeof(long) - 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]))); + break; + case -4: + if ((8 * sizeof(long) - 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]))); + } } - } - break; - case 4: - if (8 * sizeof(long) > 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]))); + break; + case 4: + if ((8 * sizeof(long) > 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]))); + } } - } - break; + break; + } } #endif - if (sizeof(long) <= sizeof(long)) { + if ((sizeof(long) <= sizeof(long))) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 +#if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } - #endif +#endif if (likely(v)) { + int ret = -1; +#if 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; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); + ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + 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(long) * 8 - chunk_size; bits += chunk_size) { + PyObject *tmp, *digit; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + idigit = PyLong_AsLong(stepval); + if (unlikely(idigit < 0)) goto done; + remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); + if (unlikely(idigit >= (1L << remaining_bits))) + goto raise_overflow; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + if (!is_unsigned) { + if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) + goto raise_overflow; + if (is_negative) + val = ~val; + } + ret = 0; + done: + Py_XDECREF(shift); + Py_XDECREF(mask); + Py_XDECREF(stepval); +#endif Py_DECREF(v); if (likely(!ret)) return val; } -#endif return (long) -1; } } else { @@ -17361,6 +26213,22 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { return (long) -1; } +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__75); + } + return name; +} +#endif + /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -17394,8 +26262,34 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); +#else + 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 } } @@ -17403,7 +26297,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { - a = a->tp_base; + a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); if (a == b) return 1; } @@ -17424,6 +26318,22 @@ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { } 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; @@ -17448,11 +26358,11 @@ static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc } #else static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; - if (!res) { - res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)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); } - return res; } #endif static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { @@ -17500,47 +26410,78 @@ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObj #endif /* CheckBinaryVersion */ -static int __Pyx_check_binary_version(void) { - char ctversion[5]; - int same=1, i, found_dot; - const char* rt_from_call = Py_GetVersion(); - PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - found_dot = 0; - for (i = 0; i < 4; i++) { - if (!ctversion[i]) { - same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); - break; +static unsigned long __Pyx_get_runtime_version(void) { +#if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4 + return Py_Version & ~0xFFUL; +#else + const char* rt_version = Py_GetVersion(); + unsigned long version = 0; + unsigned long factor = 0x01000000UL; + unsigned int digit = 0; + int i = 0; + while (factor) { + while ('0' <= rt_version[i] && rt_version[i] <= '9') { + digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); + ++i; } - if (rt_from_call[i] != ctversion[i]) { - same = 0; + version += factor * digit; + if (rt_version[i] != '.') break; - } + digit = 0; + factor >>= 8; + ++i; } - if (!same) { - char rtversion[5] = {'\0'}; + return version; +#endif +} +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { + const unsigned long MAJOR_MINOR = 0xFFFF0000UL; + if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) + return 0; + if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) + return 1; + { char message[200]; - for (i=0; i<4; ++i) { - if (rt_from_call[i] == '.') { - if (found_dot) break; - found_dot = 1; - } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { - break; - } - rtversion[i] = rt_from_call[i]; - } PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); + "compile time Python version %d.%d " + "of module '%.100s' " + "%s " + "runtime version %d.%d", + (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), + __Pyx_MODULE_NAME, + (allow_newer) ? "was newer than" : "does not match", + (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) + ); return PyErr_WarnEx(NULL, message, 1); } - return 0; } /* InitStrings */ +#if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { @@ -17548,30 +26489,34 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif if (!*t->p) return -1; if (PyObject_Hash(*t->p) == -1) return -1; + #endif ++t; } return 0; } +#include +static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { + size_t len = strlen(s); + if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { + PyErr_SetString(PyExc_OverflowError, "byte string is too long"); + return -1; + } + return (Py_ssize_t) len; +} static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return __Pyx_PyUnicode_FromStringAndSize(c_str, len); +} +static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { + Py_ssize_t len = __Pyx_ssize_strlen(c_str); + if (unlikely(len < 0)) return NULL; + return PyByteArray_FromStringAndSize(c_str, len); } static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; @@ -17626,7 +26571,7 @@ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); @@ -17655,22 +26600,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { return retval; } static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, - "__int__ returned non-int (type %.200s). " - "The ability to return an instance of a strict subclass of int " - "is deprecated, and may be removed in a future version of Python.", - Py_TYPE(result)->tp_name)) { + "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " + "The ability to return an instance of a strict subclass of int is deprecated, " + "and may be removed in a future version of Python.", + result_type_name)) { + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } + __Pyx_DECREF_TypeName(result_type_name); return result; } #endif PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - type_name, type_name, Py_TYPE(result)->tp_name); + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); Py_DECREF(result); return NULL; } @@ -17736,13 +26685,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; + if (likely(__Pyx_PyLong_IsCompact(b))) { + return __Pyx_PyLong_CompactValue(b); } else { + const digit* digits = __Pyx_PyLong_Digits(b); + const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { @@ -17810,4 +26757,12 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { } +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ #endif /* Py_PYTHON_H */