]> sigrok.org Git - libsigrokdecode.git/commitdiff
srd: Finish consistency rename to ANN/PROTO.
authorUwe Hermann <redacted>
Tue, 10 Jan 2012 19:44:22 +0000 (20:44 +0100)
committerUwe Hermann <redacted>
Tue, 10 Jan 2012 20:00:14 +0000 (21:00 +0100)
12 files changed:
controller.c
decoders/ddc.py
decoders/i2c.py
decoders/mx25lxx05d.py
decoders/nunchuk.py
decoders/pan1321.py
decoders/spi.py
decoders/srd_usb.py
decoders/transitioncounter.py
decoders/uart.py
module_sigrokdecode.c
sigrokdecode.h

index 20364f7076c8d4eab8c7fdacd8d4c5db8b293d4f..07bf6f23296243e38da5f8de999d941e89155f1d 100644 (file)
@@ -376,7 +376,7 @@ int srd_session_feed(uint64_t timeoffset, uint64_t duration, uint8_t *inbuf,
 
 
 int pd_add(struct srd_decoder_instance *di, int output_type,
 
 
 int pd_add(struct srd_decoder_instance *di, int output_type,
-               char *protocol_id)
+               char *proto_id)
 {
        struct srd_pd_output *pdo;
 
 {
        struct srd_pd_output *pdo;
 
@@ -387,7 +387,7 @@ int pd_add(struct srd_decoder_instance *di, int output_type,
        pdo->pdo_id = g_slist_length(di->pd_output);
        pdo->output_type = output_type;
        pdo->decoder = di->decoder;
        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);
+       pdo->proto_id = g_strdup(proto_id);
        di->pd_output = g_slist_append(di->pd_output, pdo);
 
        return pdo->pdo_id;
        di->pd_output = g_slist_append(di->pd_output, pdo);
 
        return pdo->pdo_id;
index c4978c9f0b4edb044027bbaad51595b0991920a9..58c74a4ad6c8a341546fa2b23d47621ceb6ec42b 100644 (file)
@@ -45,7 +45,7 @@ class Decoder(sigrokdecode.Decoder):
         self.state = None
 
     def start(self, metadata):
         self.state = None
 
     def start(self, metadata):
-        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'ddc')
+        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANN, 'ddc')
 
     def decode(self, start_sample, end_sample, i2c_data):
         try:
 
     def decode(self, start_sample, end_sample, i2c_data):
         try:
index 5e63fdff9b62cb2aaaa4da26f270642730d67f21..60558c5a76eeb34e4b8a08c0ba14a5de997992f2 100644 (file)
@@ -162,8 +162,8 @@ class Decoder(sigrokdecode.Decoder):
         self.oldsda = None
 
     def start(self, metadata):
         self.oldsda = None
 
     def start(self, metadata):
-        self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'i2c')
-        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'i2c')
+        self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTO, 'i2c')
+        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANN, 'i2c')
 
     def report(self):
         pass
 
     def report(self):
         pass
index 7ffbfc1ffdb2b2ee86f4d872b98a901db0f00870..bd1ce16d3007c9f1d389de009d51db23adc671b4 100644 (file)
@@ -179,8 +179,8 @@ class Decoder(sigrokdecode.Decoder):
         self.out = []
 
     def start(self, metadata):
         self.out = []
 
     def start(self, metadata):
-        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'mx25lxx05d')
-        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'mx25lxx05d')
+        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTO, 'mx25lxx05d')
+        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANN, 'mx25lxx05d')
 
     def report(self):
         pass
 
     def report(self):
         pass
index 111768b6f38bdf5b4fd12c7a7290bf07560a46a3..cd2c064b77e1c08a4bc866552b83f2c8a5f9ac04 100644 (file)
@@ -87,8 +87,8 @@ class Decoder(sigrokdecode.Decoder):
         self.databytecount = 0
 
     def start(self, metadata):
         self.databytecount = 0
 
     def start(self, metadata):
-        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'nunchuk')
-        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'nunchuk')
+        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTO, 'nunchuk')
+        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANN, 'nunchuk')
 
     def report(self):
         pass
 
     def report(self):
         pass
