Ticket #225: encode_int.c

File encode_int.c, 26.4 KB (added by nick, 9 months ago)

Generated c source file

Line 
1/* Generated by Cython 0.9.6.12 on Sat Mar  8 22:33:41 2008 */
2
3#define PY_SSIZE_T_CLEAN
4#include "Python.h"
5#include "structmember.h"
6#ifndef PY_LONG_LONG
7  #define PY_LONG_LONG LONG_LONG
8#endif
9#if PY_VERSION_HEX < 0x02050000
10  typedef int Py_ssize_t;
11  #define PY_SSIZE_T_MAX INT_MAX
12  #define PY_SSIZE_T_MIN INT_MIN
13  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
14  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
15  #define PyNumber_Index(o)    PyNumber_Int(o)
16  #define PyIndex_Check(o)     PyNumber_Check(o)
17#endif
18#if PY_VERSION_HEX < 0x02040000
19  #define METH_COEXIST 0
20#endif
21#ifndef WIN32
22  #define __stdcall
23  #define __cdecl
24#endif
25#ifdef __cplusplus
26#define __PYX_EXTERN_C extern "C"
27#else
28#define __PYX_EXTERN_C extern
29#endif
30#include <math.h>
31#include "stdlib.h"
32
33
34#ifdef __GNUC__
35#define INLINE __inline__
36#elif _WIN32
37#define INLINE __inline
38#else
39#define INLINE
40#endif
41
42typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
43typedef struct {PyObject **p; char *s; long n; int is_unicode;} __Pyx_StringTabEntry; /*proto*/
44
45
46
47static int __pyx_skip_dispatch = 0;
48
49
50/* Type Conversion Predeclarations */
51
52#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
53static INLINE int __Pyx_PyObject_IsTrue(PyObject* x);
54static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x);
55static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x);
56static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b);
57
58#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x))
59#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
60
61static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x);
62static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x);
63static INLINE char __pyx_PyInt_char(PyObject* x);
64static INLINE short __pyx_PyInt_short(PyObject* x);
65static INLINE int __pyx_PyInt_int(PyObject* x);
66static INLINE long __pyx_PyInt_long(PyObject* x);
67static INLINE signed char __pyx_PyInt_signed_char(PyObject* x);
68static INLINE signed short __pyx_PyInt_signed_short(PyObject* x);
69static INLINE signed int __pyx_PyInt_signed_int(PyObject* x);
70static INLINE signed long __pyx_PyInt_signed_long(PyObject* x);
71static INLINE long double __pyx_PyInt_long_double(PyObject* x);
72#ifdef __GNUC__
73/* Test for GCC > 2.95 */
74#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
75#define likely(x)   __builtin_expect(!!(x), 1)
76#define unlikely(x) __builtin_expect(!!(x), 0)
77#else /* __GNUC__ > 2 ... */
78#define likely(x)   (x)
79#define unlikely(x) (x)
80#endif /* __GNUC__ > 2 ... */
81#else /* __GNUC__ */
82#define likely(x)   (x)
83#define unlikely(x) (x)
84#endif /* __GNUC__ */
85   
86static PyObject *__pyx_m;
87static PyObject *__pyx_b;
88static PyObject *__pyx_empty_tuple;
89static int __pyx_lineno;
90static char *__pyx_filename;
91static char **__pyx_f;
92
93static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
94
95static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
96
97static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
98
99static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
100
101static void __Pyx_AddTraceback(char *funcname); /*proto*/
102
103/* Declarations from numbers */
104
105
106
107/* Implementation of numbers */
108
109/* "/home/nick/dev/numbers.pyx":4
110 *     cdef void *malloc(int size)
111 *
112 * def encode_int(long n):             # <<<<<<<<<<<<<<
113 *     if <unsigned long>n > 0x40000000:
114 *         raise ValueError, "Out of range"
115 */
116
117static PyObject *__pyx_n_ValueError;
118
119static PyObject *__pyx_k_1p;
120
121static PyObject *__pyx_builtin_ValueError;
122
123static char __pyx_k_1[] = "Out of range";
124
125static PyObject *__pyx_pf_7numbers_encode_int(PyObject *__pyx_self, PyObject *__pyx_arg_n); /*proto*/
126static PyObject *__pyx_pf_7numbers_encode_int(PyObject *__pyx_self, PyObject *__pyx_arg_n) {
127  long __pyx_v_n;
128  char *__pyx_v_bytes;
129  long __pyx_v_real_value;
130  char __pyx_v_changed;
131  unsigned char __pyx_v_count;
132  PyObject *__pyx_r;
133  int __pyx_1;
134  PyObject *__pyx_2 = 0;
135  assert(__pyx_arg_n); {
136    __pyx_v_n = __pyx_PyInt_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
137  }
138
139  /* "/home/nick/dev/numbers.pyx":5
140 *
141 * def encode_int(long n):
142 *     if <unsigned long>n > 0x40000000:             # <<<<<<<<<<<<<<
143 *         raise ValueError, "Out of range"
144 *
145 */
146  __pyx_1 = (((unsigned long)__pyx_v_n) > 0x40000000);
147  if (__pyx_1) {
148
149    /* "/home/nick/dev/numbers.pyx":6
150 * def encode_int(long n):
151 *     if <unsigned long>n > 0x40000000:
152 *         raise ValueError, "Out of range"             # <<<<<<<<<<<<<<
153 *
154 *     cdef char *bytes = NULL
155 */
156    __Pyx_Raise(__pyx_builtin_ValueError, __pyx_k_1p, 0);
157    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
158    goto __pyx_L2;
159  }
160  __pyx_L2:;
161
162  /* "/home/nick/dev/numbers.pyx":8
163 *         raise ValueError, "Out of range"
164 *
165 *     cdef char *bytes = NULL             # <<<<<<<<<<<<<<
166 *     cdef long real_value = n
167 *     cdef char changed = 0
168 */
169  __pyx_v_bytes = NULL;
170
171
172  /* "/home/nick/dev/numbers.pyx":9
173 *
174 *     cdef char *bytes = NULL
175 *     cdef long real_value = n             # <<<<<<<<<<<<<<
176 *     cdef char changed = 0
177 *     cdef unsigned char count = 0
178 */
179  __pyx_v_real_value = __pyx_v_n;
180
181
182  /* "/home/nick/dev/numbers.pyx":10
183 *     cdef char *bytes = NULL
184 *     cdef long real_value = n
185 *     cdef char changed = 0             # <<<<<<<<<<<<<<
186 *     cdef unsigned char count = 0
187 *
188 */
189  __pyx_v_changed = 0;
190
191
192  /* "/home/nick/dev/numbers.pyx":11
193 *     cdef long real_value = n
194 *     cdef char changed = 0
195 *     cdef unsigned char count = 0             # <<<<<<<<<<<<<<
196 *
197 *     if n > 0x1fffff:
198 */
199  __pyx_v_count = 0;
200
201
202  /* "/home/nick/dev/numbers.pyx":13
203 *     cdef unsigned char count = 0
204 *
205 *     if n > 0x1fffff:             # <<<<<<<<<<<<<<
206 *         bytes = <char *>malloc(5 * sizeof(char))
207 *         real_value = n
208 */
209  __pyx_1 = (__pyx_v_n > 0x1fffff);
210  if (__pyx_1) {
211
212    /* "/home/nick/dev/numbers.pyx":14
213 *
214 *     if n > 0x1fffff:
215 *         bytes = <char *>malloc(5 * sizeof(char))             # <<<<<<<<<<<<<<
216 *         real_value = n
217 *         changed = 1
218 */
219    __pyx_v_bytes = ((char *)malloc((5 * (sizeof(char)))));
220
221    /* "/home/nick/dev/numbers.pyx":15
222 *     if n > 0x1fffff:
223 *         bytes = <char *>malloc(5 * sizeof(char))
224 *         real_value = n             # <<<<<<<<<<<<<<
225 *         changed = 1
226 *         n = n >> 1
227 */
228    __pyx_v_real_value = __pyx_v_n;
229
230    /* "/home/nick/dev/numbers.pyx":16
231 *         bytes = <char *>malloc(5 * sizeof(char))
232 *         real_value = n
233 *         changed = 1             # <<<<<<<<<<<<<<
234 *         n = n >> 1
235 *         bytes[count] = 0x80 | ((n >> 21) & 0xff)
236 */
237    __pyx_v_changed = 1;
238
239    /* "/home/nick/dev/numbers.pyx":17
240 *         real_value = n
241 *         changed = 1
242 *         n = n >> 1             # <<<<<<<<<<<<<<
243 *         bytes[count] = 0x80 | ((n >> 21) & 0xff)
244 *         count += 1
245 */
246    __pyx_v_n = (__pyx_v_n >> 1);
247
248    /* "/home/nick/dev/numbers.pyx":18
249 *         changed = 1
250 *         n = n >> 1
251 *         bytes[count] = 0x80 | ((n >> 21) & 0xff)             # <<<<<<<<<<<<<<
252 *         count += 1
253 *
254 */
255    (__pyx_v_bytes[__pyx_v_count]) = (0x80 | ((__pyx_v_n >> 21) & 0xff));
256
257    /* "/home/nick/dev/numbers.pyx":19
258 *         n = n >> 1
259 *         bytes[count] = 0x80 | ((n >> 21) & 0xff)
260 *         count += 1             # <<<<<<<<<<<<<<
261 *
262 *     if n > 0x3fff:
263 */
264    __pyx_v_count += 1;
265    goto __pyx_L3;
266  }
267  __pyx_L3:;
268
269  /* "/home/nick/dev/numbers.pyx":21
270 *         count += 1
271 *
272 *     if n > 0x3fff:             # <<<<<<<<<<<<<<
273 *         if bytes == NULL:
274 *             bytes = <char *>malloc(4)
275 */
276  __pyx_1 = (__pyx_v_n > 0x3fff);
277  if (__pyx_1) {
278
279    /* "/home/nick/dev/numbers.pyx":22
280 *
281 *     if n > 0x3fff:
282 *         if bytes == NULL:             # <<<<<<<<<<<<<<
283 *             bytes = <char *>malloc(4)
284 *
285 */
286    __pyx_1 = (__pyx_v_bytes == NULL);
287    if (__pyx_1) {
288
289      /* "/home/nick/dev/numbers.pyx":23
290 *     if n > 0x3fff:
291 *         if bytes == NULL:
292 *             bytes = <char *>malloc(4)             # <<<<<<<<<<<<<<
293 *
294 *         bytes[count] = 0x80 | ((n >> 14) & 0xff)
295 */
296      __pyx_v_bytes = ((char *)malloc(4));
297      goto __pyx_L5;
298    }
299    __pyx_L5:;
300
301    /* "/home/nick/dev/numbers.pyx":25
302 *             bytes = <char *>malloc(4)
303 *
304 *         bytes[count] = 0x80 | ((n >> 14) & 0xff)             # <<<<<<<<<<<<<<
305 *         count += 1
306 *
307 */
308    (__pyx_v_bytes[__pyx_v_count]) = (0x80 | ((__pyx_v_n >> 14) & 0xff));
309
310    /* "/home/nick/dev/numbers.pyx":26
311 *
312 *         bytes[count] = 0x80 | ((n >> 14) & 0xff)
313 *         count += 1             # <<<<<<<<<<<<<<
314 *
315 *     if n > 0x7f:
316 */
317    __pyx_v_count += 1;
318    goto __pyx_L4;
319  }
320  __pyx_L4:;
321
322  /* "/home/nick/dev/numbers.pyx":28
323 *         count += 1
324 *
325 *     if n > 0x7f:             # <<<<<<<<<<<<<<
326 *         if bytes == NULL:
327 *             bytes = <char *>malloc(3)
328 */
329  __pyx_1 = (__pyx_v_n > 0x7f);
330  if (__pyx_1) {
331
332    /* "/home/nick/dev/numbers.pyx":29
333 *
334 *     if n > 0x7f:
335 *         if bytes == NULL:             # <<<<<<<<<<<<<<
336 *             bytes = <char *>malloc(3)
337 *
338 */
339    __pyx_1 = (__pyx_v_bytes == NULL);
340    if (__pyx_1) {
341
342      /* "/home/nick/dev/numbers.pyx":30
343 *     if n > 0x7f:
344 *         if bytes == NULL:
345 *             bytes = <char *>malloc(3)             # <<<<<<<<<<<<<<
346 *
347 *         bytes[count] = 0x80 | ((n >> 7) & 0xff)
348 */
349      __pyx_v_bytes = ((char *)malloc(3));
350      goto __pyx_L7;
351    }
352    __pyx_L7:;
353
354    /* "/home/nick/dev/numbers.pyx":32
355 *             bytes = <char *>malloc(3)
356 *
357 *         bytes[count] = 0x80 | ((n >> 7) & 0xff)             # <<<<<<<<<<<<<<
358 *         count += 1
359 *
360 */
361    (__pyx_v_bytes[__pyx_v_count]) = (0x80 | ((__pyx_v_n >> 7) & 0xff));
362
363    /* "/home/nick/dev/numbers.pyx":33
364 *
365 *         bytes[count] = 0x80 | ((n >> 7) & 0xff)
366 *         count += 1             # <<<<<<<<<<<<<<
367 *
368 *     if changed == 1:
369 */
370    __pyx_v_count += 1;
371    goto __pyx_L6;
372  }
373  __pyx_L6:;
374
375  /* "/home/nick/dev/numbers.pyx":35
376 *         count += 1
377 *
378 *     if changed == 1:             # <<<<<<<<<<<<<<
379 *         n = real_value
380 *
381 */
382  __pyx_1 = (__pyx_v_changed == 1);
383  if (__pyx_1) {
384
385    /* "/home/nick/dev/numbers.pyx":36
386 *
387 *     if changed == 1:
388 *         n = real_value             # <<<<<<<<<<<<<<
389 *
390 *     if bytes == NULL:
391 */
392    __pyx_v_n = __pyx_v_real_value;
393    goto __pyx_L8;
394  }
395  __pyx_L8:;
396
397  /* "/home/nick/dev/numbers.pyx":38
398 *         n = real_value
399 *
400 *     if bytes == NULL:             # <<<<<<<<<<<<<<
401 *         bytes = <char *>malloc(2)
402 *
403 */
404  __pyx_1 = (__pyx_v_bytes == NULL);
405  if (__pyx_1) {
406
407    /* "/home/nick/dev/numbers.pyx":39
408 *
409 *     if bytes == NULL:
410 *         bytes = <char *>malloc(2)             # <<<<<<<<<<<<<<
411 *
412 *     if n > 0x1fffff:
413 */
414    __pyx_v_bytes = ((char *)malloc(2));
415    goto __pyx_L9;
416  }
417  __pyx_L9:;
418
419  /* "/home/nick/dev/numbers.pyx":41
420 *         bytes = <char *>malloc(2)
421 *
422 *     if n > 0x1fffff:             # <<<<<<<<<<<<<<
423 *         bytes[count] = n & 0xff
424 *     else:
425 */
426  __pyx_1 = (__pyx_v_n > 0x1fffff);
427  if (__pyx_1) {
428
429    /* "/home/nick/dev/numbers.pyx":42
430 *
431 *     if n > 0x1fffff:
432 *         bytes[count] = n & 0xff             # <<<<<<<<<<<<<<
433 *     else:
434 *         bytes[count] = n & 0x7f
435 */
436    (__pyx_v_bytes[__pyx_v_count]) = (__pyx_v_n & 0xff);
437    goto __pyx_L10;
438  }
439  /*else*/ {
440
441    /* "/home/nick/dev/numbers.pyx":44
442 *         bytes[count] = n & 0xff
443 *     else:
444 *         bytes[count] = n & 0x7f             # <<<<<<<<<<<<<<
445 *
446 *     bytes[count + 1] = 0
447 */
448    (__pyx_v_bytes[__pyx_v_count]) = (__pyx_v_n & 0x7f);
449  }
450  __pyx_L10:;
451
452  /* "/home/nick/dev/numbers.pyx":46
453 *         bytes[count] = n & 0x7f
454 *
455 *     bytes[count + 1] = 0             # <<<<<<<<<<<<<<
456 *
457 *     return bytes
458 */
459  (__pyx_v_bytes[(__pyx_v_count + 1)]) = 0;
460
461  /* "/home/nick/dev/numbers.pyx":48
462 *     bytes[count + 1] = 0
463 *
464 *     return bytes             # <<<<<<<<<<<<<<
465 */
466  __pyx_2 = PyString_FromString(__pyx_v_bytes); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
467  __pyx_r = __pyx_2;
468  __pyx_2 = 0;
469  goto __pyx_L0;
470
471  __pyx_r = Py_None; Py_INCREF(Py_None);
472  goto __pyx_L0;
473  __pyx_L1:;
474  Py_XDECREF(__pyx_2);
475  __Pyx_AddTraceback("numbers.encode_int");
476  __pyx_r = NULL;
477  __pyx_L0:;
478  return __pyx_r;
479}
480
481static __Pyx_InternTabEntry __pyx_intern_tab[] = {
482  {&__pyx_n_ValueError, "ValueError"},
483  {0, 0}
484};
485
486static __Pyx_StringTabEntry __pyx_string_tab[] = {
487  {&__pyx_k_1p, __pyx_k_1, sizeof(__pyx_k_1), 0},
488  {0, 0, 0, 0}
489};
490
491static struct PyMethodDef __pyx_methods[] = {
492  {"encode_int", (PyCFunction)__pyx_pf_7numbers_encode_int, METH_O, 0},
493  {0, 0, 0, 0}
494};
495
496static void __pyx_init_filenames(void); /*proto*/
497
498PyMODINIT_FUNC initnumbers(void); /*proto*/
499PyMODINIT_FUNC initnumbers(void) {
500  /*--- Libary function declarations ---*/
501  __pyx_init_filenames();
502  /*--- Module creation code ---*/
503  __pyx_m = Py_InitModule4("numbers", __pyx_methods, 0, 0, PYTHON_API_VERSION);
504  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
505  __pyx_b = PyImport_AddModule("__builtin__");
506  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
507  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
508  /*--- Intern code ---*/
509  if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
510  /*--- String init code ---*/
511  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
512  /*--- Builtin init code ---*/
513  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; goto __pyx_L1;}
514  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;}
515  __pyx_skip_dispatch = 0;
516  /*--- Global init code ---*/
517  /*--- Function export code ---*/
518  /*--- Function import code ---*/
519  /*--- Type init code ---*/
520  /*--- Type import code ---*/
521  /*--- Execution code ---*/
522
523  /* "/home/nick/dev/numbers.pyx":4
524 *     cdef void *malloc(int size)
525 *
526 * def encode_int(long n):             # <<<<<<<<<<<<<<
527 *     if <unsigned long>n > 0x40000000:
528 *         raise ValueError, "Out of range"
529 */
530  return;
531  __pyx_L1:;
532  __Pyx_AddTraceback("numbers");
533}
534
535static char *__pyx_filenames[] = {
536  "numbers.pyx",
537};
538
539/* Runtime support code */
540
541static void __pyx_init_filenames(void) {
542  __pyx_f = __pyx_filenames;
543}
544
545static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
546    PyObject *result;
547    result = PyObject_GetAttr(dict, name);
548    if (!result)
549        PyErr_SetObject(PyExc_NameError, name);
550    return result;
551}
552
553static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
554    Py_XINCREF(type);
555    Py_XINCREF(value);
556    Py_XINCREF(tb);
557    /* First, check the traceback argument, replacing None with NULL. */
558    if (tb == Py_None) {
559        Py_DECREF(tb);
560        tb = 0;
561    }
562    else if (tb != NULL && !PyTraceBack_Check(tb)) {
563        PyErr_SetString(PyExc_TypeError,
564            "raise: arg 3 must be a traceback or None");
565        goto raise_error;
566    }
567    /* Next, replace a missing value with None */
568    if (value == NULL) {
569        value = Py_None;
570        Py_INCREF(value);
571    }
572    #if PY_VERSION_HEX < 0x02050000
573    if (!PyClass_Check(type))
574    #else
575    if (!PyType_Check(type))
576    #endif
577    {
578        /* Raising an instance.  The value should be a dummy. */
579        if (value != Py_None) {
580            PyErr_SetString(PyExc_TypeError,
581                "instance exception may not have a separate value");
582            goto raise_error;
583        }
584        /* Normalize to raise <class>, <instance> */
585        Py_DECREF(value);
586        value = type;
587        #if PY_VERSION_HEX < 0x02050000
588            if (PyInstance_Check(type)) {
589                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
590                Py_INCREF(type);
591            }
592            else {
593                PyErr_SetString(PyExc_TypeError,
594                    "raise: exception must be an old-style class or instance");
595                goto raise_error;
596            }
597        #else
598            type = (PyObject*) type->ob_type;
599            Py_INCREF(type);
600            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
601                PyErr_SetString(PyExc_TypeError,
602                    "raise: exception class must be a subclass of BaseException");
603                goto raise_error;
604            }
605        #endif
606    }
607    PyErr_Restore(type, value, tb);
608    return;
609raise_error:
610    Py_XDECREF(value);
611    Py_XDECREF(type);
612    Py_XDECREF(tb);
613    return;
614}
615
616static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
617    while (t->p) {
618        *t->p = PyString_InternFromString(t->s);
619        if (!*t->p)
620            return -1;
621        ++t;
622    }
623    return 0;
624}
625
626static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
627    while (t->p) {
628        if (t->is_unicode) {
629            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
630        } else {
631            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
632        }
633        if (!*t->p)
634            return -1;
635        ++t;
636    }
637    return 0;
638}
639
640#include "compile.h"
641#include "frameobject.h"
642#include "traceback.h"
643
644static void __Pyx_AddTraceback(char *funcname) {
645    PyObject *py_srcfile = 0;
646    PyObject *py_funcname = 0;
647    PyObject *py_globals = 0;
648    PyObject *empty_string = 0;
649    PyCodeObject *py_code = 0;
650    PyFrameObject *py_frame = 0;
651   
652    py_srcfile = PyString_FromString(__pyx_filename);
653    if (!py_srcfile) goto bad;
654    py_funcname = PyString_FromString(funcname);
655    if (!py_funcname) goto bad;
656    py_globals = PyModule_GetDict(__pyx_m);
657    if (!py_globals) goto bad;
658    empty_string = PyString_FromString("");
659    if (!empty_string) goto bad;
660    py_code = PyCode_New(
661        0,            /*int argcount,*/
662        0,            /*int nlocals,*/
663        0,            /*int stacksize,*/
664        0,            /*int flags,*/
665        empty_string, /*PyObject *code,*/
666        __pyx_empty_tuple,  /*PyObject *consts,*/
667        __pyx_empty_tuple,  /*PyObject *names,*/
668        __pyx_empty_tuple,  /*PyObject *varnames,*/
669        __pyx_empty_tuple,  /*PyObject *freevars,*/
670        __pyx_empty_tuple,  /*PyObject *cellvars,*/
671        py_srcfile,   /*PyObject *filename,*/
672        py_funcname,  /*PyObject *name,*/
673        __pyx_lineno,   /*int firstlineno,*/
674        empty_string  /*PyObject *lnotab*/
675    );
676    if (!py_code) goto bad;
677    py_frame = PyFrame_New(
678        PyThreadState_Get(), /*PyThreadState *tstate,*/
679        py_code,             /*PyCodeObject *code,*/
680        py_globals,          /*PyObject *globals,*/
681        0                    /*PyObject *locals*/
682    );
683    if (!py_frame) goto bad;
684    py_frame->f_lineno = __pyx_lineno;
685    PyTraceBack_Here(py_frame);
686bad:
687    Py_XDECREF(py_srcfile);
688    Py_XDECREF(py_funcname);
689    Py_XDECREF(empty_string);
690    Py_XDECREF(py_code);
691    Py_XDECREF(py_frame);
692}
693
694/* Type Conversion Functions */
695
696static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) {
697  Py_ssize_t ival;
698  PyObject* x = PyNumber_Index(b);
699  if (!x) return -1;
700  ival = PyInt_AsSsize_t(x);
701  Py_DECREF(x);
702  return ival;
703}
704
705static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
706   if (x == Py_True) return 1;
707   else if (x == Py_False) return 0;
708   else return PyObject_IsTrue(x);
709}
710
711static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) {
712    if (PyInt_CheckExact(x)) {
713        return PyInt_AS_LONG(x);
714    }
715    else if (PyLong_CheckExact(x)) {
716        return PyLong_AsLongLong(x);
717    }
718    else {
719        PY_LONG_LONG val;
720        PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1;
721        val = __pyx_PyInt_AsLongLong(tmp);
722        Py_DECREF(tmp);
723        return val;
724    }
725}
726
727static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
728    if (PyInt_CheckExact(x)) {
729        long val = PyInt_AS_LONG(x);
730        if (unlikely(val < 0)) {
731            PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type.");
732            return (unsigned PY_LONG_LONG)-1;
733        }
734        return val;
735    }
736    else if (PyLong_CheckExact(x)) {
737        return PyLong_AsUnsignedLongLong(x);
738    }
739    else {
740        PY_LONG_LONG val;
741        PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1;
742        val = __pyx_PyInt_AsUnsignedLongLong(tmp);
743        Py_DECREF(tmp);
744        return val;
745    }
746}
747
748
749static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) {
750    if (sizeof(unsigned char) < sizeof(long)) {
751        long long_val = __pyx_PyInt_AsLong(x);
752        unsigned char val = (unsigned char)long_val;
753        if (unlikely((val != long_val)  || (long_val < 0))) {
754            PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char");
755            return (unsigned char)-1;
756        }
757        return val;
758    }
759    else {
760        return __pyx_PyInt_AsLong(x);
761    }
762}
763
764static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) {
765    if (sizeof(unsigned short) < sizeof(long)) {
766        long long_val = __pyx_PyInt_AsLong(x);
767        unsigned short val = (unsigned short)long_val;
768        if (unlikely((val != long_val)  || (long_val < 0))) {
769            PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short");
770            return (unsigned short)-1;
771        }
772        return val;
773    }
774    else {
775        return __pyx_PyInt_AsLong(x);
776    }
777}
778
779static INLINE char __pyx_PyInt_char(PyObject* x) {
780    if (sizeof(char) < sizeof(long)) {
781        long long_val = __pyx_PyInt_AsLong(x);
782        char val = (char)long_val;
783        if (unlikely((val != long_val) )) {
784            PyErr_SetString(PyExc_OverflowError, "value too large to convert to char");
785            return (char)-1;
786        }
787        return val;
788    }
789    else {
790        return __pyx_PyInt_AsLong(x);
791    }
792}
793
794static INLINE short __pyx_PyInt_short(PyObject* x) {
795    if (sizeof(short) < sizeof(long)) {
796        long long_val = __pyx_PyInt_AsLong(x);
797        short val = (short)long_val;
798        if (unlikely((val != long_val) )) {
799            PyErr_SetString(PyExc_OverflowError, "value too large to convert to short");
800            return (short)-1;
801        }
802        return val;
803    }
804    else {
805        return __pyx_PyInt_AsLong(x);
806    }
807}
808
809static INLINE int __pyx_PyInt_int(PyObject* x) {
810    if (sizeof(int) < sizeof(long)) {
811        long long_val = __pyx_PyInt_AsLong(x);
812        int val = (int)long_val;
813        if (unlikely((val != long_val) )) {
814            PyErr_SetString(PyExc_OverflowError, "value too large to convert to int");
815            return (int)-1;
816        }
817        return val;
818    }
819    else {
820        return __pyx_PyInt_AsLong(x);
821    }
822}
823
824static INLINE long __pyx_PyInt_long(PyObject* x) {
825    if (sizeof(long) < sizeof(long)) {
826        long long_val = __pyx_PyInt_AsLong(x);
827        long val = (long