/tmp/cython/hello.c

https://bitbucket.org/prologic/circuits/ · C · 1309 lines · 1153 code · 120 blank · 36 comment · 264 complexity · 81ebe5220a206a8a58a0d0a07ecdd105 MD5 · raw file

  1. /* Generated by Cython 0.14.1 on Sun Apr 24 12:03:13 2011 */
  2. #define PY_SSIZE_T_CLEAN
  3. #include "Python.h"
  4. #ifndef Py_PYTHON_H
  5. #error Python headers needed to compile C extensions, please install development version of Python.
  6. #else
  7. #include <stddef.h> /* For offsetof */
  8. #ifndef offsetof
  9. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  10. #endif
  11. #if !defined(WIN32) && !defined(MS_WINDOWS)
  12. #ifndef __stdcall
  13. #define __stdcall
  14. #endif
  15. #ifndef __cdecl
  16. #define __cdecl
  17. #endif
  18. #ifndef __fastcall
  19. #define __fastcall
  20. #endif
  21. #endif
  22. #ifndef DL_IMPORT
  23. #define DL_IMPORT(t) t
  24. #endif
  25. #ifndef DL_EXPORT
  26. #define DL_EXPORT(t) t
  27. #endif
  28. #ifndef PY_LONG_LONG
  29. #define PY_LONG_LONG LONG_LONG
  30. #endif
  31. #if PY_VERSION_HEX < 0x02040000
  32. #define METH_COEXIST 0
  33. #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  34. #define PyDict_Contains(d,o) PySequence_Contains(d,o)
  35. #endif
  36. #if PY_VERSION_HEX < 0x02050000
  37. typedef int Py_ssize_t;
  38. #define PY_SSIZE_T_MAX INT_MAX
  39. #define PY_SSIZE_T_MIN INT_MIN
  40. #define PY_FORMAT_SIZE_T ""
  41. #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  42. #define PyInt_AsSsize_t(o) PyInt_AsLong(o)
  43. #define PyNumber_Index(o) PyNumber_Int(o)
  44. #define PyIndex_Check(o) PyNumber_Check(o)
  45. #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  46. #endif
  47. #if PY_VERSION_HEX < 0x02060000
  48. #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  49. #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
  50. #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
  51. #define PyVarObject_HEAD_INIT(type, size) \
  52. PyObject_HEAD_INIT(type) size,
  53. #define PyType_Modified(t)
  54. typedef struct {
  55. void *buf;
  56. PyObject *obj;
  57. Py_ssize_t len;
  58. Py_ssize_t itemsize;
  59. int readonly;
  60. int ndim;
  61. char *format;
  62. Py_ssize_t *shape;
  63. Py_ssize_t *strides;
  64. Py_ssize_t *suboffsets;
  65. void *internal;
  66. } Py_buffer;
  67. #define PyBUF_SIMPLE 0
  68. #define PyBUF_WRITABLE 0x0001
  69. #define PyBUF_FORMAT 0x0004
  70. #define PyBUF_ND 0x0008
  71. #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  72. #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  73. #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  74. #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  75. #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
  76. #endif
  77. #if PY_MAJOR_VERSION < 3
  78. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  79. #else
  80. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  81. #endif
  82. #if PY_MAJOR_VERSION >= 3
  83. #define Py_TPFLAGS_CHECKTYPES 0
  84. #define Py_TPFLAGS_HAVE_INDEX 0
  85. #endif
  86. #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  87. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  88. #endif
  89. #if PY_MAJOR_VERSION >= 3
  90. #define PyBaseString_Type PyUnicode_Type
  91. #define PyStringObject PyUnicodeObject
  92. #define PyString_Type PyUnicode_Type
  93. #define PyString_Check PyUnicode_Check
  94. #define PyString_CheckExact PyUnicode_CheckExact
  95. #endif
  96. #if PY_VERSION_HEX < 0x02060000
  97. #define PyBytesObject PyStringObject
  98. #define PyBytes_Type PyString_Type
  99. #define PyBytes_Check PyString_Check
  100. #define PyBytes_CheckExact PyString_CheckExact
  101. #define PyBytes_FromString PyString_FromString
  102. #define PyBytes_FromStringAndSize PyString_FromStringAndSize
  103. #define PyBytes_FromFormat PyString_FromFormat
  104. #define PyBytes_DecodeEscape PyString_DecodeEscape
  105. #define PyBytes_AsString PyString_AsString
  106. #define PyBytes_AsStringAndSize PyString_AsStringAndSize
  107. #define PyBytes_Size PyString_Size
  108. #define PyBytes_AS_STRING PyString_AS_STRING
  109. #define PyBytes_GET_SIZE PyString_GET_SIZE
  110. #define PyBytes_Repr PyString_Repr
  111. #define PyBytes_Concat PyString_Concat
  112. #define PyBytes_ConcatAndDel PyString_ConcatAndDel
  113. #endif
  114. #if PY_VERSION_HEX < 0x02060000
  115. #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
  116. #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
  117. #endif
  118. #ifndef PySet_CheckExact
  119. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  120. #endif
  121. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  122. #if PY_MAJOR_VERSION >= 3
  123. #define PyIntObject PyLongObject
  124. #define PyInt_Type PyLong_Type
  125. #define PyInt_Check(op) PyLong_Check(op)
  126. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  127. #define PyInt_FromString PyLong_FromString
  128. #define PyInt_FromUnicode PyLong_FromUnicode
  129. #define PyInt_FromLong PyLong_FromLong
  130. #define PyInt_FromSize_t PyLong_FromSize_t
  131. #define PyInt_FromSsize_t PyLong_FromSsize_t
  132. #define PyInt_AsLong PyLong_AsLong
  133. #define PyInt_AS_LONG PyLong_AS_LONG
  134. #define PyInt_AsSsize_t PyLong_AsSsize_t
  135. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  136. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  137. #endif
  138. #if PY_MAJOR_VERSION >= 3
  139. #define PyBoolObject PyLongObject
  140. #endif
  141. #if PY_MAJOR_VERSION >= 3
  142. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  143. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  144. #else
  145. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  146. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  147. #endif
  148. #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  149. #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  150. #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  151. #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
  152. #else
  153. #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
  154. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
  155. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
  156. (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  157. #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
  158. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
  159. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
  160. (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  161. #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
  162. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
  163. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
  164. (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
  165. #endif
  166. #if PY_MAJOR_VERSION >= 3
  167. #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
  168. #endif
  169. #if PY_VERSION_HEX < 0x02050000
  170. #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
  171. #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  172. #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
  173. #else
  174. #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
  175. #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  176. #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
  177. #endif
  178. #if PY_VERSION_HEX < 0x02050000
  179. #define __Pyx_NAMESTR(n) ((char *)(n))
  180. #define __Pyx_DOCSTR(n) ((char *)(n))
  181. #else
  182. #define __Pyx_NAMESTR(n) (n)
  183. #define __Pyx_DOCSTR(n) (n)
  184. #endif
  185. #ifdef __cplusplus
  186. #define __PYX_EXTERN_C extern "C"
  187. #else
  188. #define __PYX_EXTERN_C extern
  189. #endif
  190. #if defined(WIN32) || defined(MS_WINDOWS)
  191. #define _USE_MATH_DEFINES
  192. #endif
  193. #include <math.h>
  194. #define __PYX_HAVE_API__hello
  195. #ifdef PYREX_WITHOUT_ASSERTIONS
  196. #define CYTHON_WITHOUT_ASSERTIONS
  197. #endif
  198. /* inline attribute */
  199. #ifndef CYTHON_INLINE
  200. #if defined(__GNUC__)
  201. #define CYTHON_INLINE __inline__
  202. #elif defined(_MSC_VER)
  203. #define CYTHON_INLINE __inline
  204. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  205. #define CYTHON_INLINE inline
  206. #else
  207. #define CYTHON_INLINE
  208. #endif
  209. #endif
  210. /* unused attribute */
  211. #ifndef CYTHON_UNUSED
  212. # if defined(__GNUC__)
  213. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  214. # define CYTHON_UNUSED __attribute__ ((__unused__))
  215. # else
  216. # define CYTHON_UNUSED
  217. # endif
  218. # elif defined(__ICC) || defined(__INTEL_COMPILER)
  219. # define CYTHON_UNUSED __attribute__ ((__unused__))
  220. # else
  221. # define CYTHON_UNUSED
  222. # endif
  223. #endif
  224. typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
  225. /* Type Conversion Predeclarations */
  226. #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
  227. #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
  228. #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
  229. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  230. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
  231. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  232. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  233. static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
  234. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  235. #ifdef __GNUC__
  236. /* Test for GCC > 2.95 */
  237. #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
  238. #define likely(x) __builtin_expect(!!(x), 1)
  239. #define unlikely(x) __builtin_expect(!!(x), 0)
  240. #else /* __GNUC__ > 2 ... */
  241. #define likely(x) (x)
  242. #define unlikely(x) (x)
  243. #endif /* __GNUC__ > 2 ... */
  244. #else /* __GNUC__ */
  245. #define likely(x) (x)
  246. #define unlikely(x) (x)
  247. #endif /* __GNUC__ */
  248. static PyObject *__pyx_m;
  249. static PyObject *__pyx_b;
  250. static PyObject *__pyx_empty_tuple;
  251. static PyObject *__pyx_empty_bytes;
  252. static int __pyx_lineno;
  253. static int __pyx_clineno = 0;
  254. static const char * __pyx_cfilenm= __FILE__;
  255. static const char *__pyx_filename;
  256. static const char *__pyx_f[] = {
  257. "hello.pyx",
  258. };
  259. /* Type declarations */
  260. #ifndef CYTHON_REFNANNY
  261. #define CYTHON_REFNANNY 0
  262. #endif
  263. #if CYTHON_REFNANNY
  264. typedef struct {
  265. void (*INCREF)(void*, PyObject*, int);
  266. void (*DECREF)(void*, PyObject*, int);
  267. void (*GOTREF)(void*, PyObject*, int);
  268. void (*GIVEREF)(void*, PyObject*, int);
  269. void* (*SetupContext)(const char*, int, const char*);
  270. void (*FinishContext)(void**);
  271. } __Pyx_RefNannyAPIStruct;
  272. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  273. static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
  274. PyObject *m = NULL, *p = NULL;
  275. void *r = NULL;
  276. m = PyImport_ImportModule((char *)modname);
  277. if (!m) goto end;
  278. p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
  279. if (!p) goto end;
  280. r = PyLong_AsVoidPtr(p);
  281. end:
  282. Py_XDECREF(p);
  283. Py_XDECREF(m);
  284. return (__Pyx_RefNannyAPIStruct *)r;
  285. }
  286. #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  287. #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  288. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  289. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  290. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  291. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  292. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
  293. #else
  294. #define __Pyx_RefNannySetupContext(name)
  295. #define __Pyx_RefNannyFinishContext()
  296. #define __Pyx_INCREF(r) Py_INCREF(r)
  297. #define __Pyx_DECREF(r) Py_DECREF(r)
  298. #define __Pyx_GOTREF(r)
  299. #define __Pyx_GIVEREF(r)
  300. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  301. #endif /* CYTHON_REFNANNY */
  302. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
  303. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
  304. static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
  305. #if PY_MAJOR_VERSION >= 3
  306. static PyObject* __pyx_print = 0;
  307. static PyObject* __pyx_print_kwargs = 0;
  308. #endif
  309. static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/
  310. static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
  311. static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
  312. static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
  313. static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
  314. static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
  315. static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
  316. static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
  317. static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
  318. static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
  319. static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
  320. static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
  321. static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
  322. static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
  323. static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
  324. static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
  325. static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
  326. static void __Pyx_AddTraceback(const char *funcname); /*proto*/
  327. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
  328. /* Module declarations from hello */
  329. #define __Pyx_MODULE_NAME "hello"
  330. static int __pyx_module_is_main_hello = 0;
  331. /* Implementation of hello */
  332. static char __pyx_k_1[] = "Hello %s!";
  333. static char __pyx_k__hello[] = "hello";
  334. static char __pyx_k____main__[] = "__main__";
  335. static char __pyx_k____test__[] = "__test__";
  336. static char __pyx_k__say_hello_to[] = "say_hello_to";
  337. static PyObject *__pyx_kp_s_1;
  338. static PyObject *__pyx_n_s____main__;
  339. static PyObject *__pyx_n_s____test__;
  340. static PyObject *__pyx_n_s__hello;
  341. static PyObject *__pyx_n_s__say_hello_to;
  342. /* "hello.pyx":1
  343. * def say_hello_to(name): # <<<<<<<<<<<<<<
  344. * print("Hello %s!" % name)
  345. */
  346. static PyObject *__pyx_pf_5hello_say_hello_to(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
  347. static PyMethodDef __pyx_mdef_5hello_say_hello_to = {__Pyx_NAMESTR("say_hello_to"), (PyCFunction)__pyx_pf_5hello_say_hello_to, METH_O, __Pyx_DOCSTR(0)};
  348. static PyObject *__pyx_pf_5hello_say_hello_to(PyObject *__pyx_self, PyObject *__pyx_v_name) {
  349. PyObject *__pyx_r = NULL;
  350. PyObject *__pyx_t_1 = NULL;
  351. __Pyx_RefNannySetupContext("say_hello_to");
  352. __pyx_self = __pyx_self;
  353. /* "hello.pyx":2
  354. * def say_hello_to(name):
  355. * print("Hello %s!" % name) # <<<<<<<<<<<<<<
  356. */
  357. __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_v_name); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  358. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  359. if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  360. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  361. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  362. goto __pyx_L0;
  363. __pyx_L1_error:;
  364. __Pyx_XDECREF(__pyx_t_1);
  365. __Pyx_AddTraceback("hello.say_hello_to");
  366. __pyx_r = NULL;
  367. __pyx_L0:;
  368. __Pyx_XGIVEREF(__pyx_r);
  369. __Pyx_RefNannyFinishContext();
  370. return __pyx_r;
  371. }
  372. static PyMethodDef __pyx_methods[] = {
  373. {0, 0, 0, 0}
  374. };
  375. #if PY_MAJOR_VERSION >= 3
  376. static struct PyModuleDef __pyx_moduledef = {
  377. PyModuleDef_HEAD_INIT,
  378. __Pyx_NAMESTR("hello"),
  379. 0, /* m_doc */
  380. -1, /* m_size */
  381. __pyx_methods /* m_methods */,
  382. NULL, /* m_reload */
  383. NULL, /* m_traverse */
  384. NULL, /* m_clear */
  385. NULL /* m_free */
  386. };
  387. #endif
  388. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  389. {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  390. {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  391. {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  392. {&__pyx_n_s__hello, __pyx_k__hello, sizeof(__pyx_k__hello), 0, 0, 1, 1},
  393. {&__pyx_n_s__say_hello_to, __pyx_k__say_hello_to, sizeof(__pyx_k__say_hello_to), 0, 0, 1, 1},
  394. {0, 0, 0, 0, 0, 0, 0}
  395. };
  396. static int __Pyx_InitCachedBuiltins(void) {
  397. return 0;
  398. }
  399. static int __Pyx_InitCachedConstants(void) {
  400. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
  401. __Pyx_RefNannyFinishContext();
  402. return 0;
  403. }
  404. static int __Pyx_InitGlobals(void) {
  405. if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  406. return 0;
  407. __pyx_L1_error:;
  408. return -1;
  409. }
  410. #if PY_MAJOR_VERSION < 3
  411. PyMODINIT_FUNC inithello(void); /*proto*/
  412. PyMODINIT_FUNC inithello(void)
  413. #else
  414. PyMODINIT_FUNC PyInit_hello(void); /*proto*/
  415. PyMODINIT_FUNC PyInit_hello(void)
  416. #endif
  417. {
  418. PyObject *__pyx_t_1 = NULL;
  419. #if CYTHON_REFNANNY
  420. void* __pyx_refnanny = NULL;
  421. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  422. if (!__Pyx_RefNanny) {
  423. PyErr_Clear();
  424. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  425. if (!__Pyx_RefNanny)
  426. Py_FatalError("failed to import 'refnanny' module");
  427. }
  428. __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_hello(void)", __LINE__, __FILE__);
  429. #endif
  430. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  431. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  432. #ifdef __pyx_binding_PyCFunctionType_USED
  433. if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  434. #endif
  435. /*--- Library function declarations ---*/
  436. /*--- Threads initialization code ---*/
  437. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  438. #ifdef WITH_THREAD /* Python build with threading support? */
  439. PyEval_InitThreads();
  440. #endif
  441. #endif
  442. /*--- Module creation code ---*/
  443. #if PY_MAJOR_VERSION < 3
  444. __pyx_m = Py_InitModule4(__Pyx_NAMESTR("hello"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  445. #else
  446. __pyx_m = PyModule_Create(&__pyx_moduledef);
  447. #endif
  448. if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  449. #if PY_MAJOR_VERSION < 3
  450. Py_INCREF(__pyx_m);
  451. #endif
  452. __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  453. if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  454. if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  455. /*--- Initialize various global constants etc. ---*/
  456. if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  457. if (__pyx_module_is_main_hello) {
  458. if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  459. }
  460. /*--- Builtin init code ---*/
  461. if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  462. /*--- Constants init code ---*/
  463. if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  464. /*--- Global init code ---*/
  465. /*--- Function export code ---*/
  466. /*--- Type init code ---*/
  467. /*--- Type import code ---*/
  468. /*--- Function import code ---*/
  469. /*--- Execution code ---*/
  470. /* "hello.pyx":1
  471. * def say_hello_to(name): # <<<<<<<<<<<<<<
  472. * print("Hello %s!" % name)
  473. */
  474. __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5hello_say_hello_to, NULL, __pyx_n_s__hello); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  475. __Pyx_GOTREF(__pyx_t_1);
  476. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__say_hello_to, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  477. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  478. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  479. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  480. if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  481. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  482. goto __pyx_L0;
  483. __pyx_L1_error:;
  484. __Pyx_XDECREF(__pyx_t_1);
  485. if (__pyx_m) {
  486. __Pyx_AddTraceback("init hello");
  487. Py_DECREF(__pyx_m); __pyx_m = 0;
  488. } else if (!PyErr_Occurred()) {
  489. PyErr_SetString(PyExc_ImportError, "init hello");
  490. }
  491. __pyx_L0:;
  492. __Pyx_RefNannyFinishContext();
  493. #if PY_MAJOR_VERSION < 3
  494. return;
  495. #else
  496. return __pyx_m;
  497. #endif
  498. }
  499. /* Runtime support code */
  500. #if PY_MAJOR_VERSION < 3
  501. static PyObject *__Pyx_GetStdout(void) {
  502. PyObject *f = PySys_GetObject((char *)"stdout");
  503. if (!f) {
  504. PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
  505. }
  506. return f;
  507. }
  508. static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
  509. PyObject* v;
  510. int i;
  511. if (!f) {
  512. if (!(f = __Pyx_GetStdout()))
  513. return -1;
  514. }
  515. for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
  516. if (PyFile_SoftSpace(f, 1)) {
  517. if (PyFile_WriteString(" ", f) < 0)
  518. return -1;
  519. }
  520. v = PyTuple_GET_ITEM(arg_tuple, i);
  521. if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
  522. return -1;
  523. if (PyString_Check(v)) {
  524. char *s = PyString_AsString(v);
  525. Py_ssize_t len = PyString_Size(v);
  526. if (len > 0 &&
  527. isspace(Py_CHARMASK(s[len-1])) &&
  528. s[len-1] != ' ')
  529. PyFile_SoftSpace(f, 0);
  530. }
  531. }
  532. if (newline) {
  533. if (PyFile_WriteString("\n", f) < 0)
  534. return -1;
  535. PyFile_SoftSpace(f, 0);
  536. }
  537. return 0;
  538. }
  539. #else /* Python 3 has a print function */
  540. static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
  541. PyObject* kwargs = 0;
  542. PyObject* result = 0;
  543. PyObject* end_string;
  544. if (unlikely(!__pyx_print)) {
  545. __pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
  546. if (!__pyx_print)
  547. return -1;
  548. }
  549. if (stream) {
  550. kwargs = PyDict_New();
  551. if (unlikely(!kwargs))
  552. return -1;
  553. if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0))
  554. goto bad;
  555. if (!newline) {
  556. end_string = PyUnicode_FromStringAndSize(" ", 1);
  557. if (unlikely(!end_string))
  558. goto bad;
  559. if (PyDict_SetItemString(kwargs, "end", end_string) < 0) {
  560. Py_DECREF(end_string);
  561. goto bad;
  562. }
  563. Py_DECREF(end_string);
  564. }
  565. } else if (!newline) {
  566. if (unlikely(!__pyx_print_kwargs)) {
  567. __pyx_print_kwargs = PyDict_New();
  568. if (unlikely(!__pyx_print_kwargs))
  569. return -1;
  570. end_string = PyUnicode_FromStringAndSize(" ", 1);
  571. if (unlikely(!end_string))
  572. return -1;
  573. if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
  574. Py_DECREF(end_string);
  575. return -1;
  576. }
  577. Py_DECREF(end_string);
  578. }
  579. kwargs = __pyx_print_kwargs;
  580. }
  581. result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
  582. if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
  583. Py_DECREF(kwargs);
  584. if (!result)
  585. return -1;
  586. Py_DECREF(result);
  587. return 0;
  588. bad:
  589. if (kwargs != __pyx_print_kwargs)
  590. Py_XDECREF(kwargs);
  591. return -1;
  592. }
  593. #endif
  594. #if PY_MAJOR_VERSION < 3
  595. static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
  596. if (!f) {
  597. if (!(f = __Pyx_GetStdout()))
  598. return -1;
  599. }
  600. if (PyFile_SoftSpace(f, 0)) {
  601. if (PyFile_WriteString(" ", f) < 0)
  602. return -1;
  603. }
  604. if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
  605. return -1;
  606. if (PyFile_WriteString("\n", f) < 0)
  607. return -1;
  608. return 0;
  609. /* the line below is just to avoid compiler
  610. * compiler warnings about unused functions */
  611. return __Pyx_Print(f, NULL, 0);
  612. }
  613. #else /* Python 3 has a print function */
  614. static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
  615. int res;
  616. PyObject* arg_tuple = PyTuple_New(1);
  617. if (unlikely(!arg_tuple))
  618. return -1;
  619. Py_INCREF(o);
  620. PyTuple_SET_ITEM(arg_tuple, 0, o);
  621. res = __Pyx_Print(stream, arg_tuple, 1);
  622. Py_DECREF(arg_tuple);
  623. return res;
  624. }
  625. #endif
  626. static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
  627. const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
  628. const int is_unsigned = neg_one > const_zero;
  629. if (sizeof(unsigned char) < sizeof(long)) {
  630. long val = __Pyx_PyInt_AsLong(x);
  631. if (unlikely(val != (long)(unsigned char)val)) {
  632. if (!unlikely(val == -1 && PyErr_Occurred())) {
  633. PyErr_SetString(PyExc_OverflowError,
  634. (is_unsigned && unlikely(val < 0)) ?
  635. "can't convert negative value to unsigned char" :
  636. "value too large to convert to unsigned char");
  637. }
  638. return (unsigned char)-1;
  639. }
  640. return (unsigned char)val;
  641. }
  642. return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
  643. }
  644. static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
  645. const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
  646. const int is_unsigned = neg_one > const_zero;
  647. if (sizeof(unsigned short) < sizeof(long)) {
  648. long val = __Pyx_PyInt_AsLong(x);
  649. if (unlikely(val != (long)(unsigned short)val)) {
  650. if (!unlikely(val == -1 && PyErr_Occurred())) {
  651. PyErr_SetString(PyExc_OverflowError,
  652. (is_unsigned && unlikely(val < 0)) ?
  653. "can't convert negative value to unsigned short" :
  654. "value too large to convert to unsigned short");
  655. }
  656. return (unsigned short)-1;
  657. }
  658. return (unsigned short)val;
  659. }
  660. return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
  661. }
  662. static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
  663. const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
  664. const int is_unsigned = neg_one > const_zero;
  665. if (sizeof(unsigned int) < sizeof(long)) {
  666. long val = __Pyx_PyInt_AsLong(x);
  667. if (unlikely(val != (long)(unsigned int)val)) {
  668. if (!unlikely(val == -1 && PyErr_Occurred())) {
  669. PyErr_SetString(PyExc_OverflowError,
  670. (is_unsigned && unlikely(val < 0)) ?
  671. "can't convert negative value to unsigned int" :
  672. "value too large to convert to unsigned int");
  673. }
  674. return (unsigned int)-1;
  675. }
  676. return (unsigned int)val;
  677. }
  678. return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
  679. }
  680. static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
  681. const char neg_one = (char)-1, const_zero = 0;
  682. const int is_unsigned = neg_one > const_zero;
  683. if (sizeof(char) < sizeof(long)) {
  684. long val = __Pyx_PyInt_AsLong(x);
  685. if (unlikely(val != (long)(char)val)) {
  686. if (!unlikely(val == -1 && PyErr_Occurred())) {
  687. PyErr_SetString(PyExc_OverflowError,
  688. (is_unsigned && unlikely(val < 0)) ?
  689. "can't convert negative value to char" :
  690. "value too large to convert to char");
  691. }
  692. return (char)-1;
  693. }
  694. return (char)val;
  695. }
  696. return (char)__Pyx_PyInt_AsLong(x);
  697. }
  698. static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
  699. const short neg_one = (short)-1, const_zero = 0;
  700. const int is_unsigned = neg_one > const_zero;
  701. if (sizeof(short) < sizeof(long)) {
  702. long val = __Pyx_PyInt_AsLong(x);
  703. if (unlikely(val != (long)(short)val)) {
  704. if (!unlikely(val == -1 && PyErr_Occurred())) {
  705. PyErr_SetString(PyExc_OverflowError,
  706. (is_unsigned && unlikely(val < 0)) ?
  707. "can't convert negative value to short" :
  708. "value too large to convert to short");
  709. }
  710. return (short)-1;
  711. }
  712. return (short)val;
  713. }
  714. return (short)__Pyx_PyInt_AsLong(x);
  715. }
  716. static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
  717. const int neg_one = (int)-1, const_zero = 0;
  718. const int is_unsigned = neg_one > const_zero;
  719. if (sizeof(int) < sizeof(long)) {
  720. long val = __Pyx_PyInt_AsLong(x);
  721. if (unlikely(val != (long)(int)val)) {
  722. if (!unlikely(val == -1 && PyErr_Occurred())) {
  723. PyErr_SetString(PyExc_OverflowError,
  724. (is_unsigned && unlikely(val < 0)) ?
  725. "can't convert negative value to int" :
  726. "value too large to convert to int");
  727. }
  728. return (int)-1;
  729. }
  730. return (int)val;
  731. }
  732. return (int)__Pyx_PyInt_AsLong(x);
  733. }
  734. static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
  735. const signed char neg_one = (signed char)-1, const_zero = 0;
  736. const int is_unsigned = neg_one > const_zero;
  737. if (sizeof(signed char) < sizeof(long)) {
  738. long val = __Pyx_PyInt_AsLong(x);
  739. if (unlikely(val != (long)(signed char)val)) {
  740. if (!unlikely(val == -1 && PyErr_Occurred())) {
  741. PyErr_SetString(PyExc_OverflowError,
  742. (is_unsigned && unlikely(val < 0)) ?
  743. "can't convert negative value to signed char" :
  744. "value too large to convert to signed char");
  745. }
  746. return (signed char)-1;
  747. }
  748. return (signed char)val;
  749. }
  750. return (signed char)__Pyx_PyInt_AsSignedLong(x);
  751. }
  752. static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
  753. const signed short neg_one = (signed short)-1, const_zero = 0;
  754. const int is_unsigned = neg_one > const_zero;
  755. if (sizeof(signed short) < sizeof(long)) {
  756. long val = __Pyx_PyInt_AsLong(x);
  757. if (unlikely(val != (long)(signed short)val)) {
  758. if (!unlikely(val == -1 && PyErr_Occurred())) {
  759. PyErr_SetString(PyExc_OverflowError,
  760. (is_unsigned && unlikely(val < 0)) ?
  761. "can't convert negative value to signed short" :
  762. "value too large to convert to signed short");
  763. }
  764. return (signed short)-1;
  765. }
  766. return (signed short)val;
  767. }
  768. return (signed short)__Pyx_PyInt_AsSignedLong(x);
  769. }
  770. static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
  771. const signed int neg_one = (signed int)-1, const_zero = 0;
  772. const int is_unsigned = neg_one > const_zero;
  773. if (sizeof(signed int) < sizeof(long)) {
  774. long val = __Pyx_PyInt_AsLong(x);
  775. if (unlikely(val != (long)(signed int)val)) {
  776. if (!unlikely(val == -1 && PyErr_Occurred())) {
  777. PyErr_SetString(PyExc_OverflowError,
  778. (is_unsigned && unlikely(val < 0)) ?
  779. "can't convert negative value to signed int" :
  780. "value too large to convert to signed int");
  781. }
  782. return (signed int)-1;
  783. }
  784. return (signed int)val;
  785. }
  786. return (signed int)__Pyx_PyInt_AsSignedLong(x);
  787. }
  788. static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
  789. const int neg_one = (int)-1, const_zero = 0;
  790. const int is_unsigned = neg_one > const_zero;
  791. if (sizeof(int) < sizeof(long)) {
  792. long val = __Pyx_PyInt_AsLong(x);
  793. if (unlikely(val != (long)(int)val)) {
  794. if (!unlikely(val == -1 && PyErr_Occurred())) {
  795. PyErr_SetString(PyExc_OverflowError,
  796. (is_unsigned && unlikely(val < 0)) ?
  797. "can't convert negative value to int" :
  798. "value too large to convert to int");
  799. }
  800. return (int)-1;
  801. }
  802. return (int)val;
  803. }
  804. return (int)__Pyx_PyInt_AsLong(x);
  805. }
  806. static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
  807. const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
  808. const int is_unsigned = neg_one > const_zero;
  809. #if PY_VERSION_HEX < 0x03000000
  810. if (likely(PyInt_Check(x))) {
  811. long val = PyInt_AS_LONG(x);
  812. if (is_unsigned && unlikely(val < 0)) {
  813. PyErr_SetString(PyExc_OverflowError,
  814. "can't convert negative value to unsigned long");
  815. return (unsigned long)-1;
  816. }
  817. return (unsigned long)val;
  818. } else
  819. #endif
  820. if (likely(PyLong_Check(x))) {
  821. if (is_unsigned) {
  822. if (unlikely(Py_SIZE(x) < 0)) {
  823. PyErr_SetString(PyExc_OverflowError,
  824. "can't convert negative value to unsigned long");
  825. return (unsigned long)-1;
  826. }
  827. return PyLong_AsUnsignedLong(x);
  828. } else {
  829. return PyLong_AsLong(x);
  830. }
  831. } else {
  832. unsigned long val;
  833. PyObject *tmp = __Pyx_PyNumber_Int(x);
  834. if (!tmp) return (unsigned long)-1;
  835. val = __Pyx_PyInt_AsUnsignedLong(tmp);
  836. Py_DECREF(tmp);
  837. return val;
  838. }
  839. }
  840. static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
  841. const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
  842. const int is_unsigned = neg_one > const_zero;
  843. #if PY_VERSION_HEX < 0x03000000
  844. if (likely(PyInt_Check(x))) {
  845. long val = PyInt_AS_LONG(x);
  846. if (is_unsigned && unlikely(val < 0)) {
  847. PyErr_SetString(PyExc_OverflowError,
  848. "can't convert negative value to unsigned PY_LONG_LONG");
  849. return (unsigned PY_LONG_LONG)-1;
  850. }
  851. return (unsigned PY_LONG_LONG)val;
  852. } else
  853. #endif
  854. if (likely(PyLong_Check(x))) {
  855. if (is_unsigned) {
  856. if (unlikely(Py_SIZE(x) < 0)) {
  857. PyErr_SetString(PyExc_OverflowError,
  858. "can't convert negative value to unsigned PY_LONG_LONG");
  859. return (unsigned PY_LONG_LONG)-1;
  860. }
  861. return PyLong_AsUnsignedLongLong(x);
  862. } else {
  863. return PyLong_AsLongLong(x);
  864. }
  865. } else {
  866. unsigned PY_LONG_LONG val;
  867. PyObject *tmp = __Pyx_PyNumber_Int(x);
  868. if (!tmp) return (unsigned PY_LONG_LONG)-1;
  869. val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
  870. Py_DECREF(tmp);
  871. return val;
  872. }
  873. }
  874. static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
  875. const long neg_one = (long)-1, const_zero = 0;
  876. const int is_unsigned = neg_one > const_zero;
  877. #if PY_VERSION_HEX < 0x03000000
  878. if (likely(PyInt_Check(x))) {
  879. long val = PyInt_AS_LONG(x);
  880. if (is_unsigned && unlikely(val < 0)) {
  881. PyErr_SetString(PyExc_OverflowError,
  882. "can't convert negative value to long");
  883. return (long)-1;
  884. }
  885. return (long)val;
  886. } else
  887. #endif
  888. if (likely(PyLong_Check(x))) {
  889. if (is_unsigned) {
  890. if (unlikely(Py_SIZE(x) < 0)) {
  891. PyErr_SetString(PyExc_OverflowError,
  892. "can't convert negative value to long");
  893. return (long)-1;
  894. }
  895. return PyLong_AsUnsignedLong(x);
  896. } else {
  897. return PyLong_AsLong(x);
  898. }
  899. } else {
  900. long val;
  901. PyObject *tmp = __Pyx_PyNumber_Int(x);
  902. if (!tmp) return (long)-1;
  903. val = __Pyx_PyInt_AsLong(tmp);
  904. Py_DECREF(tmp);
  905. return val;
  906. }
  907. }
  908. static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
  909. const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
  910. const int is_unsigned = neg_one > const_zero;
  911. #if PY_VERSION_HEX < 0x03000000
  912. if (likely(PyInt_Check(x))) {
  913. long val = PyInt_AS_LONG(x);
  914. if (is_unsigned && unlikely(val < 0)) {
  915. PyErr_SetString(PyExc_OverflowError,
  916. "can't convert negative value to PY_LONG_LONG");
  917. return (PY_LONG_LONG)-1;
  918. }
  919. return (PY_LONG_LONG)val;
  920. } else
  921. #endif
  922. if (likely(PyLong_Check(x))) {
  923. if (is_unsigned) {
  924. if (unlikely(Py_SIZE(x) < 0)) {
  925. PyErr_SetString(PyExc_OverflowError,
  926. "can't convert negative value to PY_LONG_LONG");
  927. return (PY_LONG_LONG)-1;
  928. }
  929. return PyLong_AsUnsignedLongLong(x);
  930. } else {
  931. return PyLong_AsLongLong(x);
  932. }
  933. } else {
  934. PY_LONG_LONG val;
  935. PyObject *tmp = __Pyx_PyNumber_Int(x);
  936. if (!tmp) return (PY_LONG_LONG)-1;
  937. val = __Pyx_PyInt_AsLongLong(tmp);
  938. Py_DECREF(tmp);
  939. return val;
  940. }
  941. }
  942. static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
  943. const signed long neg_one = (signed long)-1, const_zero = 0;
  944. const int is_unsigned = neg_one > const_zero;
  945. #if PY_VERSION_HEX < 0x03000000
  946. if (likely(PyInt_Check(x))) {
  947. long val = PyInt_AS_LONG(x);
  948. if (is_unsigned && unlikely(val < 0)) {
  949. PyErr_SetString(PyExc_OverflowError,
  950. "can't convert negative value to signed long");
  951. return (signed long)-1;
  952. }
  953. return (signed long)val;
  954. } else
  955. #endif
  956. if (likely(PyLong_Check(x))) {
  957. if (is_unsigned) {
  958. if (unlikely(Py_SIZE(x) < 0)) {
  959. PyErr_SetString(PyExc_OverflowError,
  960. "can't convert negative value to signed long");
  961. return (signed long)-1;
  962. }
  963. return PyLong_AsUnsignedLong(x);
  964. } else {
  965. return PyLong_AsLong(x);
  966. }
  967. } else {
  968. signed long val;
  969. PyObject *tmp = __Pyx_PyNumber_Int(x);
  970. if (!tmp) return (signed long)-1;
  971. val = __Pyx_PyInt_AsSignedLong(tmp);
  972. Py_DECREF(tmp);
  973. return val;
  974. }
  975. }
  976. static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
  977. const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
  978. const int is_unsigned = neg_one > const_zero;
  979. #if PY_VERSION_HEX < 0x03000000
  980. if (likely(PyInt_Check(x))) {
  981. long val = PyInt_AS_LONG(x);
  982. if (is_unsigned && unlikely(val < 0)) {
  983. PyErr_SetString(PyExc_OverflowError,
  984. "can't convert negative value to signed PY_LONG_LONG");
  985. return (signed PY_LONG_LONG)-1;
  986. }
  987. return (signed PY_LONG_LONG)val;
  988. } else
  989. #endif
  990. if (likely(PyLong_Check(x))) {
  991. if (is_unsigned) {
  992. if (unlikely(Py_SIZE(x) < 0)) {
  993. PyErr_SetString(PyExc_OverflowError,
  994. "can't convert negative value to signed PY_LONG_LONG");
  995. return (signed PY_LONG_LONG)-1;
  996. }
  997. return PyLong_AsUnsignedLongLong(x);
  998. } else {
  999. return PyLong_AsLongLong(x);
  1000. }
  1001. } else {
  1002. signed PY_LONG_LONG val;
  1003. PyObject *tmp = __Pyx_PyNumber_Int(x);
  1004. if (!tmp) return (signed PY_LONG_LONG)-1;
  1005. val = __Pyx_PyInt_AsSignedLongLong(tmp);
  1006. Py_DECREF(tmp);
  1007. return val;
  1008. }
  1009. }
  1010. #include "compile.h"
  1011. #include "frameobject.h"
  1012. #include "traceback.h"
  1013. static void __Pyx_AddTraceback(const char *funcname) {
  1014. PyObject *py_srcfile = 0;
  1015. PyObject *py_funcname = 0;
  1016. PyObject *py_globals = 0;
  1017. PyCodeObject *py_code = 0;
  1018. PyFrameObject *py_frame = 0;
  1019. #if PY_MAJOR_VERSION < 3
  1020. py_srcfile = PyString_FromString(__pyx_filename);
  1021. #else
  1022. py_srcfile = PyUnicode_FromString(__pyx_filename);
  1023. #endif
  1024. if (!py_srcfile) goto bad;
  1025. if (__pyx_clineno) {
  1026. #if PY_MAJOR_VERSION < 3
  1027. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
  1028. #else
  1029. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
  1030. #endif
  1031. }
  1032. else {
  1033. #if PY_MAJOR_VERSION < 3
  1034. py_funcname = PyString_FromString(funcname);
  1035. #else
  1036. py_funcname = PyUnicode_FromString(funcname);
  1037. #endif
  1038. }
  1039. if (!py_funcname) goto bad;
  1040. py_globals = PyModule_GetDict(__pyx_m);
  1041. if (!py_globals) goto bad;
  1042. py_code = PyCode_New(
  1043. 0, /*int argcount,*/
  1044. #if PY_MAJOR_VERSION >= 3
  1045. 0, /*int kwonlyargcount,*/
  1046. #endif
  1047. 0, /*int nlocals,*/
  1048. 0, /*int stacksize,*/
  1049. 0, /*int flags,*/
  1050. __pyx_empty_bytes, /*PyObject *code,*/
  1051. __pyx_empty_tuple, /*PyObject *consts,*/
  1052. __pyx_empty_tuple, /*PyObject *names,*/
  1053. __pyx_empty_tuple, /*PyObject *varnames,*/
  1054. __pyx_empty_tuple, /*PyObject *freevars,*/
  1055. __pyx_empty_tuple, /*PyObject *cellvars,*/
  1056. py_srcfile, /*PyObject *filename,*/
  1057. py_funcname, /*PyObject *name,*/
  1058. __pyx_lineno, /*int firstlineno,*/
  1059. __pyx_empty_bytes /*PyObject *lnotab*/
  1060. );
  1061. if (!py_code) goto bad;
  1062. py_frame = PyFrame_New(
  1063. PyThreadState_GET(), /*PyThreadState *tstate,*/
  1064. py_code, /*PyCodeObject *code,*/
  1065. py_globals, /*PyObject *globals,*/
  1066. 0 /*PyObject *locals*/
  1067. );
  1068. if (!py_frame) goto bad;
  1069. py_frame->f_lineno = __pyx_lineno;
  1070. PyTraceBack_Here(py_frame);
  1071. bad:
  1072. Py_XDECREF(py_srcfile);
  1073. Py_XDECREF(py_funcname);
  1074. Py_XDECREF(py_code);
  1075. Py_XDECREF(py_frame);
  1076. }
  1077. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  1078. while (t->p) {
  1079. #if PY_MAJOR_VERSION < 3
  1080. if (t->is_unicode) {
  1081. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  1082. } else if (t->intern) {
  1083. *t->p = PyString_InternFromString(t->s);
  1084. } else {
  1085. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  1086. }
  1087. #else /* Python 3+ has unicode identifiers */
  1088. if (t->is_unicode | t->is_str) {
  1089. if (t->intern) {
  1090. *t->p = PyUnicode_InternFromString(t->s);
  1091. } else if (t->encoding) {
  1092. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  1093. } else {
  1094. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  1095. }
  1096. } else {
  1097. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  1098. }
  1099. #endif
  1100. if (!*t->p)
  1101. return -1;
  1102. ++t;
  1103. }
  1104. return 0;
  1105. }
  1106. /* Type Conversion Functions */
  1107. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  1108. int is_true = x == Py_True;
  1109. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  1110. else return PyObject_IsTrue(x);
  1111. }
  1112. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  1113. PyNumberMethods *m;
  1114. const char *name = NULL;
  1115. PyObject *res = NULL;
  1116. #if PY_VERSION_HEX < 0x03000000
  1117. if (PyInt_Check(x) || PyLong_Check(x))
  1118. #else
  1119. if (PyLong_Check(x))
  1120. #endif
  1121. return Py_INCREF(x), x;
  1122. m = Py_TYPE(x)->tp_as_number;
  1123. #if PY_VERSION_HEX < 0x03000000
  1124. if (m && m->nb_int) {
  1125. name = "int";
  1126. res = PyNumber_Int(x);
  1127. }
  1128. else if (m && m->nb_long) {
  1129. name = "long";
  1130. res = PyNumber_Long(x);
  1131. }
  1132. #else
  1133. if (m && m->nb_int) {
  1134. name = "int";
  1135. res = PyNumber_Long(x);
  1136. }
  1137. #endif
  1138. if (res) {
  1139. #if PY_VERSION_HEX < 0x03000000
  1140. if (!PyInt_Check(res) && !PyLong_Check(res)) {
  1141. #else
  1142. if (!PyLong_Check(res)) {
  1143. #endif
  1144. PyErr_Format(PyExc_TypeError,
  1145. "__%s__ returned non-%s (type %.200s)",
  1146. name, name, Py_TYPE(res)->tp_name);
  1147. Py_DECREF(res);
  1148. return NULL;
  1149. }
  1150. }
  1151. else if (!PyErr_Occurred()) {
  1152. PyErr_SetString(PyExc_TypeError,
  1153. "an integer is required");
  1154. }
  1155. return res;
  1156. }
  1157. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  1158. Py_ssize_t ival;
  1159. PyObject* x = PyNumber_Index(b);
  1160. if (!x) return -1;
  1161. ival = PyInt_AsSsize_t(x);
  1162. Py_DECREF(x);
  1163. return ival;
  1164. }
  1165. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  1166. #if PY_VERSION_HEX < 0x02050000
  1167. if (ival <= LONG_MAX)
  1168. return PyInt_FromLong((long)ival);
  1169. else {
  1170. unsigned char *bytes = (unsigned char *) &ival;
  1171. int one = 1; int little = (int)*(unsigned char*)&one;
  1172. return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
  1173. }
  1174. #else
  1175. return PyInt_FromSize_t(ival);
  1176. #endif
  1177. }
  1178. static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
  1179. unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
  1180. if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
  1181. return (size_t)-1;
  1182. } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
  1183. PyErr_SetString(PyExc_OverflowError,
  1184. "value too large to convert to size_t");
  1185. return (size_t)-1;
  1186. }
  1187. return (size_t)val;
  1188. }
  1189. #endif /* Py_PYTHON_H */