/* Generated by Cython 0.23.4 */

#ifndef __PYX_HAVE_API__sage__ext__interrupt__interrupt
#define __PYX_HAVE_API__sage__ext__interrupt__interrupt
#include "Python.h"
#include "interrupt.h"

static void (*__pyx_api_f_4sage_3ext_9interrupt_9interrupt_print_backtrace)(void) = 0;
#define print_backtrace __pyx_api_f_4sage_3ext_9interrupt_9interrupt_print_backtrace
static void (*__pyx_api_f_4sage_3ext_9interrupt_9interrupt__sig_on_interrupt_received)(void) = 0;
#define _sig_on_interrupt_received __pyx_api_f_4sage_3ext_9interrupt_9interrupt__sig_on_interrupt_received
static void (*__pyx_api_f_4sage_3ext_9interrupt_9interrupt__sig_on_recover)(void) = 0;
#define _sig_on_recover __pyx_api_f_4sage_3ext_9interrupt_9interrupt__sig_on_recover
static void (*__pyx_api_f_4sage_3ext_9interrupt_9interrupt__sig_off_warning)(char const *, int) = 0;
#define _sig_off_warning __pyx_api_f_4sage_3ext_9interrupt_9interrupt__sig_off_warning

static sage_signals_t *__pyx_api_vp_4sage_3ext_9interrupt_9interrupt__signals = 0;
#define _signals (*__pyx_api_vp_4sage_3ext_9interrupt_9interrupt__signals)
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportVoidPtr
#define __PYX_HAVE_RT_ImportVoidPtr
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, name);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C variable %.200s",
                PyModule_GetName(module), name);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    *p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), name, sig, desc);
        goto bad;
    }
    *p = PyCObject_AsVoidPtr(cobj);}
#endif
    if (!(*p))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif


static int import_sage__ext__interrupt__interrupt(void) {
  PyObject *module = 0;
  module = __Pyx_ImportModule("sage.ext.interrupt.interrupt");
  if (!module) goto bad;
  if (__Pyx_ImportFunction(module, "print_backtrace", (void (**)(void))&__pyx_api_f_4sage_3ext_9interrupt_9interrupt_print_backtrace, "void (void)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "_sig_on_interrupt_received", (void (**)(void))&__pyx_api_f_4sage_3ext_9interrupt_9interrupt__sig_on_interrupt_received, "void (void)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "_sig_on_recover", (void (**)(void))&__pyx_api_f_4sage_3ext_9interrupt_9interrupt__sig_on_recover, "void (void)") < 0) goto bad;
  if (__Pyx_ImportFunction(module, "_sig_off_warning", (void (**)(void))&__pyx_api_f_4sage_3ext_9interrupt_9interrupt__sig_off_warning, "void (char const *, int)") < 0) goto bad;
  if (__Pyx_ImportVoidPtr(module, "_signals", (void **)&__pyx_api_vp_4sage_3ext_9interrupt_9interrupt__signals, "sage_signals_t") < 0) goto bad;
  Py_DECREF(module); module = 0;
  return 0;
  bad:
  Py_XDECREF(module);
  return -1;
}

#endif /* !__PYX_HAVE_API__sage__ext__interrupt__interrupt */
