]> sigrok.org Git - libsigrokdecode.git/commitdiff
srd: Initialise struct members by name. Minor other fixes.
authorGareth McMullin <redacted>
Mon, 5 Dec 2011 07:31:32 +0000 (20:31 +1300)
committerGareth McMullin <redacted>
Mon, 5 Dec 2011 07:31:32 +0000 (20:31 +1300)
Restored some prototypes in sigrokdecode.h.
Abort sigrok-cli on error while decoding (includes KeyboardInterrupt).
Fixed passing metadata to Decoder.start() method.

controller.c
sigrokdecode.h

index db2ed9b4e5091202dff16696962380a0929efc45..31aad0e0bf060770ca69eb7d18fd370f7ce2f0f6 100644 (file)
@@ -86,34 +86,11 @@ typedef struct {
 
 static PyTypeObject sigrok_Decoder_type = {
        PyObject_HEAD_INIT(NULL)
-       0,
-       "sigrok.Decoder",
-       sizeof(sigrok_Decoder_object),
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       "Sigrok Decoder object",
-       0,
-       0,
-       0,
-       0,
-       0,
-       0,
-       Decoder_methods,
+       .tp_name = "sigrok.Decoder",
+       .tp_basicsize = sizeof(sigrok_Decoder_object),
+       .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       .tp_doc = "Sigrok Decoder object",
+       .tp_methods = Decoder_methods,
 };
 
 PyMODINIT_FUNC init_sigrok_Decoder(void)
@@ -293,10 +270,11 @@ int srd_session_start(const char *driver, int unitsize, uint64_t starttime,
        for (d = decoders; d; d = d->next) {
                di = d->data;
                if (!(py_res = PyObject_CallMethod(di->py_instance, "start",
-                                                "{s:s,s:i,s:d}",
-                                                "driver", driver,
-                                                "unitsize", unitsize,
-                                                "starttime", starttime))) {
+                                       "{s:s,s:l,s:l,s:l}",
+                                       "driver", driver,
+                                       "unitsize", (long)unitsize,
+                                       "starttime", (long)starttime,
+                                       "samplerate", (long)samplerate))) {
                        if (PyErr_Occurred())
                                PyErr_Print(); /* Returns void. */
 
index c1ef9ffbb0ebd27baab250b3400e858830bb3da3..5afb90c3280113b63a11172a2a3df113bfe3d7e3 100644 (file)
@@ -109,8 +109,9 @@ int srd_instance_set_probe(struct srd_decoder_instance *di,
                                const char *probename, int num);
 int srd_instance_start(struct srd_decoder_instance *di,
                        const char *driver, int unitsize, uint64_t starttime);
-int srd_run_decoder(struct srd_decoder_instance *dec,
-                   uint8_t *inbuf, uint64_t inbuflen);
+int srd_session_start(const char *driver, int unitsize, uint64_t starttime,
+               uint64_t samplerate);
+int srd_session_feed(uint8_t *inbuf, uint64_t inbuflen);
 
 /* decoder.c */
 GSList *srd_list_decoders(void);