Commit Graph

91 Commits

Author SHA1 Message Date
Uwe Hermann 6b21d9a77e Rename sigrok-logo-notext.png to libsigrok_112x112.png.
This is more specific and prevents any potential issues e.g. when
multiple distro packages might ship with a generic file like
sigrok-logo-notext.png that's supposed to be installed in the same place.
2017-06-11 23:03:09 +02:00
Uwe Hermann efde67a107 Doxyfile*: Set GENERATE_TODOLIST to NO.
We don't really need or use this. Bugs/issues should go into Bugzilla.
2016-09-26 17:19:24 +02:00
Martin Ling c61e208d26 python: Provide sensible __str__ and __repr__ functions for enum values.
This fixes bug #668.
2016-01-04 20:49:35 +01:00
Martin Ling ae2cdde4d2 python: Fix string conversions for Python 3.
Fixes bug #478.
2015-11-02 18:35:18 +01:00
Daniel Elstner 8ebf1469a9 build: Use common SWIG defines for Python and Java
Make the Python and Java bindings use the same set of preprocessor
macros for the SWIG parsing stage, taken from a make variable. Add
G_GNUC_{BEGIN,END}_IGNORE_DEPRECATIONS to that set.
2015-10-30 12:51:16 +01:00
Martin Ling df979d6dc6 python: Give all enum values __doc__ strings. 2015-10-26 07:17:01 +01:00
Martin Ling ef9643a2bb python: Add docstrings for enum constants. 2015-10-26 07:17:01 +01:00
Daniel Elstner 4c9208a799 SWIG: Hack around SWIG segfault on private destructors
Apparently this problem has been fixed in SWIG 3.0.6. However,
until we can require that version, define "private" as "protected"
when running the SWIG parser.
2015-10-26 06:45:56 +01:00
Daniel Elstner c6e18e007a SWIG: Define "noexcept" empty to work around SWIG bug
The SWIG 2.0.12 on my system bails out with a syntax error on the
"noexcept" keyword in C++11 code. Define "noexcept" to nothing (for
the SWIG parser only) to work around this problem.
2015-10-26 06:45:56 +01:00
Martin Ling c7855def61 SWIG: Declare template specialisations for containers before typemaps.
It seems this is necessary to correctly apply typemaps involving
these template specialisations.
2015-10-24 22:12:41 +02:00
Uwe Hermann dd13d47a9e bindings: Use SR_DF_ANALOG, drop SR_DF_ANALOG_OLD support.
All SR_DF_ANALOG_OLD packets are automatically converted to SR_DF_ANALOG
in the session already.
2015-10-21 00:29:29 +02:00
Uwe Hermann 5faebab290 SR_DF_ANALOG_OLD and sr_datafeed_analog_old renames.
Rename SR_DF_ANALOG to SR_DF_ANALOG_OLD, and 'struct sr_datafeed_analog'
to 'struct sr_datafeed_analog_old'.
2015-10-20 23:32:45 +02:00
Martin Ling e66728886f python: Prevent warning about deprecated NumPy API.
Without this we get:

/usr/include/python2.7/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning
"Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API
NPY_1_7_API_VERSION" [-Wcpp]

As far as I'm aware we're not using any deprecated NumPy C API features.

This fixes part of bug #417.
2015-10-20 21:12:29 +01:00
Daniel Elstner fa72105fe6 python: Fix PyObject_CallMethod() arguments
Pass nullptr instead of the empty string for format, and remove
the excess varargs argument. Also, avoid NULL in favor of nullptr.
2015-10-17 17:40:42 +02:00
Daniel Elstner 2c3c9b999c python: Wrap session stop callback 2015-10-17 17:40:42 +02:00
Daniel Elstner ee9953ef12 session: Make event source injection API private
Also remove the corresponding functionality from the bindings.
2015-10-17 17:40:42 +02:00
Uwe Hermann a2e4d88205 python: Fix the build for Python >= 3.
SWIG_init() returns void for Python 2.x and 'PyObject *' for Python 3.

