Generated by Cython 0.21.1
Raw output: rns510.c
01: import cython
02:
03: from libc.stdlib cimport malloc
04: from libc.stdlib cimport free
05:
06: cdef extern from "librns510.h":
07: void librns510_encode(const char *lat, const char *lon, char *code)
08: cdef extern from "librns510.h":
09: char *librns510_decode(const char *code, char *lat, char *lon)
10:
+11: cdef rns510_encode(char *lat, char *lon):
static PyObject *__pyx_f_6rns510_rns510_encode(char *__pyx_v_lat, char *__pyx_v_lon) { PyObject *__pyx_v_py_string = 0; char *__pyx_v_out; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("rns510_encode", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("rns510.rns510_encode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_py_string); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+12: assert lat is not NULL
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_lat != NULL) != 0))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif
+13: assert lon is not NULL
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_lon != NULL) != 0))) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif
14: cdef bytes py_string
15: cdef char *out;
16:
+17: out=<char *> malloc(128)
__pyx_v_out = ((char *)malloc(128));
+18: librns510_encode(lat,lon,out)
librns510_encode(__pyx_v_lat, __pyx_v_lon, __pyx_v_out);
+19: try:
/*try:*/ {
+20: py_string=out
__pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_out); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L4_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_string = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; }
21: finally:
+22: free(out)
/*finally:*/ { /*normal exit:*/{ free(__pyx_v_out); goto __pyx_L5; } /*exception exit:*/{ __pyx_L4_error:; __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); __pyx_t_2 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename; { free(__pyx_v_out); } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); } __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7); __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4; goto __pyx_L1_error; } __pyx_L5:; }
23:
+24: return py_string
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_py_string); __pyx_r = __pyx_v_py_string; goto __pyx_L0;
25: