]> sigrok.org Git - libsigrokdecode.git/blobdiff - module_sigrokdecode.c
code cleanup
[libsigrokdecode.git] / module_sigrokdecode.c
index e92c9e75b5c7a6613b6cda04986e2b729958cae3..720bfd3a99975f316c829f74fd9c9760e6fbe261 100644 (file)
@@ -79,16 +79,6 @@ static int convert_pyobj(struct srd_decoder_instance *di, PyObject *obj,
        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;
@@ -148,7 +138,7 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args)
 }
 
 
-static PyObject *Decoder_output_new(PyObject *self, PyObject *args)
+static PyObject *Decoder_add(PyObject *self, PyObject *args)
 {
        PyObject *ret;
        struct srd_decoder_instance *di;
@@ -158,12 +148,10 @@ static PyObject *Decoder_output_new(PyObject *self, PyObject *args)
        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;
 
-       pdo_id = pd_output_new(di, output_type, protocol_id);
+       pdo_id = pd_add(di, output_type, protocol_id);
        if (pdo_id < 0)
                Py_RETURN_NONE;
        else
@@ -176,8 +164,7 @@ static PyMethodDef no_methods[] = { {NULL, NULL, 0, NULL} };
 static PyMethodDef Decoder_methods[] = {
        {"put", Decoder_put, METH_VARARGS,
         "Accepts a dictionary with the following keys: time, duration, data"},
-       {"output_new", Decoder_output_new, METH_VARARGS,
-        "Create a new output stream"},
+       {"add", Decoder_add, METH_VARARGS, "Create a new output stream"},
        {NULL, NULL, 0, NULL}
 };
 
@@ -193,7 +180,6 @@ static PyTypeObject srd_Decoder_type = {
        .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 = {