├── .gitignore ├── Demo ├── demo.py ├── led │ ├── CMakeLists.txt │ ├── led.c │ └── led.h ├── pyled │ ├── cled.pxd │ ├── led.c │ ├── led.pyx │ └── setup.py ├── pysample │ ├── csample.pxd │ ├── sam.c │ ├── sam.pyx │ └── setup.py └── sample │ ├── CMakeLists.txt │ ├── sample.c │ └── sample.h ├── LICENSE ├── README.md ├── Video └── CppCon 2015- Greg Law ' Give me 15 minutes & I'll change your view of GDB'.mp4 └── 资料 ├── GDB调试程序 .ppt └── Linux源码分析-PTRACE.doc /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | -------------------------------------------------------------------------------- /Demo/demo.py: -------------------------------------------------------------------------------- 1 | import sam 2 | import led 3 | 4 | led.led_h() 5 | led.led_h() 6 | led.led() 7 | 8 | sam.gcd(2,20) 9 | -------------------------------------------------------------------------------- /Demo/led/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | # Set the project name 4 | project (led) 5 | 6 | 7 | 8 | set(CMAKE_VERBOSE_MAKEFILE on) 9 | 10 | #FIND_LIBRARY(SAMPLE_LIB sample /usr/lib) 11 | 12 | LINK_DIRECTORIES(/usr/lib) 13 | 14 | SET(LIBLED_SRC led.c) 15 | 16 | SET(LIBHEAD_FILE led.h) 17 | 18 | #SET(CMAKE_BUILD_TYPE Debug) 19 | 20 | ADD_LIBRARY(led SHARED ${LIBLED_SRC}) 21 | 22 | TARGET_LINK_LIBRARIES(led sample) 23 | 24 | INSTALL(TARGETS led DESTINATION "/usr/lib") 25 | 26 | INSTALL(FILES ${LIBHEAD_FILE} DESTINATION "/usr/include") -------------------------------------------------------------------------------- /Demo/led/led.c: -------------------------------------------------------------------------------- 1 | #include "led.h" 2 | /* Compute the greatest common divisor */ 3 | int m_data =3; 4 | 5 | int led() { 6 | set_cur_term(NULL); 7 | return 3; 8 | } 9 | int led_h() { 10 | set_cur_term(&m_data); 11 | return 3; 12 | } -------------------------------------------------------------------------------- /Demo/led/led.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | int led(); 9 | int led_h(); 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif -------------------------------------------------------------------------------- /Demo/pyled/cled.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "led.h": 2 | int led() 3 | int led_h() 4 | -------------------------------------------------------------------------------- /Demo/pyled/led.c: -------------------------------------------------------------------------------- 1 | /* Generated by Cython 0.29.6 */ 2 | 3 | #define PY_SSIZE_T_CLEAN 4 | #include "Python.h" 5 | #ifndef Py_PYTHON_H 6 | #error Python headers needed to compile C extensions, please install development version of Python. 7 | #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) 8 | #error Cython requires Python 2.6+ or Python 3.3+. 9 | #else 10 | #define CYTHON_ABI "0_29_6" 11 | #define CYTHON_HEX_VERSION 0x001D06F0 12 | #define CYTHON_FUTURE_DIVISION 0 13 | #include 14 | #ifndef offsetof 15 | #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) 16 | #endif 17 | #if !defined(WIN32) && !defined(MS_WINDOWS) 18 | #ifndef __stdcall 19 | #define __stdcall 20 | #endif 21 | #ifndef __cdecl 22 | #define __cdecl 23 | #endif 24 | #ifndef __fastcall 25 | #define __fastcall 26 | #endif 27 | #endif 28 | #ifndef DL_IMPORT 29 | #define DL_IMPORT(t) t 30 | #endif 31 | #ifndef DL_EXPORT 32 | #define DL_EXPORT(t) t 33 | #endif 34 | #define __PYX_COMMA , 35 | #ifndef HAVE_LONG_LONG 36 | #if PY_VERSION_HEX >= 0x02070000 37 | #define HAVE_LONG_LONG 38 | #endif 39 | #endif 40 | #ifndef PY_LONG_LONG 41 | #define PY_LONG_LONG LONG_LONG 42 | #endif 43 | #ifndef Py_HUGE_VAL 44 | #define Py_HUGE_VAL HUGE_VAL 45 | #endif 46 | #ifdef PYPY_VERSION 47 | #define CYTHON_COMPILING_IN_PYPY 1 48 | #define CYTHON_COMPILING_IN_PYSTON 0 49 | #define CYTHON_COMPILING_IN_CPYTHON 0 50 | #undef CYTHON_USE_TYPE_SLOTS 51 | #define CYTHON_USE_TYPE_SLOTS 0 52 | #undef CYTHON_USE_PYTYPE_LOOKUP 53 | #define CYTHON_USE_PYTYPE_LOOKUP 0 54 | #if PY_VERSION_HEX < 0x03050000 55 | #undef CYTHON_USE_ASYNC_SLOTS 56 | #define CYTHON_USE_ASYNC_SLOTS 0 57 | #elif !defined(CYTHON_USE_ASYNC_SLOTS) 58 | #define CYTHON_USE_ASYNC_SLOTS 1 59 | #endif 60 | #undef CYTHON_USE_PYLIST_INTERNALS 61 | #define CYTHON_USE_PYLIST_INTERNALS 0 62 | #undef CYTHON_USE_UNICODE_INTERNALS 63 | #define CYTHON_USE_UNICODE_INTERNALS 0 64 | #undef CYTHON_USE_UNICODE_WRITER 65 | #define CYTHON_USE_UNICODE_WRITER 0 66 | #undef CYTHON_USE_PYLONG_INTERNALS 67 | #define CYTHON_USE_PYLONG_INTERNALS 0 68 | #undef CYTHON_AVOID_BORROWED_REFS 69 | #define CYTHON_AVOID_BORROWED_REFS 1 70 | #undef CYTHON_ASSUME_SAFE_MACROS 71 | #define CYTHON_ASSUME_SAFE_MACROS 0 72 | #undef CYTHON_UNPACK_METHODS 73 | #define CYTHON_UNPACK_METHODS 0 74 | #undef CYTHON_FAST_THREAD_STATE 75 | #define CYTHON_FAST_THREAD_STATE 0 76 | #undef CYTHON_FAST_PYCALL 77 | #define CYTHON_FAST_PYCALL 0 78 | #undef CYTHON_PEP489_MULTI_PHASE_INIT 79 | #define CYTHON_PEP489_MULTI_PHASE_INIT 0 80 | #undef CYTHON_USE_TP_FINALIZE 81 | #define CYTHON_USE_TP_FINALIZE 0 82 | #undef CYTHON_USE_DICT_VERSIONS 83 | #define CYTHON_USE_DICT_VERSIONS 0 84 | #undef CYTHON_USE_EXC_INFO_STACK 85 | #define CYTHON_USE_EXC_INFO_STACK 0 86 | #elif defined(PYSTON_VERSION) 87 | #define CYTHON_COMPILING_IN_PYPY 0 88 | #define CYTHON_COMPILING_IN_PYSTON 1 89 | #define CYTHON_COMPILING_IN_CPYTHON 0 90 | #ifndef CYTHON_USE_TYPE_SLOTS 91 | #define CYTHON_USE_TYPE_SLOTS 1 92 | #endif 93 | #undef CYTHON_USE_PYTYPE_LOOKUP 94 | #define CYTHON_USE_PYTYPE_LOOKUP 0 95 | #undef CYTHON_USE_ASYNC_SLOTS 96 | #define CYTHON_USE_ASYNC_SLOTS 0 97 | #undef CYTHON_USE_PYLIST_INTERNALS 98 | #define CYTHON_USE_PYLIST_INTERNALS 0 99 | #ifndef CYTHON_USE_UNICODE_INTERNALS 100 | #define CYTHON_USE_UNICODE_INTERNALS 1 101 | #endif 102 | #undef CYTHON_USE_UNICODE_WRITER 103 | #define CYTHON_USE_UNICODE_WRITER 0 104 | #undef CYTHON_USE_PYLONG_INTERNALS 105 | #define CYTHON_USE_PYLONG_INTERNALS 0 106 | #ifndef CYTHON_AVOID_BORROWED_REFS 107 | #define CYTHON_AVOID_BORROWED_REFS 0 108 | #endif 109 | #ifndef CYTHON_ASSUME_SAFE_MACROS 110 | #define CYTHON_ASSUME_SAFE_MACROS 1 111 | #endif 112 | #ifndef CYTHON_UNPACK_METHODS 113 | #define CYTHON_UNPACK_METHODS 1 114 | #endif 115 | #undef CYTHON_FAST_THREAD_STATE 116 | #define CYTHON_FAST_THREAD_STATE 0 117 | #undef CYTHON_FAST_PYCALL 118 | #define CYTHON_FAST_PYCALL 0 119 | #undef CYTHON_PEP489_MULTI_PHASE_INIT 120 | #define CYTHON_PEP489_MULTI_PHASE_INIT 0 121 | #undef CYTHON_USE_TP_FINALIZE 122 | #define CYTHON_USE_TP_FINALIZE 0 123 | #undef CYTHON_USE_DICT_VERSIONS 124 | #define CYTHON_USE_DICT_VERSIONS 0 125 | #undef CYTHON_USE_EXC_INFO_STACK 126 | #define CYTHON_USE_EXC_INFO_STACK 0 127 | #else 128 | #define CYTHON_COMPILING_IN_PYPY 0 129 | #define CYTHON_COMPILING_IN_PYSTON 0 130 | #define CYTHON_COMPILING_IN_CPYTHON 1 131 | #ifndef CYTHON_USE_TYPE_SLOTS 132 | #define CYTHON_USE_TYPE_SLOTS 1 133 | #endif 134 | #if PY_VERSION_HEX < 0x02070000 135 | #undef CYTHON_USE_PYTYPE_LOOKUP 136 | #define CYTHON_USE_PYTYPE_LOOKUP 0 137 | #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) 138 | #define CYTHON_USE_PYTYPE_LOOKUP 1 139 | #endif 140 | #if PY_MAJOR_VERSION < 3 141 | #undef CYTHON_USE_ASYNC_SLOTS 142 | #define CYTHON_USE_ASYNC_SLOTS 0 143 | #elif !defined(CYTHON_USE_ASYNC_SLOTS) 144 | #define CYTHON_USE_ASYNC_SLOTS 1 145 | #endif 146 | #if PY_VERSION_HEX < 0x02070000 147 | #undef CYTHON_USE_PYLONG_INTERNALS 148 | #define CYTHON_USE_PYLONG_INTERNALS 0 149 | #elif !defined(CYTHON_USE_PYLONG_INTERNALS) 150 | #define CYTHON_USE_PYLONG_INTERNALS 1 151 | #endif 152 | #ifndef CYTHON_USE_PYLIST_INTERNALS 153 | #define CYTHON_USE_PYLIST_INTERNALS 1 154 | #endif 155 | #ifndef CYTHON_USE_UNICODE_INTERNALS 156 | #define CYTHON_USE_UNICODE_INTERNALS 1 157 | #endif 158 | #if PY_VERSION_HEX < 0x030300F0 159 | #undef CYTHON_USE_UNICODE_WRITER 160 | #define CYTHON_USE_UNICODE_WRITER 0 161 | #elif !defined(CYTHON_USE_UNICODE_WRITER) 162 | #define CYTHON_USE_UNICODE_WRITER 1 163 | #endif 164 | #ifndef CYTHON_AVOID_BORROWED_REFS 165 | #define CYTHON_AVOID_BORROWED_REFS 0 166 | #endif 167 | #ifndef CYTHON_ASSUME_SAFE_MACROS 168 | #define CYTHON_ASSUME_SAFE_MACROS 1 169 | #endif 170 | #ifndef CYTHON_UNPACK_METHODS 171 | #define CYTHON_UNPACK_METHODS 1 172 | #endif 173 | #ifndef CYTHON_FAST_THREAD_STATE 174 | #define CYTHON_FAST_THREAD_STATE 1 175 | #endif 176 | #ifndef CYTHON_FAST_PYCALL 177 | #define CYTHON_FAST_PYCALL 1 178 | #endif 179 | #ifndef CYTHON_PEP489_MULTI_PHASE_INIT 180 | #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) 181 | #endif 182 | #ifndef CYTHON_USE_TP_FINALIZE 183 | #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) 184 | #endif 185 | #ifndef CYTHON_USE_DICT_VERSIONS 186 | #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) 187 | #endif 188 | #ifndef CYTHON_USE_EXC_INFO_STACK 189 | #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) 190 | #endif 191 | #endif 192 | #if !defined(CYTHON_FAST_PYCCALL) 193 | #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) 194 | #endif 195 | #if CYTHON_USE_PYLONG_INTERNALS 196 | #include "longintrepr.h" 197 | #undef SHIFT 198 | #undef BASE 199 | #undef MASK 200 | #ifdef SIZEOF_VOID_P 201 | enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; 202 | #endif 203 | #endif 204 | #ifndef __has_attribute 205 | #define __has_attribute(x) 0 206 | #endif 207 | #ifndef __has_cpp_attribute 208 | #define __has_cpp_attribute(x) 0 209 | #endif 210 | #ifndef CYTHON_RESTRICT 211 | #if defined(__GNUC__) 212 | #define CYTHON_RESTRICT __restrict__ 213 | #elif defined(_MSC_VER) && _MSC_VER >= 1400 214 | #define CYTHON_RESTRICT __restrict 215 | #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 216 | #define CYTHON_RESTRICT restrict 217 | #else 218 | #define CYTHON_RESTRICT 219 | #endif 220 | #endif 221 | #ifndef CYTHON_UNUSED 222 | # if defined(__GNUC__) 223 | # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 224 | # define CYTHON_UNUSED __attribute__ ((__unused__)) 225 | # else 226 | # define CYTHON_UNUSED 227 | # endif 228 | # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) 229 | # define CYTHON_UNUSED __attribute__ ((__unused__)) 230 | # else 231 | # define CYTHON_UNUSED 232 | # endif 233 | #endif 234 | #ifndef CYTHON_MAYBE_UNUSED_VAR 235 | # if defined(__cplusplus) 236 | template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } 237 | # else 238 | # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) 239 | # endif 240 | #endif 241 | #ifndef CYTHON_NCP_UNUSED 242 | # if CYTHON_COMPILING_IN_CPYTHON 243 | # define CYTHON_NCP_UNUSED 244 | # else 245 | # define CYTHON_NCP_UNUSED CYTHON_UNUSED 246 | # endif 247 | #endif 248 | #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) 249 | #ifdef _MSC_VER 250 | #ifndef _MSC_STDINT_H_ 251 | #if _MSC_VER < 1300 252 | typedef unsigned char uint8_t; 253 | typedef unsigned int uint32_t; 254 | #else 255 | typedef unsigned __int8 uint8_t; 256 | typedef unsigned __int32 uint32_t; 257 | #endif 258 | #endif 259 | #else 260 | #include 261 | #endif 262 | #ifndef CYTHON_FALLTHROUGH 263 | #if defined(__cplusplus) && __cplusplus >= 201103L 264 | #if __has_cpp_attribute(fallthrough) 265 | #define CYTHON_FALLTHROUGH [[fallthrough]] 266 | #elif __has_cpp_attribute(clang::fallthrough) 267 | #define CYTHON_FALLTHROUGH [[clang::fallthrough]] 268 | #elif __has_cpp_attribute(gnu::fallthrough) 269 | #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] 270 | #endif 271 | #endif 272 | #ifndef CYTHON_FALLTHROUGH 273 | #if __has_attribute(fallthrough) 274 | #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) 275 | #else 276 | #define CYTHON_FALLTHROUGH 277 | #endif 278 | #endif 279 | #if defined(__clang__ ) && defined(__apple_build_version__) 280 | #if __apple_build_version__ < 7000000 281 | #undef CYTHON_FALLTHROUGH 282 | #define CYTHON_FALLTHROUGH 283 | #endif 284 | #endif 285 | #endif 286 | 287 | #ifndef CYTHON_INLINE 288 | #if defined(__clang__) 289 | #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) 290 | #elif defined(__GNUC__) 291 | #define CYTHON_INLINE __inline__ 292 | #elif defined(_MSC_VER) 293 | #define CYTHON_INLINE __inline 294 | #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 295 | #define CYTHON_INLINE inline 296 | #else 297 | #define CYTHON_INLINE 298 | #endif 299 | #endif 300 | 301 | #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) 302 | #define Py_OptimizeFlag 0 303 | #endif 304 | #define __PYX_BUILD_PY_SSIZE_T "n" 305 | #define CYTHON_FORMAT_SSIZE_T "z" 306 | #if PY_MAJOR_VERSION < 3 307 | #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" 308 | #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ 309 | PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) 310 | #define __Pyx_DefaultClassType PyClass_Type 311 | #else 312 | #define __Pyx_BUILTIN_MODULE_NAME "builtins" 313 | #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ 314 | PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) 315 | #define __Pyx_DefaultClassType PyType_Type 316 | #endif 317 | #ifndef Py_TPFLAGS_CHECKTYPES 318 | #define Py_TPFLAGS_CHECKTYPES 0 319 | #endif 320 | #ifndef Py_TPFLAGS_HAVE_INDEX 321 | #define Py_TPFLAGS_HAVE_INDEX 0 322 | #endif 323 | #ifndef Py_TPFLAGS_HAVE_NEWBUFFER 324 | #define Py_TPFLAGS_HAVE_NEWBUFFER 0 325 | #endif 326 | #ifndef Py_TPFLAGS_HAVE_FINALIZE 327 | #define Py_TPFLAGS_HAVE_FINALIZE 0 328 | #endif 329 | #ifndef METH_STACKLESS 330 | #define METH_STACKLESS 0 331 | #endif 332 | #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) 333 | #ifndef METH_FASTCALL 334 | #define METH_FASTCALL 0x80 335 | #endif 336 | typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); 337 | typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, 338 | Py_ssize_t nargs, PyObject *kwnames); 339 | #else 340 | #define __Pyx_PyCFunctionFast _PyCFunctionFast 341 | #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords 342 | #endif 343 | #if CYTHON_FAST_PYCCALL 344 | #define __Pyx_PyFastCFunction_Check(func)\ 345 | ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) 346 | #else 347 | #define __Pyx_PyFastCFunction_Check(func) 0 348 | #endif 349 | #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) 350 | #define PyObject_Malloc(s) PyMem_Malloc(s) 351 | #define PyObject_Free(p) PyMem_Free(p) 352 | #define PyObject_Realloc(p) PyMem_Realloc(p) 353 | #endif 354 | #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 355 | #define PyMem_RawMalloc(n) PyMem_Malloc(n) 356 | #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) 357 | #define PyMem_RawFree(p) PyMem_Free(p) 358 | #endif 359 | #if CYTHON_COMPILING_IN_PYSTON 360 | #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) 361 | #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) 362 | #else 363 | #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) 364 | #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) 365 | #endif 366 | #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 367 | #define __Pyx_PyThreadState_Current PyThreadState_GET() 368 | #elif PY_VERSION_HEX >= 0x03060000 369 | #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() 370 | #elif PY_VERSION_HEX >= 0x03000000 371 | #define __Pyx_PyThreadState_Current PyThreadState_GET() 372 | #else 373 | #define __Pyx_PyThreadState_Current _PyThreadState_Current 374 | #endif 375 | #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) 376 | #include "pythread.h" 377 | #define Py_tss_NEEDS_INIT 0 378 | typedef int Py_tss_t; 379 | static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { 380 | *key = PyThread_create_key(); 381 | return 0; 382 | } 383 | static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { 384 | Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); 385 | *key = Py_tss_NEEDS_INIT; 386 | return key; 387 | } 388 | static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { 389 | PyObject_Free(key); 390 | } 391 | static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { 392 | return *key != Py_tss_NEEDS_INIT; 393 | } 394 | static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { 395 | PyThread_delete_key(*key); 396 | *key = Py_tss_NEEDS_INIT; 397 | } 398 | static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { 399 | return PyThread_set_key_value(*key, value); 400 | } 401 | static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { 402 | return PyThread_get_key_value(*key); 403 | } 404 | #endif 405 | #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) 406 | #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) 407 | #else 408 | #define __Pyx_PyDict_NewPresized(n) PyDict_New() 409 | #endif 410 | #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION 411 | #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) 412 | #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) 413 | #else 414 | #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) 415 | #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) 416 | #endif 417 | #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS 418 | #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) 419 | #else 420 | #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) 421 | #endif 422 | #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) 423 | #define CYTHON_PEP393_ENABLED 1 424 | #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 425 | 0 : _PyUnicode_Ready((PyObject *)(op))) 426 | #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) 427 | #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) 428 | #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) 429 | #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) 430 | #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) 431 | #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) 432 | #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) 433 | #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) 434 | #else 435 | #define CYTHON_PEP393_ENABLED 0 436 | #define PyUnicode_1BYTE_KIND 1 437 | #define PyUnicode_2BYTE_KIND 2 438 | #define PyUnicode_4BYTE_KIND 4 439 | #define __Pyx_PyUnicode_READY(op) (0) 440 | #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) 441 | #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) 442 | #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) 443 | #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) 444 | #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) 445 | #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) 446 | #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) 447 | #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) 448 | #endif 449 | #if CYTHON_COMPILING_IN_PYPY 450 | #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) 451 | #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) 452 | #else 453 | #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) 454 | #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ 455 | PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) 456 | #endif 457 | #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) 458 | #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) 459 | #endif 460 | #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) 461 | #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) 462 | #endif 463 | #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) 464 | #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) 465 | #endif 466 | #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)) 467 | #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) 468 | #if PY_MAJOR_VERSION >= 3 469 | #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) 470 | #else 471 | #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) 472 | #endif 473 | #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) 474 | #define PyObject_ASCII(o) PyObject_Repr(o) 475 | #endif 476 | #if PY_MAJOR_VERSION >= 3 477 | #define PyBaseString_Type PyUnicode_Type 478 | #define PyStringObject PyUnicodeObject 479 | #define PyString_Type PyUnicode_Type 480 | #define PyString_Check PyUnicode_Check 481 | #define PyString_CheckExact PyUnicode_CheckExact 482 | #define PyObject_Unicode PyObject_Str 483 | #endif 484 | #if PY_MAJOR_VERSION >= 3 485 | #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) 486 | #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) 487 | #else 488 | #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) 489 | #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) 490 | #endif 491 | #ifndef PySet_CheckExact 492 | #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) 493 | #endif 494 | #if CYTHON_ASSUME_SAFE_MACROS 495 | #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) 496 | #else 497 | #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) 498 | #endif 499 | #if PY_MAJOR_VERSION >= 3 500 | #define PyIntObject PyLongObject 501 | #define PyInt_Type PyLong_Type 502 | #define PyInt_Check(op) PyLong_Check(op) 503 | #define PyInt_CheckExact(op) PyLong_CheckExact(op) 504 | #define PyInt_FromString PyLong_FromString 505 | #define PyInt_FromUnicode PyLong_FromUnicode 506 | #define PyInt_FromLong PyLong_FromLong 507 | #define PyInt_FromSize_t PyLong_FromSize_t 508 | #define PyInt_FromSsize_t PyLong_FromSsize_t 509 | #define PyInt_AsLong PyLong_AsLong 510 | #define PyInt_AS_LONG PyLong_AS_LONG 511 | #define PyInt_AsSsize_t PyLong_AsSsize_t 512 | #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask 513 | #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask 514 | #define PyNumber_Int PyNumber_Long 515 | #endif 516 | #if PY_MAJOR_VERSION >= 3 517 | #define PyBoolObject PyLongObject 518 | #endif 519 | #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY 520 | #ifndef PyUnicode_InternFromString 521 | #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) 522 | #endif 523 | #endif 524 | #if PY_VERSION_HEX < 0x030200A4 525 | typedef long Py_hash_t; 526 | #define __Pyx_PyInt_FromHash_t PyInt_FromLong 527 | #define __Pyx_PyInt_AsHash_t PyInt_AsLong 528 | #else 529 | #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t 530 | #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t 531 | #endif 532 | #if PY_MAJOR_VERSION >= 3 533 | #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) 534 | #else 535 | #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) 536 | #endif 537 | #if CYTHON_USE_ASYNC_SLOTS 538 | #if PY_VERSION_HEX >= 0x030500B1 539 | #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods 540 | #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) 541 | #else 542 | #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) 543 | #endif 544 | #else 545 | #define __Pyx_PyType_AsAsync(obj) NULL 546 | #endif 547 | #ifndef __Pyx_PyAsyncMethodsStruct 548 | typedef struct { 549 | unaryfunc am_await; 550 | unaryfunc am_aiter; 551 | unaryfunc am_anext; 552 | } __Pyx_PyAsyncMethodsStruct; 553 | #endif 554 | 555 | #if defined(WIN32) || defined(MS_WINDOWS) 556 | #define _USE_MATH_DEFINES 557 | #endif 558 | #include 559 | #ifdef NAN 560 | #define __PYX_NAN() ((float) NAN) 561 | #else 562 | static CYTHON_INLINE float __PYX_NAN() { 563 | float value; 564 | memset(&value, 0xFF, sizeof(value)); 565 | return value; 566 | } 567 | #endif 568 | #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) 569 | #define __Pyx_truncl trunc 570 | #else 571 | #define __Pyx_truncl truncl 572 | #endif 573 | 574 | 575 | #define __PYX_ERR(f_index, lineno, Ln_error) \ 576 | { \ 577 | __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ 578 | } 579 | 580 | #ifndef __PYX_EXTERN_C 581 | #ifdef __cplusplus 582 | #define __PYX_EXTERN_C extern "C" 583 | #else 584 | #define __PYX_EXTERN_C extern 585 | #endif 586 | #endif 587 | 588 | #define __PYX_HAVE__led 589 | #define __PYX_HAVE_API__led 590 | /* Early includes */ 591 | #include "led.h" 592 | #include 593 | #include 594 | #ifdef _OPENMP 595 | #include 596 | #endif /* _OPENMP */ 597 | 598 | #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) 599 | #define CYTHON_WITHOUT_ASSERTIONS 600 | #endif 601 | 602 | typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; 603 | const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; 604 | 605 | #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 606 | #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 607 | #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) 608 | #define __PYX_DEFAULT_STRING_ENCODING "" 609 | #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString 610 | #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize 611 | #define __Pyx_uchar_cast(c) ((unsigned char)c) 612 | #define __Pyx_long_cast(x) ((long)x) 613 | #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ 614 | (sizeof(type) < sizeof(Py_ssize_t)) ||\ 615 | (sizeof(type) > sizeof(Py_ssize_t) &&\ 616 | likely(v < (type)PY_SSIZE_T_MAX ||\ 617 | v == (type)PY_SSIZE_T_MAX) &&\ 618 | (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ 619 | v == (type)PY_SSIZE_T_MIN))) ||\ 620 | (sizeof(type) == sizeof(Py_ssize_t) &&\ 621 | (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ 622 | v == (type)PY_SSIZE_T_MAX))) ) 623 | static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { 624 | return (size_t) i < (size_t) limit; 625 | } 626 | #if defined (__cplusplus) && __cplusplus >= 201103L 627 | #include 628 | #define __Pyx_sst_abs(value) std::abs(value) 629 | #elif SIZEOF_INT >= SIZEOF_SIZE_T 630 | #define __Pyx_sst_abs(value) abs(value) 631 | #elif SIZEOF_LONG >= SIZEOF_SIZE_T 632 | #define __Pyx_sst_abs(value) labs(value) 633 | #elif defined (_MSC_VER) 634 | #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) 635 | #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 636 | #define __Pyx_sst_abs(value) llabs(value) 637 | #elif defined (__GNUC__) 638 | #define __Pyx_sst_abs(value) __builtin_llabs(value) 639 | #else 640 | #define __Pyx_sst_abs(value) ((value<0) ? -value : value) 641 | #endif 642 | static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); 643 | static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); 644 | #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) 645 | #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) 646 | #define __Pyx_PyBytes_FromString PyBytes_FromString 647 | #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize 648 | static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); 649 | #if PY_MAJOR_VERSION < 3 650 | #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString 651 | #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize 652 | #else 653 | #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString 654 | #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize 655 | #endif 656 | #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) 657 | #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) 658 | #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) 659 | #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) 660 | #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) 661 | #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) 662 | #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) 663 | #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) 664 | #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) 665 | #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) 666 | #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) 667 | #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) 668 | #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) 669 | #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) 670 | #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) 671 | #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) 672 | static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { 673 | const Py_UNICODE *u_end = u; 674 | while (*u_end++) ; 675 | return (size_t)(u_end - u - 1); 676 | } 677 | #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) 678 | #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode 679 | #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode 680 | #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) 681 | #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) 682 | static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); 683 | static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); 684 | static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); 685 | static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); 686 | #define __Pyx_PySequence_Tuple(obj)\ 687 | (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) 688 | static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); 689 | static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); 690 | #if CYTHON_ASSUME_SAFE_MACROS 691 | #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) 692 | #else 693 | #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) 694 | #endif 695 | #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) 696 | #if PY_MAJOR_VERSION >= 3 697 | #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) 698 | #else 699 | #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) 700 | #endif 701 | #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) 702 | #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 703 | static int __Pyx_sys_getdefaultencoding_not_ascii; 704 | static int __Pyx_init_sys_getdefaultencoding_params(void) { 705 | PyObject* sys; 706 | PyObject* default_encoding = NULL; 707 | PyObject* ascii_chars_u = NULL; 708 | PyObject* ascii_chars_b = NULL; 709 | const char* default_encoding_c; 710 | sys = PyImport_ImportModule("sys"); 711 | if (!sys) goto bad; 712 | default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); 713 | Py_DECREF(sys); 714 | if (!default_encoding) goto bad; 715 | default_encoding_c = PyBytes_AsString(default_encoding); 716 | if (!default_encoding_c) goto bad; 717 | if (strcmp(default_encoding_c, "ascii") == 0) { 718 | __Pyx_sys_getdefaultencoding_not_ascii = 0; 719 | } else { 720 | char ascii_chars[128]; 721 | int c; 722 | for (c = 0; c < 128; c++) { 723 | ascii_chars[c] = c; 724 | } 725 | __Pyx_sys_getdefaultencoding_not_ascii = 1; 726 | ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); 727 | if (!ascii_chars_u) goto bad; 728 | ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); 729 | if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { 730 | PyErr_Format( 731 | PyExc_ValueError, 732 | "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", 733 | default_encoding_c); 734 | goto bad; 735 | } 736 | Py_DECREF(ascii_chars_u); 737 | Py_DECREF(ascii_chars_b); 738 | } 739 | Py_DECREF(default_encoding); 740 | return 0; 741 | bad: 742 | Py_XDECREF(default_encoding); 743 | Py_XDECREF(ascii_chars_u); 744 | Py_XDECREF(ascii_chars_b); 745 | return -1; 746 | } 747 | #endif 748 | #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 749 | #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) 750 | #else 751 | #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) 752 | #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 753 | static char* __PYX_DEFAULT_STRING_ENCODING; 754 | static int __Pyx_init_sys_getdefaultencoding_params(void) { 755 | PyObject* sys; 756 | PyObject* default_encoding = NULL; 757 | char* default_encoding_c; 758 | sys = PyImport_ImportModule("sys"); 759 | if (!sys) goto bad; 760 | default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); 761 | Py_DECREF(sys); 762 | if (!default_encoding) goto bad; 763 | default_encoding_c = PyBytes_AsString(default_encoding); 764 | if (!default_encoding_c) goto bad; 765 | __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); 766 | if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; 767 | strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); 768 | Py_DECREF(default_encoding); 769 | return 0; 770 | bad: 771 | Py_XDECREF(default_encoding); 772 | return -1; 773 | } 774 | #endif 775 | #endif 776 | 777 | 778 | /* Test for GCC > 2.95 */ 779 | #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) 780 | #define likely(x) __builtin_expect(!!(x), 1) 781 | #define unlikely(x) __builtin_expect(!!(x), 0) 782 | #else /* !__GNUC__ or GCC < 2.95 */ 783 | #define likely(x) (x) 784 | #define unlikely(x) (x) 785 | #endif /* __GNUC__ */ 786 | static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } 787 | 788 | static PyObject *__pyx_m = NULL; 789 | static PyObject *__pyx_d; 790 | static PyObject *__pyx_b; 791 | static PyObject *__pyx_cython_runtime = NULL; 792 | static PyObject *__pyx_empty_tuple; 793 | static PyObject *__pyx_empty_bytes; 794 | static PyObject *__pyx_empty_unicode; 795 | static int __pyx_lineno; 796 | static int __pyx_clineno = 0; 797 | static const char * __pyx_cfilenm= __FILE__; 798 | static const char *__pyx_filename; 799 | 800 | 801 | static const char *__pyx_f[] = { 802 | "led.pyx", 803 | }; 804 | 805 | /*--- Type declarations ---*/ 806 | 807 | /* --- Runtime support code (head) --- */ 808 | /* Refnanny.proto */ 809 | #ifndef CYTHON_REFNANNY 810 | #define CYTHON_REFNANNY 0 811 | #endif 812 | #if CYTHON_REFNANNY 813 | typedef struct { 814 | void (*INCREF)(void*, PyObject*, int); 815 | void (*DECREF)(void*, PyObject*, int); 816 | void (*GOTREF)(void*, PyObject*, int); 817 | void (*GIVEREF)(void*, PyObject*, int); 818 | void* (*SetupContext)(const char*, int, const char*); 819 | void (*FinishContext)(void**); 820 | } __Pyx_RefNannyAPIStruct; 821 | static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; 822 | static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); 823 | #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; 824 | #ifdef WITH_THREAD 825 | #define __Pyx_RefNannySetupContext(name, acquire_gil)\ 826 | if (acquire_gil) {\ 827 | PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ 828 | __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ 829 | PyGILState_Release(__pyx_gilstate_save);\ 830 | } else {\ 831 | __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ 832 | } 833 | #else 834 | #define __Pyx_RefNannySetupContext(name, acquire_gil)\ 835 | __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) 836 | #endif 837 | #define __Pyx_RefNannyFinishContext()\ 838 | __Pyx_RefNanny->FinishContext(&__pyx_refnanny) 839 | #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 840 | #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 841 | #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 842 | #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 843 | #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) 844 | #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) 845 | #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) 846 | #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) 847 | #else 848 | #define __Pyx_RefNannyDeclarations 849 | #define __Pyx_RefNannySetupContext(name, acquire_gil) 850 | #define __Pyx_RefNannyFinishContext() 851 | #define __Pyx_INCREF(r) Py_INCREF(r) 852 | #define __Pyx_DECREF(r) Py_DECREF(r) 853 | #define __Pyx_GOTREF(r) 854 | #define __Pyx_GIVEREF(r) 855 | #define __Pyx_XINCREF(r) Py_XINCREF(r) 856 | #define __Pyx_XDECREF(r) Py_XDECREF(r) 857 | #define __Pyx_XGOTREF(r) 858 | #define __Pyx_XGIVEREF(r) 859 | #endif 860 | #define __Pyx_XDECREF_SET(r, v) do {\ 861 | PyObject *tmp = (PyObject *) r;\ 862 | r = v; __Pyx_XDECREF(tmp);\ 863 | } while (0) 864 | #define __Pyx_DECREF_SET(r, v) do {\ 865 | PyObject *tmp = (PyObject *) r;\ 866 | r = v; __Pyx_DECREF(tmp);\ 867 | } while (0) 868 | #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) 869 | #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) 870 | 871 | /* PyDictVersioning.proto */ 872 | #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS 873 | #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) 874 | #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) 875 | #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ 876 | (version_var) = __PYX_GET_DICT_VERSION(dict);\ 877 | (cache_var) = (value); 878 | #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ 879 | static PY_UINT64_T __pyx_dict_version = 0;\ 880 | static PyObject *__pyx_dict_cached_value = NULL;\ 881 | if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ 882 | (VAR) = __pyx_dict_cached_value;\ 883 | } else {\ 884 | (VAR) = __pyx_dict_cached_value = (LOOKUP);\ 885 | __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ 886 | }\ 887 | } 888 | static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); 889 | static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); 890 | static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); 891 | #else 892 | #define __PYX_GET_DICT_VERSION(dict) (0) 893 | #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) 894 | #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); 895 | #endif 896 | 897 | /* PyObjectGetAttrStr.proto */ 898 | #if CYTHON_USE_TYPE_SLOTS 899 | static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); 900 | #else 901 | #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) 902 | #endif 903 | 904 | /* PyThreadStateGet.proto */ 905 | #if CYTHON_FAST_THREAD_STATE 906 | #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; 907 | #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; 908 | #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type 909 | #else 910 | #define __Pyx_PyThreadState_declare 911 | #define __Pyx_PyThreadState_assign 912 | #define __Pyx_PyErr_Occurred() PyErr_Occurred() 913 | #endif 914 | 915 | /* PyErrFetchRestore.proto */ 916 | #if CYTHON_FAST_THREAD_STATE 917 | #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) 918 | #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) 919 | #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) 920 | #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) 921 | #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) 922 | static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); 923 | static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); 924 | #if CYTHON_COMPILING_IN_CPYTHON 925 | #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) 926 | #else 927 | #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) 928 | #endif 929 | #else 930 | #define __Pyx_PyErr_Clear() PyErr_Clear() 931 | #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) 932 | #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) 933 | #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) 934 | #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) 935 | #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) 936 | #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) 937 | #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) 938 | #endif 939 | 940 | /* CLineInTraceback.proto */ 941 | #ifdef CYTHON_CLINE_IN_TRACEBACK 942 | #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) 943 | #else 944 | static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); 945 | #endif 946 | 947 | /* CodeObjectCache.proto */ 948 | typedef struct { 949 | PyCodeObject* code_object; 950 | int code_line; 951 | } __Pyx_CodeObjectCacheEntry; 952 | struct __Pyx_CodeObjectCache { 953 | int count; 954 | int max_count; 955 | __Pyx_CodeObjectCacheEntry* entries; 956 | }; 957 | static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; 958 | static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); 959 | static PyCodeObject *__pyx_find_code_object(int code_line); 960 | static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); 961 | 962 | /* AddTraceback.proto */ 963 | static void __Pyx_AddTraceback(const char *funcname, int c_line, 964 | int py_line, const char *filename); 965 | 966 | /* CIntToPy.proto */ 967 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); 968 | 969 | /* CIntToPy.proto */ 970 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); 971 | 972 | /* CIntFromPy.proto */ 973 | static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); 974 | 975 | /* CIntFromPy.proto */ 976 | static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); 977 | 978 | /* FastTypeChecks.proto */ 979 | #if CYTHON_COMPILING_IN_CPYTHON 980 | #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) 981 | static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); 982 | static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); 983 | static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); 984 | #else 985 | #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) 986 | #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) 987 | #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) 988 | #endif 989 | #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) 990 | 991 | /* CheckBinaryVersion.proto */ 992 | static int __Pyx_check_binary_version(void); 993 | 994 | /* InitStrings.proto */ 995 | static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); 996 | 997 | 998 | /* Module declarations from 'cled' */ 999 | 1000 | /* Module declarations from 'cpython.pycapsule' */ 1001 | 1002 | /* Module declarations from 'libc.string' */ 1003 | 1004 | /* Module declarations from 'libc.stdlib' */ 1005 | 1006 | /* Module declarations from 'led' */ 1007 | #define __Pyx_MODULE_NAME "led" 1008 | extern int __pyx_module_is_main_led; 1009 | int __pyx_module_is_main_led = 0; 1010 | 1011 | /* Implementation of 'led' */ 1012 | static const char __pyx_k_led[] = "led"; 1013 | static const char __pyx_k_main[] = "__main__"; 1014 | static const char __pyx_k_name[] = "__name__"; 1015 | static const char __pyx_k_test[] = "__test__"; 1016 | static const char __pyx_k_led_h[] = "led_h"; 1017 | static const char __pyx_k_led_pyx[] = "led.pyx"; 1018 | static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; 1019 | static PyObject *__pyx_n_s_cline_in_traceback; 1020 | static PyObject *__pyx_n_s_led; 1021 | static PyObject *__pyx_n_s_led_h; 1022 | static PyObject *__pyx_kp_s_led_pyx; 1023 | static PyObject *__pyx_n_s_main; 1024 | static PyObject *__pyx_n_s_name; 1025 | static PyObject *__pyx_n_s_test; 1026 | static PyObject *__pyx_pf_3led_led(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ 1027 | static PyObject *__pyx_pf_3led_2led_h(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ 1028 | static PyObject *__pyx_codeobj_; 1029 | static PyObject *__pyx_codeobj__2; 1030 | /* Late includes */ 1031 | 1032 | /* "led.pyx":10 1033 | * 1034 | * 1035 | * def led(): # <<<<<<<<<<<<<< 1036 | * return cled.led() 1037 | * def led_h(): 1038 | */ 1039 | 1040 | /* Python wrapper */ 1041 | static PyObject *__pyx_pw_3led_1led(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ 1042 | static PyMethodDef __pyx_mdef_3led_1led = {"led", (PyCFunction)__pyx_pw_3led_1led, METH_NOARGS, 0}; 1043 | static PyObject *__pyx_pw_3led_1led(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { 1044 | PyObject *__pyx_r = 0; 1045 | __Pyx_RefNannyDeclarations 1046 | __Pyx_RefNannySetupContext("led (wrapper)", 0); 1047 | __pyx_r = __pyx_pf_3led_led(__pyx_self); 1048 | 1049 | /* function exit code */ 1050 | __Pyx_RefNannyFinishContext(); 1051 | return __pyx_r; 1052 | } 1053 | 1054 | static PyObject *__pyx_pf_3led_led(CYTHON_UNUSED PyObject *__pyx_self) { 1055 | PyObject *__pyx_r = NULL; 1056 | __Pyx_RefNannyDeclarations 1057 | PyObject *__pyx_t_1 = NULL; 1058 | __Pyx_RefNannySetupContext("led", 0); 1059 | 1060 | /* "led.pyx":11 1061 | * 1062 | * def led(): 1063 | * return cled.led() # <<<<<<<<<<<<<< 1064 | * def led_h(): 1065 | * return cled.led_h() 1066 | */ 1067 | __Pyx_XDECREF(__pyx_r); 1068 | __pyx_t_1 = __Pyx_PyInt_From_int(led()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) 1069 | __Pyx_GOTREF(__pyx_t_1); 1070 | __pyx_r = __pyx_t_1; 1071 | __pyx_t_1 = 0; 1072 | goto __pyx_L0; 1073 | 1074 | /* "led.pyx":10 1075 | * 1076 | * 1077 | * def led(): # <<<<<<<<<<<<<< 1078 | * return cled.led() 1079 | * def led_h(): 1080 | */ 1081 | 1082 | /* function exit code */ 1083 | __pyx_L1_error:; 1084 | __Pyx_XDECREF(__pyx_t_1); 1085 | __Pyx_AddTraceback("led.led", __pyx_clineno, __pyx_lineno, __pyx_filename); 1086 | __pyx_r = NULL; 1087 | __pyx_L0:; 1088 | __Pyx_XGIVEREF(__pyx_r); 1089 | __Pyx_RefNannyFinishContext(); 1090 | return __pyx_r; 1091 | } 1092 | 1093 | /* "led.pyx":12 1094 | * def led(): 1095 | * return cled.led() 1096 | * def led_h(): # <<<<<<<<<<<<<< 1097 | * return cled.led_h() 1098 | */ 1099 | 1100 | /* Python wrapper */ 1101 | static PyObject *__pyx_pw_3led_3led_h(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ 1102 | static PyMethodDef __pyx_mdef_3led_3led_h = {"led_h", (PyCFunction)__pyx_pw_3led_3led_h, METH_NOARGS, 0}; 1103 | static PyObject *__pyx_pw_3led_3led_h(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { 1104 | PyObject *__pyx_r = 0; 1105 | __Pyx_RefNannyDeclarations 1106 | __Pyx_RefNannySetupContext("led_h (wrapper)", 0); 1107 | __pyx_r = __pyx_pf_3led_2led_h(__pyx_self); 1108 | 1109 | /* function exit code */ 1110 | __Pyx_RefNannyFinishContext(); 1111 | return __pyx_r; 1112 | } 1113 | 1114 | static PyObject *__pyx_pf_3led_2led_h(CYTHON_UNUSED PyObject *__pyx_self) { 1115 | PyObject *__pyx_r = NULL; 1116 | __Pyx_RefNannyDeclarations 1117 | PyObject *__pyx_t_1 = NULL; 1118 | __Pyx_RefNannySetupContext("led_h", 0); 1119 | 1120 | /* "led.pyx":13 1121 | * return cled.led() 1122 | * def led_h(): 1123 | * return cled.led_h() # <<<<<<<<<<<<<< 1124 | */ 1125 | __Pyx_XDECREF(__pyx_r); 1126 | __pyx_t_1 = __Pyx_PyInt_From_int(led_h()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) 1127 | __Pyx_GOTREF(__pyx_t_1); 1128 | __pyx_r = __pyx_t_1; 1129 | __pyx_t_1 = 0; 1130 | goto __pyx_L0; 1131 | 1132 | /* "led.pyx":12 1133 | * def led(): 1134 | * return cled.led() 1135 | * def led_h(): # <<<<<<<<<<<<<< 1136 | * return cled.led_h() 1137 | */ 1138 | 1139 | /* function exit code */ 1140 | __pyx_L1_error:; 1141 | __Pyx_XDECREF(__pyx_t_1); 1142 | __Pyx_AddTraceback("led.led_h", __pyx_clineno, __pyx_lineno, __pyx_filename); 1143 | __pyx_r = NULL; 1144 | __pyx_L0:; 1145 | __Pyx_XGIVEREF(__pyx_r); 1146 | __Pyx_RefNannyFinishContext(); 1147 | return __pyx_r; 1148 | } 1149 | 1150 | static PyMethodDef __pyx_methods[] = { 1151 | {0, 0, 0, 0} 1152 | }; 1153 | 1154 | #if PY_MAJOR_VERSION >= 3 1155 | #if CYTHON_PEP489_MULTI_PHASE_INIT 1156 | static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ 1157 | static int __pyx_pymod_exec_led(PyObject* module); /*proto*/ 1158 | static PyModuleDef_Slot __pyx_moduledef_slots[] = { 1159 | {Py_mod_create, (void*)__pyx_pymod_create}, 1160 | {Py_mod_exec, (void*)__pyx_pymod_exec_led}, 1161 | {0, NULL} 1162 | }; 1163 | #endif 1164 | 1165 | static struct PyModuleDef __pyx_moduledef = { 1166 | PyModuleDef_HEAD_INIT, 1167 | "led", 1168 | 0, /* m_doc */ 1169 | #if CYTHON_PEP489_MULTI_PHASE_INIT 1170 | 0, /* m_size */ 1171 | #else 1172 | -1, /* m_size */ 1173 | #endif 1174 | __pyx_methods /* m_methods */, 1175 | #if CYTHON_PEP489_MULTI_PHASE_INIT 1176 | __pyx_moduledef_slots, /* m_slots */ 1177 | #else 1178 | NULL, /* m_reload */ 1179 | #endif 1180 | NULL, /* m_traverse */ 1181 | NULL, /* m_clear */ 1182 | NULL /* m_free */ 1183 | }; 1184 | #endif 1185 | #ifndef CYTHON_SMALL_CODE 1186 | #if defined(__clang__) 1187 | #define CYTHON_SMALL_CODE 1188 | #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) 1189 | #define CYTHON_SMALL_CODE __attribute__((cold)) 1190 | #else 1191 | #define CYTHON_SMALL_CODE 1192 | #endif 1193 | #endif 1194 | 1195 | static __Pyx_StringTabEntry __pyx_string_tab[] = { 1196 | {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, 1197 | {&__pyx_n_s_led, __pyx_k_led, sizeof(__pyx_k_led), 0, 0, 1, 1}, 1198 | {&__pyx_n_s_led_h, __pyx_k_led_h, sizeof(__pyx_k_led_h), 0, 0, 1, 1}, 1199 | {&__pyx_kp_s_led_pyx, __pyx_k_led_pyx, sizeof(__pyx_k_led_pyx), 0, 0, 1, 0}, 1200 | {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, 1201 | {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, 1202 | {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, 1203 | {0, 0, 0, 0, 0, 0, 0} 1204 | }; 1205 | static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { 1206 | return 0; 1207 | } 1208 | 1209 | static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { 1210 | __Pyx_RefNannyDeclarations 1211 | __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); 1212 | 1213 | /* "led.pyx":10 1214 | * 1215 | * 1216 | * def led(): # <<<<<<<<<<<<<< 1217 | * return cled.led() 1218 | * def led_h(): 1219 | */ 1220 | __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_led_pyx, __pyx_n_s_led, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 10, __pyx_L1_error) 1221 | 1222 | /* "led.pyx":12 1223 | * def led(): 1224 | * return cled.led() 1225 | * def led_h(): # <<<<<<<<<<<<<< 1226 | * return cled.led_h() 1227 | */ 1228 | __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_led_pyx, __pyx_n_s_led_h, 12, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 12, __pyx_L1_error) 1229 | __Pyx_RefNannyFinishContext(); 1230 | return 0; 1231 | __pyx_L1_error:; 1232 | __Pyx_RefNannyFinishContext(); 1233 | return -1; 1234 | } 1235 | 1236 | static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { 1237 | if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); 1238 | return 0; 1239 | __pyx_L1_error:; 1240 | return -1; 1241 | } 1242 | 1243 | static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ 1244 | static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ 1245 | static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ 1246 | static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ 1247 | static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ 1248 | static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ 1249 | static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ 1250 | 1251 | static int __Pyx_modinit_global_init_code(void) { 1252 | __Pyx_RefNannyDeclarations 1253 | __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); 1254 | /*--- Global init code ---*/ 1255 | __Pyx_RefNannyFinishContext(); 1256 | return 0; 1257 | } 1258 | 1259 | static int __Pyx_modinit_variable_export_code(void) { 1260 | __Pyx_RefNannyDeclarations 1261 | __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); 1262 | /*--- Variable export code ---*/ 1263 | __Pyx_RefNannyFinishContext(); 1264 | return 0; 1265 | } 1266 | 1267 | static int __Pyx_modinit_function_export_code(void) { 1268 | __Pyx_RefNannyDeclarations 1269 | __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); 1270 | /*--- Function export code ---*/ 1271 | __Pyx_RefNannyFinishContext(); 1272 | return 0; 1273 | } 1274 | 1275 | static int __Pyx_modinit_type_init_code(void) { 1276 | __Pyx_RefNannyDeclarations 1277 | __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); 1278 | /*--- Type init code ---*/ 1279 | __Pyx_RefNannyFinishContext(); 1280 | return 0; 1281 | } 1282 | 1283 | static int __Pyx_modinit_type_import_code(void) { 1284 | __Pyx_RefNannyDeclarations 1285 | __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); 1286 | /*--- Type import code ---*/ 1287 | __Pyx_RefNannyFinishContext(); 1288 | return 0; 1289 | } 1290 | 1291 | static int __Pyx_modinit_variable_import_code(void) { 1292 | __Pyx_RefNannyDeclarations 1293 | __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); 1294 | /*--- Variable import code ---*/ 1295 | __Pyx_RefNannyFinishContext(); 1296 | return 0; 1297 | } 1298 | 1299 | static int __Pyx_modinit_function_import_code(void) { 1300 | __Pyx_RefNannyDeclarations 1301 | __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); 1302 | /*--- Function import code ---*/ 1303 | __Pyx_RefNannyFinishContext(); 1304 | return 0; 1305 | } 1306 | 1307 | 1308 | #if PY_MAJOR_VERSION < 3 1309 | #ifdef CYTHON_NO_PYINIT_EXPORT 1310 | #define __Pyx_PyMODINIT_FUNC void 1311 | #else 1312 | #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC 1313 | #endif 1314 | #else 1315 | #ifdef CYTHON_NO_PYINIT_EXPORT 1316 | #define __Pyx_PyMODINIT_FUNC PyObject * 1317 | #else 1318 | #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC 1319 | #endif 1320 | #endif 1321 | 1322 | 1323 | #if PY_MAJOR_VERSION < 3 1324 | __Pyx_PyMODINIT_FUNC initled(void) CYTHON_SMALL_CODE; /*proto*/ 1325 | __Pyx_PyMODINIT_FUNC initled(void) 1326 | #else 1327 | __Pyx_PyMODINIT_FUNC PyInit_led(void) CYTHON_SMALL_CODE; /*proto*/ 1328 | __Pyx_PyMODINIT_FUNC PyInit_led(void) 1329 | #if CYTHON_PEP489_MULTI_PHASE_INIT 1330 | { 1331 | return PyModuleDef_Init(&__pyx_moduledef); 1332 | } 1333 | static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { 1334 | #if PY_VERSION_HEX >= 0x030700A1 1335 | static PY_INT64_T main_interpreter_id = -1; 1336 | PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); 1337 | if (main_interpreter_id == -1) { 1338 | main_interpreter_id = current_id; 1339 | return (unlikely(current_id == -1)) ? -1 : 0; 1340 | } else if (unlikely(main_interpreter_id != current_id)) 1341 | #else 1342 | static PyInterpreterState *main_interpreter = NULL; 1343 | PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; 1344 | if (!main_interpreter) { 1345 | main_interpreter = current_interpreter; 1346 | } else if (unlikely(main_interpreter != current_interpreter)) 1347 | #endif 1348 | { 1349 | PyErr_SetString( 1350 | PyExc_ImportError, 1351 | "Interpreter change detected - this module can only be loaded into one interpreter per process."); 1352 | return -1; 1353 | } 1354 | return 0; 1355 | } 1356 | 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) { 1357 | PyObject *value = PyObject_GetAttrString(spec, from_name); 1358 | int result = 0; 1359 | if (likely(value)) { 1360 | if (allow_none || value != Py_None) { 1361 | result = PyDict_SetItemString(moddict, to_name, value); 1362 | } 1363 | Py_DECREF(value); 1364 | } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { 1365 | PyErr_Clear(); 1366 | } else { 1367 | result = -1; 1368 | } 1369 | return result; 1370 | } 1371 | static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { 1372 | PyObject *module = NULL, *moddict, *modname; 1373 | if (__Pyx_check_single_interpreter()) 1374 | return NULL; 1375 | if (__pyx_m) 1376 | return __Pyx_NewRef(__pyx_m); 1377 | modname = PyObject_GetAttrString(spec, "name"); 1378 | if (unlikely(!modname)) goto bad; 1379 | module = PyModule_NewObject(modname); 1380 | Py_DECREF(modname); 1381 | if (unlikely(!module)) goto bad; 1382 | moddict = PyModule_GetDict(module); 1383 | if (unlikely(!moddict)) goto bad; 1384 | if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; 1385 | if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; 1386 | if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; 1387 | if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; 1388 | return module; 1389 | bad: 1390 | Py_XDECREF(module); 1391 | return NULL; 1392 | } 1393 | 1394 | 1395 | static CYTHON_SMALL_CODE int __pyx_pymod_exec_led(PyObject *__pyx_pyinit_module) 1396 | #endif 1397 | #endif 1398 | { 1399 | PyObject *__pyx_t_1 = NULL; 1400 | __Pyx_RefNannyDeclarations 1401 | #if CYTHON_PEP489_MULTI_PHASE_INIT 1402 | if (__pyx_m) { 1403 | if (__pyx_m == __pyx_pyinit_module) return 0; 1404 | PyErr_SetString(PyExc_RuntimeError, "Module 'led' has already been imported. Re-initialisation is not supported."); 1405 | return -1; 1406 | } 1407 | #elif PY_MAJOR_VERSION >= 3 1408 | if (__pyx_m) return __Pyx_NewRef(__pyx_m); 1409 | #endif 1410 | #if CYTHON_REFNANNY 1411 | __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); 1412 | if (!__Pyx_RefNanny) { 1413 | PyErr_Clear(); 1414 | __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); 1415 | if (!__Pyx_RefNanny) 1416 | Py_FatalError("failed to import 'refnanny' module"); 1417 | } 1418 | #endif 1419 | __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_led(void)", 0); 1420 | if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1421 | #ifdef __Pxy_PyFrame_Initialize_Offsets 1422 | __Pxy_PyFrame_Initialize_Offsets(); 1423 | #endif 1424 | __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) 1425 | __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) 1426 | __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) 1427 | #ifdef __Pyx_CyFunction_USED 1428 | if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1429 | #endif 1430 | #ifdef __Pyx_FusedFunction_USED 1431 | if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1432 | #endif 1433 | #ifdef __Pyx_Coroutine_USED 1434 | if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1435 | #endif 1436 | #ifdef __Pyx_Generator_USED 1437 | if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1438 | #endif 1439 | #ifdef __Pyx_AsyncGen_USED 1440 | if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1441 | #endif 1442 | #ifdef __Pyx_StopAsyncIteration_USED 1443 | if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1444 | #endif 1445 | /*--- Library function declarations ---*/ 1446 | /*--- Threads initialization code ---*/ 1447 | #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS 1448 | #ifdef WITH_THREAD /* Python build with threading support? */ 1449 | PyEval_InitThreads(); 1450 | #endif 1451 | #endif 1452 | /*--- Module creation code ---*/ 1453 | #if CYTHON_PEP489_MULTI_PHASE_INIT 1454 | __pyx_m = __pyx_pyinit_module; 1455 | Py_INCREF(__pyx_m); 1456 | #else 1457 | #if PY_MAJOR_VERSION < 3 1458 | __pyx_m = Py_InitModule4("led", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); 1459 | #else 1460 | __pyx_m = PyModule_Create(&__pyx_moduledef); 1461 | #endif 1462 | if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) 1463 | #endif 1464 | __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) 1465 | Py_INCREF(__pyx_d); 1466 | __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) 1467 | __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) 1468 | #if CYTHON_COMPILING_IN_PYPY 1469 | Py_INCREF(__pyx_b); 1470 | #endif 1471 | if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); 1472 | /*--- Initialize various global constants etc. ---*/ 1473 | if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1474 | #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) 1475 | if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1476 | #endif 1477 | if (__pyx_module_is_main_led) { 1478 | if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1479 | } 1480 | #if PY_MAJOR_VERSION >= 3 1481 | { 1482 | PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) 1483 | if (!PyDict_GetItemString(modules, "led")) { 1484 | if (unlikely(PyDict_SetItemString(modules, "led", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) 1485 | } 1486 | } 1487 | #endif 1488 | /*--- Builtin init code ---*/ 1489 | if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1490 | /*--- Constants init code ---*/ 1491 | if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1492 | /*--- Global type/function init code ---*/ 1493 | (void)__Pyx_modinit_global_init_code(); 1494 | (void)__Pyx_modinit_variable_export_code(); 1495 | (void)__Pyx_modinit_function_export_code(); 1496 | (void)__Pyx_modinit_type_init_code(); 1497 | (void)__Pyx_modinit_type_import_code(); 1498 | (void)__Pyx_modinit_variable_import_code(); 1499 | (void)__Pyx_modinit_function_import_code(); 1500 | /*--- Execution code ---*/ 1501 | #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) 1502 | if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1503 | #endif 1504 | 1505 | /* "led.pyx":10 1506 | * 1507 | * 1508 | * def led(): # <<<<<<<<<<<<<< 1509 | * return cled.led() 1510 | * def led_h(): 1511 | */ 1512 | __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3led_1led, NULL, __pyx_n_s_led); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) 1513 | __Pyx_GOTREF(__pyx_t_1); 1514 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_led, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) 1515 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 1516 | 1517 | /* "led.pyx":12 1518 | * def led(): 1519 | * return cled.led() 1520 | * def led_h(): # <<<<<<<<<<<<<< 1521 | * return cled.led_h() 1522 | */ 1523 | __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3led_3led_h, NULL, __pyx_n_s_led); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) 1524 | __Pyx_GOTREF(__pyx_t_1); 1525 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_led_h, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) 1526 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 1527 | 1528 | /* "led.pyx":1 1529 | * # Import the low-level C declarations # <<<<<<<<<<<<<< 1530 | * cimport cled 1531 | * 1532 | */ 1533 | __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) 1534 | __Pyx_GOTREF(__pyx_t_1); 1535 | if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 1536 | __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 1537 | 1538 | /*--- Wrapped vars code ---*/ 1539 | 1540 | goto __pyx_L0; 1541 | __pyx_L1_error:; 1542 | __Pyx_XDECREF(__pyx_t_1); 1543 | if (__pyx_m) { 1544 | if (__pyx_d) { 1545 | __Pyx_AddTraceback("init led", __pyx_clineno, __pyx_lineno, __pyx_filename); 1546 | } 1547 | Py_CLEAR(__pyx_m); 1548 | } else if (!PyErr_Occurred()) { 1549 | PyErr_SetString(PyExc_ImportError, "init led"); 1550 | } 1551 | __pyx_L0:; 1552 | __Pyx_RefNannyFinishContext(); 1553 | #if CYTHON_PEP489_MULTI_PHASE_INIT 1554 | return (__pyx_m != NULL) ? 0 : -1; 1555 | #elif PY_MAJOR_VERSION >= 3 1556 | return __pyx_m; 1557 | #else 1558 | return; 1559 | #endif 1560 | } 1561 | 1562 | /* --- Runtime support code --- */ 1563 | /* Refnanny */ 1564 | #if CYTHON_REFNANNY 1565 | static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { 1566 | PyObject *m = NULL, *p = NULL; 1567 | void *r = NULL; 1568 | m = PyImport_ImportModule(modname); 1569 | if (!m) goto end; 1570 | p = PyObject_GetAttrString(m, "RefNannyAPI"); 1571 | if (!p) goto end; 1572 | r = PyLong_AsVoidPtr(p); 1573 | end: 1574 | Py_XDECREF(p); 1575 | Py_XDECREF(m); 1576 | return (__Pyx_RefNannyAPIStruct *)r; 1577 | } 1578 | #endif 1579 | 1580 | /* PyDictVersioning */ 1581 | #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS 1582 | static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { 1583 | PyObject *dict = Py_TYPE(obj)->tp_dict; 1584 | return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; 1585 | } 1586 | static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { 1587 | PyObject **dictptr = NULL; 1588 | Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; 1589 | if (offset) { 1590 | #if CYTHON_COMPILING_IN_CPYTHON 1591 | dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); 1592 | #else 1593 | dictptr = _PyObject_GetDictPtr(obj); 1594 | #endif 1595 | } 1596 | return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; 1597 | } 1598 | static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { 1599 | PyObject *dict = Py_TYPE(obj)->tp_dict; 1600 | if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) 1601 | return 0; 1602 | return obj_dict_version == __Pyx_get_object_dict_version(obj); 1603 | } 1604 | #endif 1605 | 1606 | /* PyObjectGetAttrStr */ 1607 | #if CYTHON_USE_TYPE_SLOTS 1608 | static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { 1609 | PyTypeObject* tp = Py_TYPE(obj); 1610 | if (likely(tp->tp_getattro)) 1611 | return tp->tp_getattro(obj, attr_name); 1612 | #if PY_MAJOR_VERSION < 3 1613 | if (likely(tp->tp_getattr)) 1614 | return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); 1615 | #endif 1616 | return PyObject_GetAttr(obj, attr_name); 1617 | } 1618 | #endif 1619 | 1620 | /* PyErrFetchRestore */ 1621 | #if CYTHON_FAST_THREAD_STATE 1622 | static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { 1623 | PyObject *tmp_type, *tmp_value, *tmp_tb; 1624 | tmp_type = tstate->curexc_type; 1625 | tmp_value = tstate->curexc_value; 1626 | tmp_tb = tstate->curexc_traceback; 1627 | tstate->curexc_type = type; 1628 | tstate->curexc_value = value; 1629 | tstate->curexc_traceback = tb; 1630 | Py_XDECREF(tmp_type); 1631 | Py_XDECREF(tmp_value); 1632 | Py_XDECREF(tmp_tb); 1633 | } 1634 | static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { 1635 | *type = tstate->curexc_type; 1636 | *value = tstate->curexc_value; 1637 | *tb = tstate->curexc_traceback; 1638 | tstate->curexc_type = 0; 1639 | tstate->curexc_value = 0; 1640 | tstate->curexc_traceback = 0; 1641 | } 1642 | #endif 1643 | 1644 | /* CLineInTraceback */ 1645 | #ifndef CYTHON_CLINE_IN_TRACEBACK 1646 | static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { 1647 | PyObject *use_cline; 1648 | PyObject *ptype, *pvalue, *ptraceback; 1649 | #if CYTHON_COMPILING_IN_CPYTHON 1650 | PyObject **cython_runtime_dict; 1651 | #endif 1652 | if (unlikely(!__pyx_cython_runtime)) { 1653 | return c_line; 1654 | } 1655 | __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); 1656 | #if CYTHON_COMPILING_IN_CPYTHON 1657 | cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); 1658 | if (likely(cython_runtime_dict)) { 1659 | __PYX_PY_DICT_LOOKUP_IF_MODIFIED( 1660 | use_cline, *cython_runtime_dict, 1661 | __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) 1662 | } else 1663 | #endif 1664 | { 1665 | PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); 1666 | if (use_cline_obj) { 1667 | use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; 1668 | Py_DECREF(use_cline_obj); 1669 | } else { 1670 | PyErr_Clear(); 1671 | use_cline = NULL; 1672 | } 1673 | } 1674 | if (!use_cline) { 1675 | c_line = 0; 1676 | PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); 1677 | } 1678 | else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { 1679 | c_line = 0; 1680 | } 1681 | __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); 1682 | return c_line; 1683 | } 1684 | #endif 1685 | 1686 | /* CodeObjectCache */ 1687 | static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { 1688 | int start = 0, mid = 0, end = count - 1; 1689 | if (end >= 0 && code_line > entries[end].code_line) { 1690 | return count; 1691 | } 1692 | while (start < end) { 1693 | mid = start + (end - start) / 2; 1694 | if (code_line < entries[mid].code_line) { 1695 | end = mid; 1696 | } else if (code_line > entries[mid].code_line) { 1697 | start = mid + 1; 1698 | } else { 1699 | return mid; 1700 | } 1701 | } 1702 | if (code_line <= entries[mid].code_line) { 1703 | return mid; 1704 | } else { 1705 | return mid + 1; 1706 | } 1707 | } 1708 | static PyCodeObject *__pyx_find_code_object(int code_line) { 1709 | PyCodeObject* code_object; 1710 | int pos; 1711 | if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { 1712 | return NULL; 1713 | } 1714 | pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); 1715 | if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { 1716 | return NULL; 1717 | } 1718 | code_object = __pyx_code_cache.entries[pos].code_object; 1719 | Py_INCREF(code_object); 1720 | return code_object; 1721 | } 1722 | static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { 1723 | int pos, i; 1724 | __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; 1725 | if (unlikely(!code_line)) { 1726 | return; 1727 | } 1728 | if (unlikely(!entries)) { 1729 | entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); 1730 | if (likely(entries)) { 1731 | __pyx_code_cache.entries = entries; 1732 | __pyx_code_cache.max_count = 64; 1733 | __pyx_code_cache.count = 1; 1734 | entries[0].code_line = code_line; 1735 | entries[0].code_object = code_object; 1736 | Py_INCREF(code_object); 1737 | } 1738 | return; 1739 | } 1740 | pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); 1741 | if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { 1742 | PyCodeObject* tmp = entries[pos].code_object; 1743 | entries[pos].code_object = code_object; 1744 | Py_DECREF(tmp); 1745 | return; 1746 | } 1747 | if (__pyx_code_cache.count == __pyx_code_cache.max_count) { 1748 | int new_max = __pyx_code_cache.max_count + 64; 1749 | entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( 1750 | __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); 1751 | if (unlikely(!entries)) { 1752 | return; 1753 | } 1754 | __pyx_code_cache.entries = entries; 1755 | __pyx_code_cache.max_count = new_max; 1756 | } 1757 | for (i=__pyx_code_cache.count; i>pos; i--) { 1758 | entries[i] = entries[i-1]; 1759 | } 1760 | entries[pos].code_line = code_line; 1761 | entries[pos].code_object = code_object; 1762 | __pyx_code_cache.count++; 1763 | Py_INCREF(code_object); 1764 | } 1765 | 1766 | /* AddTraceback */ 1767 | #include "compile.h" 1768 | #include "frameobject.h" 1769 | #include "traceback.h" 1770 | static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 1771 | const char *funcname, int c_line, 1772 | int py_line, const char *filename) { 1773 | PyCodeObject *py_code = 0; 1774 | PyObject *py_srcfile = 0; 1775 | PyObject *py_funcname = 0; 1776 | #if PY_MAJOR_VERSION < 3 1777 | py_srcfile = PyString_FromString(filename); 1778 | #else 1779 | py_srcfile = PyUnicode_FromString(filename); 1780 | #endif 1781 | if (!py_srcfile) goto bad; 1782 | if (c_line) { 1783 | #if PY_MAJOR_VERSION < 3 1784 | py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); 1785 | #else 1786 | py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); 1787 | #endif 1788 | } 1789 | else { 1790 | #if PY_MAJOR_VERSION < 3 1791 | py_funcname = PyString_FromString(funcname); 1792 | #else 1793 | py_funcname = PyUnicode_FromString(funcname); 1794 | #endif 1795 | } 1796 | if (!py_funcname) goto bad; 1797 | py_code = __Pyx_PyCode_New( 1798 | 0, 1799 | 0, 1800 | 0, 1801 | 0, 1802 | 0, 1803 | __pyx_empty_bytes, /*PyObject *code,*/ 1804 | __pyx_empty_tuple, /*PyObject *consts,*/ 1805 | __pyx_empty_tuple, /*PyObject *names,*/ 1806 | __pyx_empty_tuple, /*PyObject *varnames,*/ 1807 | __pyx_empty_tuple, /*PyObject *freevars,*/ 1808 | __pyx_empty_tuple, /*PyObject *cellvars,*/ 1809 | py_srcfile, /*PyObject *filename,*/ 1810 | py_funcname, /*PyObject *name,*/ 1811 | py_line, 1812 | __pyx_empty_bytes /*PyObject *lnotab*/ 1813 | ); 1814 | Py_DECREF(py_srcfile); 1815 | Py_DECREF(py_funcname); 1816 | return py_code; 1817 | bad: 1818 | Py_XDECREF(py_srcfile); 1819 | Py_XDECREF(py_funcname); 1820 | return NULL; 1821 | } 1822 | static void __Pyx_AddTraceback(const char *funcname, int c_line, 1823 | int py_line, const char *filename) { 1824 | PyCodeObject *py_code = 0; 1825 | PyFrameObject *py_frame = 0; 1826 | PyThreadState *tstate = __Pyx_PyThreadState_Current; 1827 | if (c_line) { 1828 | c_line = __Pyx_CLineForTraceback(tstate, c_line); 1829 | } 1830 | py_code = __pyx_find_code_object(c_line ? -c_line : py_line); 1831 | if (!py_code) { 1832 | py_code = __Pyx_CreateCodeObjectForTraceback( 1833 | funcname, c_line, py_line, filename); 1834 | if (!py_code) goto bad; 1835 | __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); 1836 | } 1837 | py_frame = PyFrame_New( 1838 | tstate, /*PyThreadState *tstate,*/ 1839 | py_code, /*PyCodeObject *code,*/ 1840 | __pyx_d, /*PyObject *globals,*/ 1841 | 0 /*PyObject *locals*/ 1842 | ); 1843 | if (!py_frame) goto bad; 1844 | __Pyx_PyFrame_SetLineNumber(py_frame, py_line); 1845 | PyTraceBack_Here(py_frame); 1846 | bad: 1847 | Py_XDECREF(py_code); 1848 | Py_XDECREF(py_frame); 1849 | } 1850 | 1851 | /* CIntToPy */ 1852 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { 1853 | const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; 1854 | const int is_unsigned = neg_one > const_zero; 1855 | if (is_unsigned) { 1856 | if (sizeof(int) < sizeof(long)) { 1857 | return PyInt_FromLong((long) value); 1858 | } else if (sizeof(int) <= sizeof(unsigned long)) { 1859 | return PyLong_FromUnsignedLong((unsigned long) value); 1860 | #ifdef HAVE_LONG_LONG 1861 | } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { 1862 | return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); 1863 | #endif 1864 | } 1865 | } else { 1866 | if (sizeof(int) <= sizeof(long)) { 1867 | return PyInt_FromLong((long) value); 1868 | #ifdef HAVE_LONG_LONG 1869 | } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { 1870 | return PyLong_FromLongLong((PY_LONG_LONG) value); 1871 | #endif 1872 | } 1873 | } 1874 | { 1875 | int one = 1; int little = (int)*(unsigned char *)&one; 1876 | unsigned char *bytes = (unsigned char *)&value; 1877 | return _PyLong_FromByteArray(bytes, sizeof(int), 1878 | little, !is_unsigned); 1879 | } 1880 | } 1881 | 1882 | /* CIntToPy */ 1883 | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { 1884 | const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; 1885 | const int is_unsigned = neg_one > const_zero; 1886 | if (is_unsigned) { 1887 | if (sizeof(long) < sizeof(long)) { 1888 | return PyInt_FromLong((long) value); 1889 | } else if (sizeof(long) <= sizeof(unsigned long)) { 1890 | return PyLong_FromUnsignedLong((unsigned long) value); 1891 | #ifdef HAVE_LONG_LONG 1892 | } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { 1893 | return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); 1894 | #endif 1895 | } 1896 | } else { 1897 | if (sizeof(long) <= sizeof(long)) { 1898 | return PyInt_FromLong((long) value); 1899 | #ifdef HAVE_LONG_LONG 1900 | } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { 1901 | return PyLong_FromLongLong((PY_LONG_LONG) value); 1902 | #endif 1903 | } 1904 | } 1905 | { 1906 | int one = 1; int little = (int)*(unsigned char *)&one; 1907 | unsigned char *bytes = (unsigned char *)&value; 1908 | return _PyLong_FromByteArray(bytes, sizeof(long), 1909 | little, !is_unsigned); 1910 | } 1911 | } 1912 | 1913 | /* CIntFromPyVerify */ 1914 | #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ 1915 | __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) 1916 | #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ 1917 | __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) 1918 | #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ 1919 | {\ 1920 | func_type value = func_value;\ 1921 | if (sizeof(target_type) < sizeof(func_type)) {\ 1922 | if (unlikely(value != (func_type) (target_type) value)) {\ 1923 | func_type zero = 0;\ 1924 | if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ 1925 | return (target_type) -1;\ 1926 | if (is_unsigned && unlikely(value < zero))\ 1927 | goto raise_neg_overflow;\ 1928 | else\ 1929 | goto raise_overflow;\ 1930 | }\ 1931 | }\ 1932 | return (target_type) value;\ 1933 | } 1934 | 1935 | /* CIntFromPy */ 1936 | static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { 1937 | const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; 1938 | const int is_unsigned = neg_one > const_zero; 1939 | #if PY_MAJOR_VERSION < 3 1940 | if (likely(PyInt_Check(x))) { 1941 | if (sizeof(long) < sizeof(long)) { 1942 | __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) 1943 | } else { 1944 | long val = PyInt_AS_LONG(x); 1945 | if (is_unsigned && unlikely(val < 0)) { 1946 | goto raise_neg_overflow; 1947 | } 1948 | return (long) val; 1949 | } 1950 | } else 1951 | #endif 1952 | if (likely(PyLong_Check(x))) { 1953 | if (is_unsigned) { 1954 | #if CYTHON_USE_PYLONG_INTERNALS 1955 | const digit* digits = ((PyLongObject*)x)->ob_digit; 1956 | switch (Py_SIZE(x)) { 1957 | case 0: return (long) 0; 1958 | case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) 1959 | case 2: 1960 | if (8 * sizeof(long) > 1 * PyLong_SHIFT) { 1961 | if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { 1962 | __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 1963 | } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { 1964 | return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); 1965 | } 1966 | } 1967 | break; 1968 | case 3: 1969 | if (8 * sizeof(long) > 2 * PyLong_SHIFT) { 1970 | if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { 1971 | __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 1972 | } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { 1973 | return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); 1974 | } 1975 | } 1976 | break; 1977 | case 4: 1978 | if (8 * sizeof(long) > 3 * PyLong_SHIFT) { 1979 | if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { 1980 | __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]))) 1981 | } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { 1982 | return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); 1983 | } 1984 | } 1985 | break; 1986 | } 1987 | #endif 1988 | #if CYTHON_COMPILING_IN_CPYTHON 1989 | if (unlikely(Py_SIZE(x) < 0)) { 1990 | goto raise_neg_overflow; 1991 | } 1992 | #else 1993 | { 1994 | int result = PyObject_RichCompareBool(x, Py_False, Py_LT); 1995 | if (unlikely(result < 0)) 1996 | return (long) -1; 1997 | if (unlikely(result == 1)) 1998 | goto raise_neg_overflow; 1999 | } 2000 | #endif 2001 | if (sizeof(long) <= sizeof(unsigned long)) { 2002 | __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) 2003 | #ifdef HAVE_LONG_LONG 2004 | } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { 2005 | __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) 2006 | #endif 2007 | } 2008 | } else { 2009 | #if CYTHON_USE_PYLONG_INTERNALS 2010 | const digit* digits = ((PyLongObject*)x)->ob_digit; 2011 | switch (Py_SIZE(x)) { 2012 | case 0: return (long) 0; 2013 | case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) 2014 | case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) 2015 | case -2: 2016 | if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { 2017 | if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { 2018 | __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 2019 | } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { 2020 | return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 2021 | } 2022 | } 2023 | break; 2024 | case 2: 2025 | if (8 * sizeof(long) > 1 * PyLong_SHIFT) { 2026 | if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { 2027 | __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 2028 | } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { 2029 | return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 2030 | } 2031 | } 2032 | break; 2033 | case -3: 2034 | if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { 2035 | if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { 2036 | __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 2037 | } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { 2038 | return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 2039 | } 2040 | } 2041 | break; 2042 | case 3: 2043 | if (8 * sizeof(long) > 2 * PyLong_SHIFT) { 2044 | if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { 2045 | __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 2046 | } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { 2047 | return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 2048 | } 2049 | } 2050 | break; 2051 | case -4: 2052 | if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { 2053 | if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { 2054 | __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]))) 2055 | } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { 2056 | return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 2057 | } 2058 | } 2059 | break; 2060 | case 4: 2061 | if (8 * sizeof(long) > 3 * PyLong_SHIFT) { 2062 | if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { 2063 | __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]))) 2064 | } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { 2065 | return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 2066 | } 2067 | } 2068 | break; 2069 | } 2070 | #endif 2071 | if (sizeof(long) <= sizeof(long)) { 2072 | __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) 2073 | #ifdef HAVE_LONG_LONG 2074 | } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { 2075 | __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) 2076 | #endif 2077 | } 2078 | } 2079 | { 2080 | #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) 2081 | PyErr_SetString(PyExc_RuntimeError, 2082 | "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); 2083 | #else 2084 | long val; 2085 | PyObject *v = __Pyx_PyNumber_IntOrLong(x); 2086 | #if PY_MAJOR_VERSION < 3 2087 | if (likely(v) && !PyLong_Check(v)) { 2088 | PyObject *tmp = v; 2089 | v = PyNumber_Long(tmp); 2090 | Py_DECREF(tmp); 2091 | } 2092 | #endif 2093 | if (likely(v)) { 2094 | int one = 1; int is_little = (int)*(unsigned char *)&one; 2095 | unsigned char *bytes = (unsigned char *)&val; 2096 | int ret = _PyLong_AsByteArray((PyLongObject *)v, 2097 | bytes, sizeof(val), 2098 | is_little, !is_unsigned); 2099 | Py_DECREF(v); 2100 | if (likely(!ret)) 2101 | return val; 2102 | } 2103 | #endif 2104 | return (long) -1; 2105 | } 2106 | } else { 2107 | long val; 2108 | PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); 2109 | if (!tmp) return (long) -1; 2110 | val = __Pyx_PyInt_As_long(tmp); 2111 | Py_DECREF(tmp); 2112 | return val; 2113 | } 2114 | raise_overflow: 2115 | PyErr_SetString(PyExc_OverflowError, 2116 | "value too large to convert to long"); 2117 | return (long) -1; 2118 | raise_neg_overflow: 2119 | PyErr_SetString(PyExc_OverflowError, 2120 | "can't convert negative value to long"); 2121 | return (long) -1; 2122 | } 2123 | 2124 | /* CIntFromPy */ 2125 | static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { 2126 | const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; 2127 | const int is_unsigned = neg_one > const_zero; 2128 | #if PY_MAJOR_VERSION < 3 2129 | if (likely(PyInt_Check(x))) { 2130 | if (sizeof(int) < sizeof(long)) { 2131 | __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) 2132 | } else { 2133 | long val = PyInt_AS_LONG(x); 2134 | if (is_unsigned && unlikely(val < 0)) { 2135 | goto raise_neg_overflow; 2136 | } 2137 | return (int) val; 2138 | } 2139 | } else 2140 | #endif 2141 | if (likely(PyLong_Check(x))) { 2142 | if (is_unsigned) { 2143 | #if CYTHON_USE_PYLONG_INTERNALS 2144 | const digit* digits = ((PyLongObject*)x)->ob_digit; 2145 | switch (Py_SIZE(x)) { 2146 | case 0: return (int) 0; 2147 | case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) 2148 | case 2: 2149 | if (8 * sizeof(int) > 1 * PyLong_SHIFT) { 2150 | if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { 2151 | __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 2152 | } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { 2153 | return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); 2154 | } 2155 | } 2156 | break; 2157 | case 3: 2158 | if (8 * sizeof(int) > 2 * PyLong_SHIFT) { 2159 | if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { 2160 | __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 2161 | } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { 2162 | return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); 2163 | } 2164 | } 2165 | break; 2166 | case 4: 2167 | if (8 * sizeof(int) > 3 * PyLong_SHIFT) { 2168 | if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { 2169 | __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]))) 2170 | } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { 2171 | return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); 2172 | } 2173 | } 2174 | break; 2175 | } 2176 | #endif 2177 | #if CYTHON_COMPILING_IN_CPYTHON 2178 | if (unlikely(Py_SIZE(x) < 0)) { 2179 | goto raise_neg_overflow; 2180 | } 2181 | #else 2182 | { 2183 | int result = PyObject_RichCompareBool(x, Py_False, Py_LT); 2184 | if (unlikely(result < 0)) 2185 | return (int) -1; 2186 | if (unlikely(result == 1)) 2187 | goto raise_neg_overflow; 2188 | } 2189 | #endif 2190 | if (sizeof(int) <= sizeof(unsigned long)) { 2191 | __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) 2192 | #ifdef HAVE_LONG_LONG 2193 | } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { 2194 | __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) 2195 | #endif 2196 | } 2197 | } else { 2198 | #if CYTHON_USE_PYLONG_INTERNALS 2199 | const digit* digits = ((PyLongObject*)x)->ob_digit; 2200 | switch (Py_SIZE(x)) { 2201 | case 0: return (int) 0; 2202 | case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) 2203 | case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) 2204 | case -2: 2205 | if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { 2206 | if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { 2207 | __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 2208 | } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { 2209 | return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 2210 | } 2211 | } 2212 | break; 2213 | case 2: 2214 | if (8 * sizeof(int) > 1 * PyLong_SHIFT) { 2215 | if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { 2216 | __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 2217 | } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { 2218 | return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 2219 | } 2220 | } 2221 | break; 2222 | case -3: 2223 | if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { 2224 | if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { 2225 | __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 2226 | } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { 2227 | return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 2228 | } 2229 | } 2230 | break; 2231 | case 3: 2232 | if (8 * sizeof(int) > 2 * PyLong_SHIFT) { 2233 | if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { 2234 | __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 2235 | } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { 2236 | return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 2237 | } 2238 | } 2239 | break; 2240 | case -4: 2241 | if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { 2242 | if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { 2243 | __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]))) 2244 | } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { 2245 | return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 2246 | } 2247 | } 2248 | break; 2249 | case 4: 2250 | if (8 * sizeof(int) > 3 * PyLong_SHIFT) { 2251 | if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { 2252 | __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]))) 2253 | } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { 2254 | return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 2255 | } 2256 | } 2257 | break; 2258 | } 2259 | #endif 2260 | if (sizeof(int) <= sizeof(long)) { 2261 | __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) 2262 | #ifdef HAVE_LONG_LONG 2263 | } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { 2264 | __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) 2265 | #endif 2266 | } 2267 | } 2268 | { 2269 | #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) 2270 | PyErr_SetString(PyExc_RuntimeError, 2271 | "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); 2272 | #else 2273 | int val; 2274 | PyObject *v = __Pyx_PyNumber_IntOrLong(x); 2275 | #if PY_MAJOR_VERSION < 3 2276 | if (likely(v) && !PyLong_Check(v)) { 2277 | PyObject *tmp = v; 2278 | v = PyNumber_Long(tmp); 2279 | Py_DECREF(tmp); 2280 | } 2281 | #endif 2282 | if (likely(v)) { 2283 | int one = 1; int is_little = (int)*(unsigned char *)&one; 2284 | unsigned char *bytes = (unsigned char *)&val; 2285 | int ret = _PyLong_AsByteArray((PyLongObject *)v, 2286 | bytes, sizeof(val), 2287 | is_little, !is_unsigned); 2288 | Py_DECREF(v); 2289 | if (likely(!ret)) 2290 | return val; 2291 | } 2292 | #endif 2293 | return (int) -1; 2294 | } 2295 | } else { 2296 | int val; 2297 | PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); 2298 | if (!tmp) return (int) -1; 2299 | val = __Pyx_PyInt_As_int(tmp); 2300 | Py_DECREF(tmp); 2301 | return val; 2302 | } 2303 | raise_overflow: 2304 | PyErr_SetString(PyExc_OverflowError, 2305 | "value too large to convert to int"); 2306 | return (int) -1; 2307 | raise_neg_overflow: 2308 | PyErr_SetString(PyExc_OverflowError, 2309 | "can't convert negative value to int"); 2310 | return (int) -1; 2311 | } 2312 | 2313 | /* FastTypeChecks */ 2314 | #if CYTHON_COMPILING_IN_CPYTHON 2315 | static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { 2316 | while (a) { 2317 | a = a->tp_base; 2318 | if (a == b) 2319 | return 1; 2320 | } 2321 | return b == &PyBaseObject_Type; 2322 | } 2323 | static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { 2324 | PyObject *mro; 2325 | if (a == b) return 1; 2326 | mro = a->tp_mro; 2327 | if (likely(mro)) { 2328 | Py_ssize_t i, n; 2329 | n = PyTuple_GET_SIZE(mro); 2330 | for (i = 0; i < n; i++) { 2331 | if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) 2332 | return 1; 2333 | } 2334 | return 0; 2335 | } 2336 | return __Pyx_InBases(a, b); 2337 | } 2338 | #if PY_MAJOR_VERSION == 2 2339 | static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { 2340 | PyObject *exception, *value, *tb; 2341 | int res; 2342 | __Pyx_PyThreadState_declare 2343 | __Pyx_PyThreadState_assign 2344 | __Pyx_ErrFetch(&exception, &value, &tb); 2345 | res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; 2346 | if (unlikely(res == -1)) { 2347 | PyErr_WriteUnraisable(err); 2348 | res = 0; 2349 | } 2350 | if (!res) { 2351 | res = PyObject_IsSubclass(err, exc_type2); 2352 | if (unlikely(res == -1)) { 2353 | PyErr_WriteUnraisable(err); 2354 | res = 0; 2355 | } 2356 | } 2357 | __Pyx_ErrRestore(exception, value, tb); 2358 | return res; 2359 | } 2360 | #else 2361 | static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { 2362 | int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; 2363 | if (!res) { 2364 | res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); 2365 | } 2366 | return res; 2367 | } 2368 | #endif 2369 | static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { 2370 | Py_ssize_t i, n; 2371 | assert(PyExceptionClass_Check(exc_type)); 2372 | n = PyTuple_GET_SIZE(tuple); 2373 | #if PY_MAJOR_VERSION >= 3 2374 | for (i=0; ip) { 2432 | #if PY_MAJOR_VERSION < 3 2433 | if (t->is_unicode) { 2434 | *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); 2435 | } else if (t->intern) { 2436 | *t->p = PyString_InternFromString(t->s); 2437 | } else { 2438 | *t->p = PyString_FromStringAndSize(t->s, t->n - 1); 2439 | } 2440 | #else 2441 | if (t->is_unicode | t->is_str) { 2442 | if (t->intern) { 2443 | *t->p = PyUnicode_InternFromString(t->s); 2444 | } else if (t->encoding) { 2445 | *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); 2446 | } else { 2447 | *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); 2448 | } 2449 | } else { 2450 | *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); 2451 | } 2452 | #endif 2453 | if (!*t->p) 2454 | return -1; 2455 | if (PyObject_Hash(*t->p) == -1) 2456 | return -1; 2457 | ++t; 2458 | } 2459 | return 0; 2460 | } 2461 | 2462 | static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { 2463 | return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); 2464 | } 2465 | static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { 2466 | Py_ssize_t ignore; 2467 | return __Pyx_PyObject_AsStringAndSize(o, &ignore); 2468 | } 2469 | #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 2470 | #if !CYTHON_PEP393_ENABLED 2471 | static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { 2472 | char* defenc_c; 2473 | PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); 2474 | if (!defenc) return NULL; 2475 | defenc_c = PyBytes_AS_STRING(defenc); 2476 | #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 2477 | { 2478 | char* end = defenc_c + PyBytes_GET_SIZE(defenc); 2479 | char* c; 2480 | for (c = defenc_c; c < end; c++) { 2481 | if ((unsigned char) (*c) >= 128) { 2482 | PyUnicode_AsASCIIString(o); 2483 | return NULL; 2484 | } 2485 | } 2486 | } 2487 | #endif 2488 | *length = PyBytes_GET_SIZE(defenc); 2489 | return defenc_c; 2490 | } 2491 | #else 2492 | static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { 2493 | if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; 2494 | #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 2495 | if (likely(PyUnicode_IS_ASCII(o))) { 2496 | *length = PyUnicode_GET_LENGTH(o); 2497 | return PyUnicode_AsUTF8(o); 2498 | } else { 2499 | PyUnicode_AsASCIIString(o); 2500 | return NULL; 2501 | } 2502 | #else 2503 | return PyUnicode_AsUTF8AndSize(o, length); 2504 | #endif 2505 | } 2506 | #endif 2507 | #endif 2508 | static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { 2509 | #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 2510 | if ( 2511 | #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 2512 | __Pyx_sys_getdefaultencoding_not_ascii && 2513 | #endif 2514 | PyUnicode_Check(o)) { 2515 | return __Pyx_PyUnicode_AsStringAndSize(o, length); 2516 | } else 2517 | #endif 2518 | #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) 2519 | if (PyByteArray_Check(o)) { 2520 | *length = PyByteArray_GET_SIZE(o); 2521 | return PyByteArray_AS_STRING(o); 2522 | } else 2523 | #endif 2524 | { 2525 | char* result; 2526 | int r = PyBytes_AsStringAndSize(o, &result, length); 2527 | if (unlikely(r < 0)) { 2528 | return NULL; 2529 | } else { 2530 | return result; 2531 | } 2532 | } 2533 | } 2534 | static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { 2535 | int is_true = x == Py_True; 2536 | if (is_true | (x == Py_False) | (x == Py_None)) return is_true; 2537 | else return PyObject_IsTrue(x); 2538 | } 2539 | static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { 2540 | int retval; 2541 | if (unlikely(!x)) return -1; 2542 | retval = __Pyx_PyObject_IsTrue(x); 2543 | Py_DECREF(x); 2544 | return retval; 2545 | } 2546 | static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { 2547 | #if PY_MAJOR_VERSION >= 3 2548 | if (PyLong_Check(result)) { 2549 | if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, 2550 | "__int__ returned non-int (type %.200s). " 2551 | "The ability to return an instance of a strict subclass of int " 2552 | "is deprecated, and may be removed in a future version of Python.", 2553 | Py_TYPE(result)->tp_name)) { 2554 | Py_DECREF(result); 2555 | return NULL; 2556 | } 2557 | return result; 2558 | } 2559 | #endif 2560 | PyErr_Format(PyExc_TypeError, 2561 | "__%.4s__ returned non-%.4s (type %.200s)", 2562 | type_name, type_name, Py_TYPE(result)->tp_name); 2563 | Py_DECREF(result); 2564 | return NULL; 2565 | } 2566 | static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { 2567 | #if CYTHON_USE_TYPE_SLOTS 2568 | PyNumberMethods *m; 2569 | #endif 2570 | const char *name = NULL; 2571 | PyObject *res = NULL; 2572 | #if PY_MAJOR_VERSION < 3 2573 | if (likely(PyInt_Check(x) || PyLong_Check(x))) 2574 | #else 2575 | if (likely(PyLong_Check(x))) 2576 | #endif 2577 | return __Pyx_NewRef(x); 2578 | #if CYTHON_USE_TYPE_SLOTS 2579 | m = Py_TYPE(x)->tp_as_number; 2580 | #if PY_MAJOR_VERSION < 3 2581 | if (m && m->nb_int) { 2582 | name = "int"; 2583 | res = m->nb_int(x); 2584 | } 2585 | else if (m && m->nb_long) { 2586 | name = "long"; 2587 | res = m->nb_long(x); 2588 | } 2589 | #else 2590 | if (likely(m && m->nb_int)) { 2591 | name = "int"; 2592 | res = m->nb_int(x); 2593 | } 2594 | #endif 2595 | #else 2596 | if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { 2597 | res = PyNumber_Int(x); 2598 | } 2599 | #endif 2600 | if (likely(res)) { 2601 | #if PY_MAJOR_VERSION < 3 2602 | if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { 2603 | #else 2604 | if (unlikely(!PyLong_CheckExact(res))) { 2605 | #endif 2606 | return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); 2607 | } 2608 | } 2609 | else if (!PyErr_Occurred()) { 2610 | PyErr_SetString(PyExc_TypeError, 2611 | "an integer is required"); 2612 | } 2613 | return res; 2614 | } 2615 | static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { 2616 | Py_ssize_t ival; 2617 | PyObject *x; 2618 | #if PY_MAJOR_VERSION < 3 2619 | if (likely(PyInt_CheckExact(b))) { 2620 | if (sizeof(Py_ssize_t) >= sizeof(long)) 2621 | return PyInt_AS_LONG(b); 2622 | else 2623 | return PyInt_AsSsize_t(b); 2624 | } 2625 | #endif 2626 | if (likely(PyLong_CheckExact(b))) { 2627 | #if CYTHON_USE_PYLONG_INTERNALS 2628 | const digit* digits = ((PyLongObject*)b)->ob_digit; 2629 | const Py_ssize_t size = Py_SIZE(b); 2630 | if (likely(__Pyx_sst_abs(size) <= 1)) { 2631 | ival = likely(size) ? digits[0] : 0; 2632 | if (size == -1) ival = -ival; 2633 | return ival; 2634 | } else { 2635 | switch (size) { 2636 | case 2: 2637 | if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { 2638 | return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); 2639 | } 2640 | break; 2641 | case -2: 2642 | if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { 2643 | return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); 2644 | } 2645 | break; 2646 | case 3: 2647 | if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { 2648 | return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); 2649 | } 2650 | break; 2651 | case -3: 2652 | if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { 2653 | return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); 2654 | } 2655 | break; 2656 | case 4: 2657 | if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { 2658 | return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); 2659 | } 2660 | break; 2661 | case -4: 2662 | if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { 2663 | return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); 2664 | } 2665 | break; 2666 | } 2667 | } 2668 | #endif 2669 | return PyLong_AsSsize_t(b); 2670 | } 2671 | x = PyNumber_Index(b); 2672 | if (!x) return -1; 2673 | ival = PyInt_AsSsize_t(x); 2674 | Py_DECREF(x); 2675 | return ival; 2676 | } 2677 | static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { 2678 | return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); 2679 | } 2680 | static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { 2681 | return PyInt_FromSize_t(ival); 2682 | } 2683 | 2684 | 2685 | #endif /* Py_PYTHON_H */ 2686 | -------------------------------------------------------------------------------- /Demo/pyled/led.pyx: -------------------------------------------------------------------------------- 1 | # Import the low-level C declarations 2 | cimport cled 3 | 4 | # Import some functionality from Python and the C stdlib 5 | from cpython.pycapsule cimport * 6 | 7 | from libc.stdlib cimport malloc, free 8 | 9 | 10 | def led(): 11 | return cled.led() 12 | def led_h(): 13 | return cled.led_h() -------------------------------------------------------------------------------- /Demo/pyled/setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | from distutils.extension import Extension 3 | from Cython.Distutils import build_ext 4 | 5 | ext_modules = [ 6 | Extension('led', 7 | ['led.pyx'], 8 | libraries=['led','sample'], 9 | include_dirs=['/usr/include'], 10 | library_dirs=['/usr/lib'])] 11 | setup( 12 | name = 'led extension module', 13 | cmdclass = {'build_ext': build_ext}, 14 | ext_modules = ext_modules 15 | ) -------------------------------------------------------------------------------- /Demo/pysample/csample.pxd: -------------------------------------------------------------------------------- 1 | # csample.pxd 2 | # 3 | # Declarations of "external" C functions and structures 4 | 5 | cdef extern from "sample.h": 6 | int gcd(int, int) 7 | bint in_mandel(double, double, int) 8 | int divide(int, int, int *) 9 | double avg(double *, int) nogil 10 | int set_cur_term(int *) 11 | 12 | ctypedef struct Point: 13 | double x 14 | double y 15 | 16 | double distance(Point *, Point *) -------------------------------------------------------------------------------- /Demo/pysample/sam.pyx: -------------------------------------------------------------------------------- 1 | # sample.pyx 2 | 3 | # Import the low-level C declarations 4 | cimport csample 5 | 6 | # Import some functionality from Python and the C stdlib 7 | from cpython.pycapsule cimport * 8 | 9 | from libc.stdlib cimport malloc, free 10 | 11 | 12 | # Wrappers 13 | def gcd(unsigned int x, unsigned int y): 14 | return csample.gcd(x, y) 15 | 16 | def set_cur_term(temp): 17 | cdef int *pint 18 | cdef int x 19 | 20 | return csample.set_cur_term(pint) 21 | 22 | def in_mandel(x, y, unsigned int n): 23 | return csample.in_mandel(x, y, n) 24 | 25 | def divide(x, y): 26 | cdef int rem 27 | quot = csample.divide(x, y, &rem) 28 | return quot, rem 29 | 30 | def avg(double[:] a): 31 | cdef: 32 | int sz 33 | double result 34 | 35 | sz = a.size 36 | with nogil: 37 | result = csample.avg( &a[0], sz) 38 | return result 39 | 40 | # Destructor for cleaning up Point objects 41 | cdef del_Point(object obj): 42 | pt = PyCapsule_GetPointer(obj,"Point") 43 | free( pt) 44 | 45 | # Create a Point object and return as a capsule 46 | def Point(double x,double y): 47 | cdef csample.Point *p 48 | p = malloc(sizeof(csample.Point)) 49 | if p == NULL: 50 | raise MemoryError("No memory to make a Point") 51 | p.x = x 52 | p.y = y 53 | return PyCapsule_New(p,"Point",del_Point) 54 | 55 | def distance(p1, p2): 56 | pt1 = PyCapsule_GetPointer(p1,"Point") 57 | pt2 = PyCapsule_GetPointer(p2,"Point") 58 | return csample.distance(pt1,pt2) -------------------------------------------------------------------------------- /Demo/pysample/setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | from distutils.extension import Extension 3 | from Cython.Distutils import build_ext 4 | 5 | ext_modules = [ 6 | Extension('sam', 7 | ['sam.pyx'], 8 | libraries=['sample'], 9 | include_dirs=['/usr/include'], 10 | library_dirs=['/usr/lib'])] 11 | setup( 12 | name = 'Sample extension module', 13 | cmdclass = {'build_ext': build_ext}, 14 | ext_modules = ext_modules 15 | ) -------------------------------------------------------------------------------- /Demo/sample/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | # Set the project name 4 | project (sample) 5 | 6 | 7 | 8 | 9 | SET(LIBSAMPLE_SRC sample.c) 10 | SET(LIBHEAD_FILE sample.h) 11 | #SET(CMAKE_BUILD_TYPE Debug) 12 | 13 | ADD_LIBRARY(sample SHARED ${LIBSAMPLE_SRC}) 14 | 15 | INSTALL(TARGETS sample DESTINATION "/usr/lib") 16 | 17 | INSTALL(FILES ${LIBHEAD_FILE} DESTINATION "/usr/include") 18 | -------------------------------------------------------------------------------- /Demo/sample/sample.c: -------------------------------------------------------------------------------- 1 | #include "sample.h" 2 | 3 | 4 | 5 | char *b = "123456789677811111112778245230394"; 6 | TERMINAL a ; 7 | TERMINAL *cur_term= &a; 8 | 9 | void __attribute__((constructor)) sample_init(void) 10 | { 11 | a.type.Booleans = b; 12 | 13 | } 14 | 15 | /* Compute the greatest common divisor */ 16 | int gcd(int x, int y) { 17 | 18 | if(sampleflag) 19 | { 20 | printf("stdout Helo World!!\n"); 21 | } 22 | return 0; 23 | } 24 | 25 | 26 | 27 | int set_cur_term(TERMINAL *temp) 28 | { 29 | cur_term = temp; 30 | return 0; 31 | } 32 | 33 | /* Test if (x0,y0) is in the Mandelbrot set or not */ 34 | int in_mandel(double x0, double y0, int n) { 35 | double x=0,y=0,xtemp; 36 | while (n > 0) { 37 | xtemp = x*x - y*y + x0; 38 | y = 2*x*y + y0; 39 | x = xtemp; 40 | n -= 1; 41 | if (x*x + y*y > 4) return 0; 42 | } 43 | return 1; 44 | } 45 | 46 | /* Divide two numbers */ 47 | int divide(int a, int b, int *remainder) { 48 | int quot = a / b; 49 | *remainder = a % b; 50 | return quot; 51 | } 52 | 53 | /* Average values in an array */ 54 | double avg(double *a, int n) { 55 | int i; 56 | double total = 0.0; 57 | for (i = 0; i < n; i++) { 58 | total += a[i]; 59 | } 60 | return total / n; 61 | } 62 | 63 | 64 | /* Function involving a C data structure */ 65 | double distance(Point *p1, Point *p2) { 66 | return hypot(p1->x - p2->x, p1->y - p2->y); 67 | } -------------------------------------------------------------------------------- /Demo/sample/sample.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #ifndef _SAMPLE_H 4 | #define _SAMPLE_H 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void __attribute__((constructor)) smaple_init(void); 11 | 12 | 13 | typedef struct termtype { /* in-core form of terminfo data */ 14 | char *Booleans; /* array of boolean values */ 15 | 16 | } TERMTYPE; 17 | 18 | 19 | typedef struct term { /* describe an actual terminal */ 20 | TERMTYPE type; /* terminal type description */ 21 | } TERMINAL; 22 | 23 | 24 | #undef CUR 25 | #define CUR cur_term->type. 26 | 27 | 28 | #define sampleflag CUR Booleans[20] 29 | /* A C data structure */ 30 | typedef struct Point { 31 | double x,y; 32 | } Point; 33 | 34 | int gcd(int x, int y); 35 | int in_mandel(double x0, double y0, int n); 36 | int divide(int a, int b, int *remainder); 37 | double avg(double *a, int n); 38 | double distance(Point *p1, Point *p2); 39 | int set_cur_term(TERMINAL *temp); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | #endif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GDB-Learning 2 | GDB 学习,及根据大牛Liam Huang的文章,模仿的一个GDB调试的demo 3 | 最近再学习GDB ,找了全网没找到很好的例子和教程,直到找到Liam Huang大牛的一篇文章: 4 | http://www.brendangregg.com/blog/2016-08-09/gdb-example-ncurses.html 5 | 网上也有中文翻译好的,还有个比较好的视频: 6 | Give me 15 minutes and I’ll change your view of GDB(视频在youtube上,方便大家我下载下来了:在video目录下) 7 | 8 | /*******分割线,好好看过上面的文章和视频再看下面*********/ 9 | 10 | 下面试来部署调试环境的: 11 | 主要用了sample和led两个动态库: 12 | 在Demo/sample和led目录下分别执行以下指令: 13 | mkdir build 14 | cd build 15 | cmake .. 16 | make 17 | sudo make install 18 | 并在pysample和pyled目录下执行: 19 | python setup.py build(python版本2.7) 20 | 并将../pysample/build/lib.linux-x86_64-2.7/sam.so 21 | ../pyled/build/lib.linux-x86_64-2.7/led.so两个动态库拷贝到python的第三方库目录下: 22 | /usr/local/lib/python2.7/dist-packages 23 | 这样就可以在python调用sample和led这两个库。 24 | 然后就可以运行demo.py(在Demo文件夹下)了。 25 | 运行demo.py很快就可以看到Segmentation fault,就可以照着大牛的思路进行找错了。 26 | 当然,我写的这个Demo代码很简单,一看代码就知道是哪里错了。 27 | 所以推荐大家,假设sample和led这两个库代码量很大,并且不要一上来就看代码。 28 | 然后就是编译选项,由于没搞懂deb包怎么生成,所以要想在GDB中看到代码, 29 | 只能通过sample和led两个动态库的cmakelist中的SET(CMAKE_BUILD_TYPE Debug)放开。 -------------------------------------------------------------------------------- /Video/CppCon 2015- Greg Law ' Give me 15 minutes & I'll change your view of GDB'.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhcpp/GDB-Learning/0c5689f4af214ac07514c7d3d15e9e57bc87c20a/Video/CppCon 2015- Greg Law ' Give me 15 minutes & I'll change your view of GDB'.mp4 -------------------------------------------------------------------------------- /资料/GDB调试程序 .ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhcpp/GDB-Learning/0c5689f4af214ac07514c7d3d15e9e57bc87c20a/资料/GDB调试程序 .ppt -------------------------------------------------------------------------------- /资料/Linux源码分析-PTRACE.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yhcpp/GDB-Learning/0c5689f4af214ac07514c7d3d15e9e57bc87c20a/资料/Linux源码分析-PTRACE.doc --------------------------------------------------------------------------------