index edd4162b993bac51086c79dda6524f2180dd69f3..3c093108b64dd3dbf8e77afe8aa49baee0b696ae 100644 (file)
@@ -56,8 +56,8 @@ class Decoder(sigrokdecode.Decoder):
         self.cmd = ''
 
     def start(self, metadata):
         self.cmd = ''
 
     def start(self, metadata):
-        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'pan1321')
-        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'pan1321')
+        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTO, 'pan1321')
+        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANN, 'pan1321')
 
     def report(self):
         pass
 
     def report(self):
         pass
index 95302ce759ce56d4185b1e36f784bb3ffd0b1830..a866767e71eb2de7455bbd2212495c38ef068cea 100644 (file)
@@ -46,8 +46,8 @@ class Decoder(sigrokdecode.Decoder):
         self.out_ann = None
 
     def start(self, metadata):
         self.out_ann = None
 
     def start(self, metadata):
-        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'spi')
-        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'spi')
+        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTO, 'spi')
+        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANN, 'spi')
 
     def report(self):
         return 'SPI: %d bytes received' % self.bytesreceived
 
     def report(self):
         return 'SPI: %d bytes received' % self.bytesreceived
index c68e82be3b0c606110c7a713f027badb3391359c..c97ef730ea80e9f100cb21ab783740c9600be941 100644 (file)
@@ -123,8 +123,8 @@ class Decoder(sigrokdecode.Decoder):
 
     def start(self, metadata):
         self.rate = metadata['samplerate']
 
     def start(self, metadata):
         self.rate = metadata['samplerate']
-        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'usb')
-        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'usb')
+        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTO, 'usb')
+        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANN, 'usb')
         if self.rate < 48000000:
             raise Exception("Sample rate not sufficient for USB decoding")
         # Initialise decoder state.
         if self.rate < 48000000:
             raise Exception("Sample rate not sufficient for USB decoding")
         # Initialise decoder state.
index 7ad16fd29c8c75d7fa247c8561e1b0b14bee4d4d..9d437d1bfa156e06b51a2b8e7daf297e02779bba 100644 (file)
@@ -42,8 +42,8 @@ class Decoder(sigrokdecode.Decoder):
         self.lastsample = None
 
     def start(self, metadata):
         self.lastsample = None
 
     def start(self, metadata):
-        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'transitioncounter')
-        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'transitioncounter')
+        # self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTO, 'transitioncounter')
+        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANN, 'transitioncounter')
 
     def report(self):
         pass
 
     def report(self):
         pass
index 896cd0a127d2687081b0f4a8e28d5f5f1f16d616..1c204dc053d7b9defccddb43b4883a232e2ad64d 100644 (file)
@@ -258,8 +258,8 @@ class Decoder(sigrokdecode.Decoder):
 
     def start(self, metadata):
         self.samplerate = metadata['samplerate']
 
     def start(self, metadata):
         self.samplerate = metadata['samplerate']
-        self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'uart')
-        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'uart')
+        self.out_proto = self.add(sigrokdecode.SRD_OUTPUT_PROTO, 'uart')
+        self.out_ann = self.add(sigrokdecode.SRD_OUTPUT_ANN, 'uart')
 
         # TODO
         ### self.baudrate = metadata['baudrate']
 
         # TODO
         ### self.baudrate = metadata['baudrate']
index 6b636ad466c01638584a156f104da931e6d128f8..a3872ab53a260d92efa65fdff17e8cb25a44df69 100644 (file)
@@ -26,7 +26,7 @@ extern PyTypeObject srd_logic_type;
 
 
 static int convert_pyobj(struct srd_decoder_instance *di, PyObject *obj,
 
 
 static int convert_pyobj(struct srd_decoder_instance *di, PyObject *obj,
-               int *annotation_format, char ***annotation)
+               int *ann_format, char ***ann)
 {
        PyObject *py_tmp;
        struct srd_pd_output *pdo;
 {
        PyObject *py_tmp;
        struct srd_pd_output *pdo;
@@ -61,7 +61,7 @@ static int convert_pyobj(struct srd_decoder_instance *di, PyObject *obj,
                                di->decoder->name, ann_id);
                return SRD_ERR_PYTHON;
        }
                                di->decoder->name, ann_id);
                return SRD_ERR_PYTHON;
        }
