"OUTPUT_BINARY",
};
-static int convert_pyobj(struct srd_decoder_instance *di, PyObject *obj,
+static int convert_pyobj(struct srd_decoder_inst *di, PyObject *obj,
int *ann_format, char ***ann)
{
PyObject *py_tmp;
{
GSList *l;
PyObject *data, *py_res;
- struct srd_decoder_instance *di, *next_di;
+ struct srd_decoder_inst *di, *next_di;
struct srd_pd_output *pdo;
struct srd_proto_data *pdata;
uint64_t start_sample, end_sample;
int output_id;
void (*cb)();
- if (!(di = srd_instance_find_by_obj(NULL, self))) {
+ if (!(di = srd_inst_find_by_obj(NULL, self))) {
/* Shouldn't happen. */
srd_dbg("put(): self instance not found.");
return NULL;
pdo = l->data;
srd_spew("Instance %s put %" PRIu64 "-%" PRIu64 " %s on oid %d.",
- di->instance_id, start_sample, end_sample,
+ di->inst_id, start_sample, end_sample,
OUTPUT_TYPES[pdo->output_type], output_id);
- if (!(pdata = g_try_malloc0(sizeof(struct srd_proto_data))))
+ if (!(pdata = g_try_malloc0(sizeof(struct srd_proto_data)))) {
+ srd_err("Failed to g_malloc() struct srd_proto_data.");
return NULL;
+ }
pdata->start_sample = start_sample;
pdata->end_sample = end_sample;
pdata->pdo = pdo;
for (l = di->next_di; l; l = l->next) {
next_di = l->data;
/* TODO: is this needed? */
- Py_XINCREF(next_di->py_instance);
+ Py_XINCREF(next_di->py_inst);
srd_spew("Sending %d-%d to instance %s",
start_sample, end_sample,
- next_di->instance_id);
+ next_di->inst_id);
if (!(py_res = PyObject_CallMethod(
- next_di->py_instance, "decode", "KKO", start_sample,
+ next_di->py_inst, "decode", "KKO", start_sample,
end_sample, data))) {
catch_exception("calling %s decode(): ",
- next_di->instance_id);
+ next_di->inst_id);
}
Py_XDECREF(py_res);
}
static PyObject *Decoder_add(PyObject *self, PyObject *args)
{
PyObject *ret;
- struct srd_decoder_instance *di;
+ struct srd_decoder_inst *di;
char *proto_id;
int output_type, pdo_id;
- if (!(di = srd_instance_find_by_obj(NULL, self))) {
+ if (!(di = srd_inst_find_by_obj(NULL, self))) {
PyErr_SetString(PyExc_Exception, "decoder instance not found");
return NULL;
}
if (!PyArg_ParseTuple(args, "is", &output_type, &proto_id)) {
- /* Let python raise this exception. */
+ /* Let Python raise this exception. */
return NULL;
}
{NULL, NULL, 0, NULL}
};
-PyTypeObject srd_Decoder_type = {
+SRD_PRIV PyTypeObject srd_Decoder_type = {
PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "sigrokdecode.Decoder",
.tp_basicsize = sizeof(srd_Decoder),