struct srd_decoder_instance *di;
PyObject *py_args;
- fprintf(stdout, "%s: %s\n", __func__, id);
-
if (!(dec = srd_get_decoder_by_id(id)))
return NULL;
GSList *d;
struct srd_decoder_instance *di;
- fprintf(stdout, "%s\n", __func__);
-
for (d = di_list; d; d = d->next) {
di = d->data;
di->num_probes = num_probes;
GSList *d;
int ret;
-// fprintf(stdout, "%s: %d bytes\n", __func__, inbuflen);
-
for (d = di_list; d; d = d->next) {
if ((ret = srd_run_decoder(timeoffset, duration, d->data, inbuf,
inbuflen)) != SRD_OK)
if (!(pdo = g_try_malloc(sizeof(struct srd_pd_output))))
return -1;
- /* pdo_id is just a simple index, nothing is deleted from this list anway */
+ /* pdo_id is just a simple index, nothing is deleted from this list anyway. */
pdo->pdo_id = g_slist_length(di->pd_output);
pdo->output_type = output_type;
pdo->decoder = di->decoder;
pdo->protocol_id = g_strdup(protocol_id);
di->pd_output = g_slist_append(di->pd_output, pdo);
- fprintf(stdout, "%s: output type %d, protocol_id %s, id %d\n",
- __func__, output_type, protocol_id, pdo->pdo_id);
-
return pdo->pdo_id;
}
pd_cb->callback = cb;
callbacks = g_slist_append(callbacks, pd_cb);
- printf("got cb for %d: %p\n", output_type, cb);
return SRD_OK;
}
int alen, r, i;
char **ann;
- fprintf(stdout, "%s: %s\n", __func__, name);
-
/* "Import" the Python module. */
if (!(py_mod = PyImport_ImportModule(name))) { /* NEWREF */
PyErr_Print(); /* Returns void. */
if (PyErr_Occurred())
PyErr_Print(); /* Returns void. */
Py_XDECREF(py_mod);
- fprintf(stderr, "Decoder class not found in PD module %s\n", name);
+ srd_err("Decoder class not found in PD module %s", name);
return SRD_ERR_PYTHON; /* TODO: More specific error? */
}
if ((r = h_str(py_res, "author", &(d->author))) < 0)
return r;
- if ((r = h_str(py_res, "email", &(d->email))) < 0)
- return r;
-
if ((r = h_str(py_res, "license", &(d->license))) < 0)
return r;
{
g_free(dec->id);
g_free(dec->name);
+ g_free(dec->longname);
g_free(dec->desc);
+ g_free(dec->longdesc);
+ g_free(dec->author);
+ g_free(dec->license);
g_free(dec->func);
/* TODO: Free everything in inputformats and outputformats. */
return SRD_OK;
}
-/* TODO: not used, doesn't work actually */
-static PyObject *Decoder_init(PyObject *self, PyObject *args)
-{
- (void)self;
- (void)args;
- printf("init Decoder object %p\n", self);
-
- Py_RETURN_NONE;
-}
-
static PyObject *Decoder_put(PyObject *self, PyObject *args)
{
GSList *l;
if (!(di = get_di_by_decobject(self)))
return NULL;
- printf("output_new di %s\n", di->decoder->name);
-
if (!PyArg_ParseTuple(args, "is", &output_type, &protocol_id))
return NULL;
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
.tp_doc = "Sigrok Decoder object",
.tp_methods = Decoder_methods,
- .tp_init = (initproc) Decoder_init,
};
static struct PyModuleDef sigrokdecode_module = {
/** The author of the decoder. May be NULL. */
char *author;
- /** An email address of the decoder's author. May be NULL. */
- char *email;
-
/** The license of the decoder. Valid values: "gplv2+", "gplv3+". */
char *license;