-       *annotation_format = ann_id;
+       *ann_format = ann_id;
 
        /* Second element must be a list */
        py_tmp = PyList_GetItem(obj, 1);
 
        /* Second element must be a list */
        py_tmp = PyList_GetItem(obj, 1);
@@ -70,7 +70,7 @@ static int convert_pyobj(struct srd_decoder_instance *di, PyObject *obj,
                                di->decoder->name);
                return SRD_ERR_PYTHON;
        }
                                di->decoder->name);
                return SRD_ERR_PYTHON;
        }
-       if (py_strlist_to_char(py_tmp, annotation) != SRD_OK) {
+       if (py_strlist_to_char(py_tmp, ann) != SRD_OK) {
                srd_err("Protocol decoder %s submitted annotation list, but second element was malformed",
                                di->decoder->name);
                return SRD_ERR_PYTHON;
                srd_err("Protocol decoder %s submitted annotation list, but second element was malformed",
                                di->decoder->name);
                return SRD_ERR_PYTHON;
@@ -85,7 +85,7 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args)
        PyObject *data, *py_res;
        struct srd_decoder_instance *di, *next_di;
        struct srd_pd_output *pdo;
        PyObject *data, *py_res;
        struct srd_decoder_instance *di, *next_di;
        struct srd_pd_output *pdo;
-       struct srd_protocol_data *pdata;
+       struct srd_proto_data *pdata;
        uint64_t start_sample, end_sample;
        int output_id;
        void (*cb)();
        uint64_t start_sample, end_sample;
        int output_id;
        void (*cb)();
@@ -103,18 +103,18 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args)
        }
        pdo = l->data;
 
        }
        pdo = l->data;
 
