From: Bert Vermeulen Date: Sun, 15 Jan 2012 02:43:01 +0000 (+0100) Subject: move srd_Decoder to sigrokdecode.h, and rename it in line with srd_logic X-Git-Tag: libsigrokdecode-0.1.0~141 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f8e458577f72a5b13fa83b6cd3675a7eefc83072;p=libsigrokdecode.git move srd_Decoder to sigrokdecode.h, and rename it in line with srd_logic --- diff --git a/module_sigrokdecode.c b/module_sigrokdecode.c index 426cf49..a18583b 100644 --- a/module_sigrokdecode.c +++ b/module_sigrokdecode.c @@ -187,23 +187,19 @@ static PyMethodDef Decoder_methods[] = { }; -typedef struct { - PyObject_HEAD -} sigrok_Decoder_object; - -static PyTypeObject srd_Decoder_type = { +PyTypeObject srd_Decoder_type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "sigrokdecode.Decoder", - .tp_basicsize = sizeof(sigrok_Decoder_object), + .tp_basicsize = sizeof(srd_Decoder), .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - .tp_doc = "Sigrok Decoder object", + .tp_doc = "Sigrok Decoder base class", .tp_methods = Decoder_methods, }; static struct PyModuleDef sigrokdecode_module = { PyModuleDef_HEAD_INIT, .m_name = "sigrokdecode", - .m_doc = "sigrokdecode base class", + .m_doc = "sigrokdecode module", .m_size = -1, .m_methods = no_methods, }; diff --git a/sigrokdecode.h b/sigrokdecode.h index 3c69314..71d0ae4 100644 --- a/sigrokdecode.h +++ b/sigrokdecode.h @@ -138,15 +138,6 @@ struct srd_pd_output { char *proto_id; }; -typedef struct { - PyObject_HEAD - struct srd_decoder_instance *di; - unsigned int itercnt; - uint8_t *inbuf; - uint64_t inbuflen; - PyObject *sample; -} srd_logic; - struct srd_proto_data { uint64_t start_sample; uint64_t end_sample; @@ -161,8 +152,22 @@ struct srd_pd_callback { }; -/*--- controller.c ----------------------------------------------------------*/ +/* custom python types */ +typedef struct { + PyObject_HEAD +} srd_Decoder; +typedef struct { + PyObject_HEAD + struct srd_decoder_instance *di; + unsigned int itercnt; + uint8_t *inbuf; + uint64_t inbuflen; + PyObject *sample; +} srd_logic; + + +/*--- controller.c ----------------------------------------------------------*/ int srd_init(void); int srd_exit(void); int set_modulepath(void);