From: Uwe Hermann Date: Tue, 10 Jan 2012 20:05:09 +0000 (+0100) Subject: srd: annotation -> annotations. X-Git-Tag: libsigrokdecode-0.1.0~179 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e97b6ef569f73e387b2597dfa144c01838c0e27c;p=libsigrokdecode.git srd: annotation -> annotations. In the PDs (Python code), the 'annotation' variable/attribute is a list of annotation formats. Use the plural 'annotations' as we do for other lists such as 'inputs', 'outputs', 'probes', 'options', and so on. --- diff --git a/decoder.c b/decoder.c index d626bd3..e25e4e0 100644 --- a/decoder.c +++ b/decoder.c @@ -127,11 +127,11 @@ int srd_load_decoder(const char *name, struct srd_decoder **dec) d->outputformats = NULL; /* Convert class annotation attribute to GSList of **char */ - d->annotation = NULL; - if (PyObject_HasAttrString(py_res, "annotation")) { - py_annlist = PyObject_GetAttrString(py_res, "annotation"); + d->annotations = NULL; + if (PyObject_HasAttrString(py_res, "annotations")) { + py_annlist = PyObject_GetAttrString(py_res, "annotations"); if (!PyList_Check(py_annlist)) { - srd_err("Protocol decoder module %s annotation should be a list", name); + srd_err("Protocol decoder module %s annotations should be a list", name); return SRD_ERR_PYTHON; } alen = PyList_Size(py_annlist); @@ -145,7 +145,7 @@ int srd_load_decoder(const char *name, struct srd_decoder **dec) if (py_strlist_to_char(py_ann, &ann) != SRD_OK) return SRD_ERR_PYTHON; - d->annotation = g_slist_append(d->annotation, ann); + d->annotations = g_slist_append(d->annotations, ann); } } diff --git a/decoders/ddc.py b/decoders/ddc.py index 58c74a4..b4681d0 100644 --- a/decoders/ddc.py +++ b/decoders/ddc.py @@ -37,7 +37,7 @@ class Decoder(sigrokdecode.Decoder): license = 'gplv3+' inputs = ['i2c'] outputs = ['ddc'] - annotation = [ + annotations = [ ["Byte stream", "DDC byte stream as read from display."], ] diff --git a/decoders/i2c.py b/decoders/i2c.py index 60558c5..b101e8a 100644 --- a/decoders/i2c.py +++ b/decoders/i2c.py @@ -137,7 +137,7 @@ class Decoder(sigrokdecode.Decoder): options = { 'address-space': ['Address space (in bits)', 7], } - annotation = [ + annotations = [ # ANN_SHIFTED ["7-bit shifted hex", "Read/Write bit shifted out from the 8-bit i2c slave address"], diff --git a/decoders/pan1321.py b/decoders/pan1321.py index 3c09310..bebfc68 100644 --- a/decoders/pan1321.py +++ b/decoders/pan1321.py @@ -45,7 +45,7 @@ class Decoder(sigrokdecode.Decoder): # ] options = { } - annotation = [ + annotations = [ # ANN_ASCII ["ASCII", "TODO: description"], ] diff --git a/decoders/uart.py b/decoders/uart.py index 1c204dc..c9f7875 100644 --- a/decoders/uart.py +++ b/decoders/uart.py @@ -217,7 +217,7 @@ class Decoder(sigrokdecode.Decoder): # TODO: Options to invert the signal(s). # ... } - annotation = [ + annotations = [ # ANN_ASCII ["ASCII", "TODO: description"], # ANN_DEC diff --git a/module_sigrokdecode.c b/module_sigrokdecode.c index a3872ab..d2ffb07 100644 --- a/module_sigrokdecode.c +++ b/module_sigrokdecode.c @@ -56,7 +56,7 @@ static int convert_pyobj(struct srd_decoder_instance *di, PyObject *obj, } ann_id = PyLong_AsLong(py_tmp); - if (!(pdo = g_slist_nth_data(di->decoder->annotation, ann_id))) { + if (!(pdo = g_slist_nth_data(di->decoder->annotations, ann_id))) { srd_err("Protocol decoder %s submitted data to non-existent annotation format %d", di->decoder->name, ann_id); return SRD_ERR_PYTHON; diff --git a/sigrokdecode.h b/sigrokdecode.h index a4b5c2c..3c69314 100644 --- a/sigrokdecode.h +++ b/sigrokdecode.h @@ -111,7 +111,7 @@ struct srd_decoder { /* List of NULL-terminated char[], containing descriptions of the * supported annotation output. */ - GSList *annotation; + GSList *annotations; /** TODO */ PyObject *py_mod;