Use an #if to handle both cases properly, otherwise the Python bindings
for either Python 2 or 3 will fail to build.

Python 3.x failure:

sigrok/core/classes_wrap.cpp: In function ‘PyObject* PyInit__classes()’:
sigrok/core/classes_wrap.cpp:59002:5: error: return-statement with no
value, in function returning ‘PyObject* {aka _object*}’ [-fpermissive]
     return;
     ^

Python 2.x failure:

In file included from /usr/include/dirent.h:244:0,
                 from /usr/include/glib-2.0/glib/gdir.h:32,
                 from /usr/include/glib-2.0/glib.h:45,
                 from /usr/include/pygobject-3.0/pygobject.h:7,
                 from sigrok/core/classes_wrap.cpp:3179:
sigrok/core/classes_wrap.cpp: In function ‘void init_classes()’:
sigrok/core/classes_wrap.cpp:59002:12: error: return-statement with a
value, in function returning 'void' [-fpermissive]
     return NULL;
            ^
2015-08-31 21:08:08 +02:00
Daniel Elstner c05a0ba528 Build: Pass compiler flags from make to setup.py
Extend setup.py to allow environment variables to be set on the
command line. Use that functionality to replace the pkg-config
invocations with flags passed on from make. Suppress the annoying
-Wstrict-prototypes warning by overriding the OPT variable.

Also move the "cd bindings/python" from Makefile.am to setup.py
to side-step problems with "cd" in make rules.

This also fixes bug #628.
2015-08-29 17:08:34 +02:00
Daniel Elstner 5a3e34285d setup.py: Do VPATH search for swig/enums.i
Also, in swig/classes.i include swig/enums.i rather than plain
enums.i, to guard against future name clashes.
2015-08-16 18:28:13 +02:00
Alexandru Gagniuc aae2273b99 bindings/python: Handle import failures without crashing
When the import of gi.repository.GLib failed, we would get a NULL
pointer that we passed along without any checking. In this situation,
the entire program would crash with a segmentation fault, and no
message to indicate the problem.

When the import fails, abort the SWIG init and print a message. The
Python interpreter then prints out a backtrace, which can be useful
in tracking down the problem.
2015-06-16 13:04:24 +02:00
Alexandru Gagniuc 682fb08c88 python: classes.i: Declare strings with std::string
This makes it consistent with the rest of the string declarations in
this file, all of which use std::string.
2015-04-30 16:21:21 -07:00
Uwe Hermann 161dc24d84 cxx: Rename include/libsigrok/ to include/libsigrokcxx/. 2015-01-17 20:26:14 +01:00
Uwe Hermann 1b40fdb881 Rename libsigrok.hpp to libsigrokcxx.hpp.
This avoids confusion of libsigrok.h vs. libsigrok.hpp and makes it
clearer that this is the main libsigrokcxx header.
2015-01-17 20:15:38 +01:00
Uwe Hermann 52ff4f6a04 Rename libsigrokxx to the more common libsigrokcxx. 2015-01-17 18:52:43 +01:00
Jiří Pinkava cd5623ca86 fix numpy include path 2014-12-29 23:34:42 +01:00
Uwe Hermann 5fcc5909cc python: Silence some warnings via -Wno-uninitialized.
Silence some warnings when building the Python bindings:

  sigrok/core/classes_wrap.cpp: In function ‘PyObject* _wrap_new_OutputFormatMap(PyObject*, PyObject*)’:
  sigrok/core/classes_wrap.cpp:5232:4: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
      ^
  sigrok/core/classes_wrap.cpp:14383:13: note: ‘argv[0]’ was declared here
     PyObject *argv[2];
               ^
  sigrok/core/classes_wrap.cpp: In function ‘PyObject* _wrap_new_ChannelGroupMap(PyObject*, PyObject*)’:
  sigrok/core/classes_wrap.cpp:5232:4: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
      ^
  sigrok/core/classes_wrap.cpp:23356:13: note: ‘argv[0]’ was declared here
     PyObject *argv[2];
               ^