-       if (!(pdata = g_try_malloc0(sizeof(struct srd_protocol_data))))
+       if (!(pdata = g_try_malloc0(sizeof(struct srd_proto_data))))
                return NULL;
        pdata->start_sample = start_sample;
        pdata->end_sample = end_sample;
        pdata->pdo = pdo;
 
        switch (pdo->output_type) {
                return NULL;
        pdata->start_sample = start_sample;
        pdata->end_sample = end_sample;
        pdata->pdo = pdo;
 
        switch (pdo->output_type) {
-       case SRD_OUTPUT_ANNOTATION:
+       case SRD_OUTPUT_ANN:
                /* Annotations are only fed to callbacks. */
                if ((cb = srd_find_callback(pdo->output_type))) {
                        /* Annotations need converting from PyObject. */
                /* Annotations are only fed to callbacks. */
                if ((cb = srd_find_callback(pdo->output_type))) {
                        /* Annotations need converting from PyObject. */
-                       if (convert_pyobj(di, data, &pdata->annotation_format,
+                       if (convert_pyobj(di, data, &pdata->ann_format,
                                        (char ***)&pdata->data) != SRD_OK) {
                                /* An error was already logged. */
                                break;
                                        (char ***)&pdata->data) != SRD_OK) {
                                /* An error was already logged. */
                                break;
@@ -122,7 +122,7 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args)
                        cb(pdata);
                }
                break;
                        cb(pdata);
                }
                break;
-       case SRD_OUTPUT_PROTOCOL:
+       case SRD_OUTPUT_PROTO:
                for (l = di->next_di; l; l = l->next) {
                        next_di = l->data;
                        /* TODO: is this needed? */
                for (l = di->next_di; l; l = l->next) {
                        next_di = l->data;
                        /* TODO: is this needed? */
@@ -154,7 +154,7 @@ static PyObject *Decoder_add(PyObject *self, PyObject *args)
 {
        PyObject *ret;
        struct srd_decoder_instance *di;
 {
        PyObject *ret;
        struct srd_decoder_instance *di;
-       char *protocol_id;
+       char *proto_id;
        int output_type, pdo_id;
 
        if (!(di = get_di_by_decobject(self))) {
        int output_type, pdo_id;
 
        if (!(di = get_di_by_decobject(self))) {
@@ -163,13 +163,13 @@ static PyObject *Decoder_add(PyObject *self, PyObject *args)
                return NULL;
        }
 
                return NULL;
        }
 
-       if (!PyArg_ParseTuple(args, "is", &output_type, &protocol_id)) {
+       if (!PyArg_ParseTuple(args, "is", &output_type, &proto_id)) {
                if (PyErr_Occurred())
                        PyErr_Print();
                return NULL;
        }
 
                if (PyErr_Occurred())
                        PyErr_Print();
                return NULL;
        }
 
-       pdo_id = pd_add(di, output_type, protocol_id);
+       pdo_id = pd_add(di, output_type, proto_id);
        if (pdo_id < 0)
                Py_RETURN_NONE;
        else
        if (pdo_id < 0)
                Py_RETURN_NONE;
        else
@@ -230,11 +230,11 @@ PyMODINIT_FUNC PyInit_sigrokdecode(void)
                return NULL;
 
        /* expose output types as symbols in the sigrokdecode module */
                return NULL;
 
        /* expose output types as symbols in the sigrokdecode module */
-       if(PyModule_AddObject(mod, "SRD_OUTPUT_ANNOTATION",
-                       PyLong_FromLong(SRD_OUTPUT_ANNOTATION)) == -1)
+       if(PyModule_AddObject(mod, "SRD_OUTPUT_ANN",
+                       PyLong_FromLong(SRD_OUTPUT_ANN)) == -1)
                return NULL;
                return NULL;
-       if(PyModule_AddObject(mod, "SRD_OUTPUT_PROTOCOL",
-                       PyLong_FromLong(SRD_OUTPUT_PROTOCOL)) == -1)
+       if(PyModule_AddObject(mod, "SRD_OUTPUT_PROTO",
+                       PyLong_FromLong(SRD_OUTPUT_PROTO)) == -1)
                return NULL;
        if(PyModule_AddObject(mod, "SRD_OUTPUT_BINARY",
                        PyLong_FromLong(SRD_OUTPUT_BINARY)) == -1)
                return NULL;
        if(PyModule_AddObject(mod, "SRD_OUTPUT_BINARY",
                        PyLong_FromLong(SRD_OUTPUT_BINARY)) == -1)
index cf52264493052b5600aaa16719f28dfac13f3a44..a4b5c2cd43b0a6b4aafec72a6a2748e518c94501 100644 (file)
@@ -64,8 +64,8 @@ extern "C" {
 #define SRD_LOG_SPEW   5 /**< Output very noisy debug messages. */
 
 enum {
 #define SRD_LOG_SPEW   5 /**< Output very noisy debug messages. */
 
 enum {
-       SRD_OUTPUT_ANNOTATION,
-       SRD_OUTPUT_PROTOCOL,
+       SRD_OUTPUT_ANN,
+       SRD_OUTPUT_PROTO,
        SRD_OUTPUT_BINARY,
        /* When adding an output type, don't forget to expose it to PDs in:
         *     controller.c:PyInit_sigrokdecode()
        SRD_OUTPUT_BINARY,
        /* When adding an output type, don't forget to expose it to PDs in:
         *     controller.c:PyInit_sigrokdecode()
@@ -135,7 +135,7 @@ struct srd_pd_output {
        int pdo_id;
        int output_type;
        struct srd_decoder *decoder;
        int pdo_id;
        int output_type;
        struct srd_decoder *decoder;
-       char *protocol_id;
+       char *proto_id;
 };
 
 typedef struct {
 };
 
 typedef struct {
@@ -147,17 +147,17 @@ typedef struct {
        PyObject *sample;
 } srd_logic;
 
        PyObject *sample;
 } srd_logic;
 
-struct srd_protocol_data {
+struct srd_proto_data {
        uint64_t start_sample;
        uint64_t end_sample;
        struct srd_pd_output *pdo;
        uint64_t start_sample;
        uint64_t end_sample;
        struct srd_pd_output *pdo;
-       int annotation_format;
+       int ann_format;
        void *data;
 };
 
 struct srd_pd_callback {
        int output_type;
        void *data;
 };
 
 struct srd_pd_callback {
        int output_type;
-       void (*callback)(struct srd_protocol_data *);
+       void (*callback)(struct srd_proto_data *);
 };
 
 
 };