9#define PY_SSIZE_T_CLEAN
30static std::map<int, std::map<int, std::vector<PyObject*>>>
callbacks;
36 for (PyObject* fun :
callbacks[plugin_id][ep]) {
38 PyObject* rv = PyObject_CallObject(fun, 0);
40 if (PyErr_Occurred()) {
50 if (!PyArg_ParseTuple(args,
"iO", &ientry_point, &callback)) {
54 if (!PyCallable_Check(callback)) {
55 return PyErr_Format(PyExc_TypeError,
"A callable is required");
71 return PyLong_FromLong((
long)EP_DESTRUCTOR);
84 static char const* kwlist[] = {(
char*)
"iep", NULL};
85 if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"i", (
char**)&kwlist, &iep)) {
88 const char* out_ep_name =
90 using namespace std::string_literals;
92 return Py_BuildValue(
"s", out_ep_name);
98 "Registers callback to ICON"},
101 METH_VARARGS | METH_KEYWORDS,
102 "C function signature: const char* "
103 "comin_callback_get_ep_name(t_comin_entry_point iep)"},
C interface for the ICON Community Interface.
const char * comin_callback_get_ep_name(t_comin_entry_point iep)
void comin_plugin_finish(const char *routine, const char *text)
int comin_current_get_plugin_id()
t_comin_entry_point comin_current_get_ep()
Represents an Entry Point.
static PyObject * callback_get_ep_name(PyObject *, PyObject *args, PyObject *kwargs)
Get the name of an entry point.
void comin_callback_register(t_comin_entry_point entry_point, t_comin_callback_function fct_ptr)
void check_error(std::string add_info)
static PyObject * callback_register(PyObject *, PyObject *args)
static std::map< int, std::map< int, std::vector< PyObject * > > > callbacks
static PyObject * EP_DESCTRUCTOR(PyObject *, PyObject *)
std::vector< PyMethodDef > callbacks_methods()
PyObject * func_wrapper(PyObject *self, PyObject *args)