We add -Wno-uninitialized since the warnings are harmless and we really
don't care about them in the generated classes_wrap.cpp.

This fixes parts of #417.
2014-11-22 22:06:02 +01:00
Martin Ling ed6b4c4747 python: Wrap Analog::data() as a NumPy array. 2014-11-12 02:27:05 +01:00
Martin Ling ea22dc108b python: Return correct PacketPayload subclasses from Packet.payload() 2014-11-12 02:27:05 +01:00
Martin Ling 75fb30365e python: Fix error handling for callbacks. 2014-11-12 02:27:05 +01:00
Martin Ling f0c0dab5a9 python: Implement equality checks for EnumValue derived classes.
Fixes bug #443.
2014-11-12 02:27:05 +01:00
Martin Ling 7a36ceacb9 bindings: Support per-language extensions to EnumValue wrappers. 2014-11-12 02:27:05 +01:00
Martin Ling 444d6a3975 python: Fix mapping of vector & map attributes to Python types.
Fixes bug #382.
2014-11-12 02:27:05 +01:00
Martin Ling 062430a2fb bindings: Use new %attributevector and %attributemap macros. 2014-11-12 02:27:05 +01:00
Martin Ling 0bc1a7613a bindings: Rename ConfigKey::get(string) to get_by_identifier().
The polymorphism with get(int) causes problems here when a char * is passed.
2014-11-12 02:27:04 +01:00
Martin Ling 9d229ecb9e cxx: Implement more of EnumValue in template. 2014-11-12 02:27:04 +01:00
Martin Ling f90ed2d1af python: fix conversion to string variants. 2014-09-14 04:53:06 +01:00
Martin Ling 3b16108573 bindings: Remove 'get_' prefix from all accessors. 2014-09-11 21:27:32 +01:00
Martin Ling ca3291e3ee Update bindings for new input API. 2014-08-26 01:55:41 +02:00
Marcus Comstedt 0e1a7fe91a Makefile.am: Fix out-of-tree build for Python bindings 2014-08-17 16:05:46 +02:00
Uwe Hermann ac0db24ad4 Doxygen: Silence Doxygen warnings by default.
This allows for a clean build per default. Developers can enable
those switches while writing documentation to get a few useful
warnings.
2014-08-10 18:16:07 +02:00
Martin Ling 6a8c1d6879 python: Add documentation generation. 2014-08-10 15:47:13 +02:00
Martin Ling bd4fda2407 bindings: Transfer C++ documentation strings to Python and Java wrappers. 2014-08-10 15:47:13 +02:00
Martin Ling 58aa1f8359 Update bindings to use new output API. 2014-07-26 16:03:25 +01:00
Bert Vermeulen 9ae3eb121f python: Don't install as a zip file. 2014-07-19 22:25:39 +02:00
Martin Ling abc7146d03 Fix building Python bindings with pygobject >= 3.7.91. 2014-07-19 16:12:34 +02:00
Martin Ling f0f1d90d9c Remove obsolete low-level language bindings. 2014-07-18 21:34:57 +01:00
Martin Ling f774095496 Reimplement high-level Python bindings on top of SWIG/C++ bindings. 2014-07-18 20:47:10 +01:00
Martin Ling 5a7e62211c SWIG: Rename libsigrok.i to lowlevel.i. 2014-07-17 18:30:49 +01:00
Uwe Hermann 3f239f0803 Rename various *PROBE* macros to *CHANNEL*.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00
Uwe Hermann 91aea754aa Rename 'struct sr_probe' to 'struct sr_channel' everywhere.
This fixes parts of bug #259.
2014-03-25 20:58:54 +01:00