summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Comstedt <marcus@mc.pp.se>2014-07-01 00:07:40 +0200
committerBert Vermeulen <bert@biot.com>2014-07-08 15:42:44 +0200
commitf6c7eade2b8853b3d525b5cc0402e89ca74c1908 (patch)
tree8ca350ca3ca7c09e08f986a92c87bd3cf7ad8a55
parent67ecff568264e0af2cf137af1d0f4edf7a9dcf2e (diff)
downloadlibsigrokdecode-f6c7eade2b8853b3d525b5cc0402e89ca74c1908.tar.gz
libsigrokdecode-f6c7eade2b8853b3d525b5cc0402e89ca74c1908.zip
Remove dependency on Python.h from public API header
This prevents Python.h from being included into client code, where it can mess things up by e.g. redefining _POSIX_C_SOURCE.
-rw-r--r--decoder.c4
-rw-r--r--exception.c4
-rw-r--r--instance.c4
-rw-r--r--libsigrokdecode-internal.h13
-rw-r--r--libsigrokdecode.h20
-rw-r--r--log.c4
-rw-r--r--module_sigrokdecode.c4
-rw-r--r--session.c4
-rw-r--r--srd.c4
-rw-r--r--tests/runtc.c1
-rw-r--r--type_decoder.c4
-rw-r--r--type_logic.c3
-rw-r--r--util.c4
13 files changed, 37 insertions, 36 deletions
diff --git a/decoder.c b/decoder.c
index 3a8c59d..95f3ac5 100644
--- a/decoder.c
+++ b/decoder.c
@@ -19,8 +19,8 @@
*/
#include "config.h"
-#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#include "libsigrokdecode-internal.h"
+#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode.h"
#include <glib.h>
/**
diff --git a/exception.c b/exception.c
index 1ce66a8..9c3fa48 100644
--- a/exception.c
+++ b/exception.c
@@ -17,8 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#include "libsigrokdecode-internal.h"
+#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode.h"
#include "config.h"
#include <stdarg.h>
#include <glib.h>
diff --git a/instance.c b/instance.c
index 8a5ddef..732bbc3 100644
--- a/instance.c
+++ b/instance.c
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#include "libsigrokdecode-internal.h"
+#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode.h"
#include "config.h"
#include <glib.h>
#include <inttypes.h>
diff --git a/libsigrokdecode-internal.h b/libsigrokdecode-internal.h
index f386cd7..7370410 100644
--- a/libsigrokdecode-internal.h
+++ b/libsigrokdecode-internal.h
@@ -22,8 +22,21 @@
#ifndef LIBSIGROKDECODE_LIBSIGROKDECODE_INTERNAL_H
#define LIBSIGROKDECODE_LIBSIGROKDECODE_INTERNAL_H
+#include <Python.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
#include "libsigrokdecode.h"
+/* Custom Python types: */
+
+typedef struct {
+ PyObject_HEAD
+ struct srd_decoder_inst *di;
+ uint64_t start_samplenum;
+ unsigned int itercnt;
+ uint8_t *inbuf;
+ uint64_t inbuflen;
+ PyObject *sample;
+} srd_logic;
+
struct srd_session {
int session_id;
diff --git a/libsigrokdecode.h b/libsigrokdecode.h
index 9d2dbd3..7f75ab2 100644
--- a/libsigrokdecode.h
+++ b/libsigrokdecode.h
@@ -22,7 +22,6 @@
#ifndef LIBSIGROKDECODE_SIGROKDECODE_H
#define LIBSIGROKDECODE_SIGROKDECODE_H
-#include <Python.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
#include <stdint.h>
#include <glib.h>
@@ -184,10 +183,10 @@ struct srd_decoder {
GSList *options;
/** Python module. */
- PyObject *py_mod;
+ void *py_mod;
/** sigrokdecode.Decoder class. */
- PyObject *py_dec;
+ void *py_dec;
};
/**
@@ -221,7 +220,7 @@ struct srd_decoder_annotation_row {
struct srd_decoder_inst {
struct srd_decoder *decoder;
struct srd_session *sess;
- PyObject *py_inst;
+ void *py_inst;
char *inst_id;
GSList *pd_output;
int dec_num_channels;
@@ -267,19 +266,6 @@ struct srd_pd_callback {
void *cb_data;
};
-/* Custom Python types: */
-
-typedef struct {
- PyObject_HEAD
- struct srd_decoder_inst *di;
- uint64_t start_samplenum;
- unsigned int itercnt;
- uint8_t *inbuf;
- uint64_t inbuflen;
- PyObject *sample;
-} srd_logic;
-
-
/* srd.c */
SRD_API int srd_init(const char *path);
SRD_API int srd_exit(void);
diff --git a/log.c b/log.c
index 1723a0e..9d0bc73 100644
--- a/log.c
+++ b/log.c
@@ -18,8 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#include "libsigrokdecode-internal.h"
+#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode.h"
#include <stdarg.h>
#include <stdio.h>
diff --git a/module_sigrokdecode.c b/module_sigrokdecode.c
index d5172d6..7f7e869 100644
--- a/module_sigrokdecode.c
+++ b/module_sigrokdecode.c
@@ -17,8 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#include "libsigrokdecode-internal.h"
+#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode.h"
#include "config.h"
/** @cond PRIVATE */
diff --git a/session.c b/session.c
index 24846c5..6963a23 100644
--- a/session.c
+++ b/session.c
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#include "libsigrokdecode-internal.h"
+#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode.h"
#include "config.h"
#include <inttypes.h>
#include <glib.h>
diff --git a/srd.c b/srd.c
index 599d190..8799de0 100644
--- a/srd.c
+++ b/srd.c
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#include "libsigrokdecode-internal.h"
+#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode.h"
#include "config.h"
#include <glib.h>
diff --git a/tests/runtc.c b/tests/runtc.c
index 9abd112..096ff16 100644
--- a/tests/runtc.c
+++ b/tests/runtc.c
@@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <Python.h>
#include "../libsigrokdecode.h"
#include <libsigrok/libsigrok.h>
#include <stdlib.h>
diff --git a/type_decoder.c b/type_decoder.c
index 11c8ec0..a7b23de 100644
--- a/type_decoder.c
+++ b/type_decoder.c
@@ -17,8 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#include "libsigrokdecode-internal.h"
+#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode.h"
#include "config.h"
#include <inttypes.h>
diff --git a/type_logic.c b/type_logic.c
index 4367680..a33d997 100644
--- a/type_logic.c
+++ b/type_logic.c
@@ -17,7 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode.h"
#include "config.h"
#include <inttypes.h>
#include <string.h>
diff --git a/util.c b/util.c
index 1efaa84..c1b9040 100644
--- a/util.c
+++ b/util.c
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#include "libsigrokdecode-internal.h"
+#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode.h"
#include "config.h"
/**