static PyObject *deregister_callback(PyObject *self, PyObject *args) { gpi_sim_hdl hdl; PyObject *value; FENTER if (!PyArg_ParseTuple(args, "O&", gpi_sim_hdl_converter, &hdl)) { return NULL; } gpi_deregister_callback(hdl); value = Py_BuildValue("s", "OK!"); FEXIT return value; }
static inline int __gpi_register_cb(p_vhpi_cb_user_data user, vhpiCbDataT *cb_data) { /* If the user data already has a callback handle then deregister * before getting the new one */ vhpiHandleT new_hdl = vhpi_register_cb(cb_data, vhpiReturnCb); int ret = 0; if (!new_hdl) { LOG_CRITICAL("VHPI: Unable to register callback a handle for VHPI type %s(%d)", vhpi_reason_to_string(cb_data->reason), cb_data->reason); check_vhpi_error(); ret = -1; } if (user->cb_hdl != NULL) { printf("VHPI: Attempt to register a callback that's already registered...\n"); gpi_deregister_callback(&user->gpi_hdl); } user->cb_hdl = new_hdl; return ret; }