Commit Graph

293 Commits

Author SHA1 Message Date
Soeren Apel 004fd9ffd3 Amend #119 to use vector instead of tuple
This way, we don't need to bump glibmm to 2.54, which we otherwise would
2021-03-28 23:17:17 +02:00
Richard Allen a2916ad017 python bindings: Support passing in rational voltages for config_set 2021-02-21 22:21:17 +01:00
Anatol Pomozov 2e199405e5 bindings/ruby: Fix ruby SWIG bindings generation
bindings/swig/doc.py generates a swig interface file for ruby bindings
that includes docstrings with comments braces ( /* and */ ) like this:

  %feature("docstring") sigrok::Channel::type "/* Type of this channel. */\n";
  %feature("docstring") sigrok::Channel::enabled "/* Enabled status of this channel. */\n";

SWIG generates *.cxx and adds its own braces to the docstring:

/*/* Document-class: Sigrok::Error
Exception thrown when an error code is returned by any libsigrok call. */
*/

this causes compilation error for Ruby bindings.

To fix the error we should not add extra braces to the docstring.
With this patch libsigrok compiles fine with with ruby 2.7 and swig 4.0.2.

Fixes bug #1526

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
2020-06-20 18:09:27 +02:00
Juan M. Bello-Rivas 5652085a4e bindings/cxx: Include missing header file
Including the `functional` header is necessary in order to use `std::function` in the definition of `LogCallbackFunction` when compiling with gcc 7.3.0.
2020-04-04 22:24:21 +02:00
Uwe Hermann e803574173 bindings/java: Fix build issue with SWIG 4.x.
Tested with SWIG 3.x and SWIG 4.x.

This fixes bug #1527.
2020-04-04 22:24:05 +02:00
Uwe Hermann deaaebb28d bindings/python/Doxyfile: Set OPTIMIZE_OUTPUT_JAVA to NO. 2020-03-25 19:38:48 +01:00
Uwe Hermann e2bd01f4a7 All Doxyfile files: Update file template to doxygen 1.8.16.
This is done semi-automatically by running "doxygen -u Doxyfile".
2020-03-24 21:15:15 +01:00
Uwe Hermann d7357ebbb6 All Doxyfile files: Set CREATE_SUBDIRS to NO. 2020-03-24 21:15:15 +01:00
Martin Ling 8491cf7cad python: Apply typemap for VariantBase to VariantContainerBase.
Fixes #1480.
2020-01-05 18:25:13 +00:00
Daniel Anselmi 6c6dd7328a bindings: Avoid "using namespace" in headers.
This fixes bug #1354.
2019-06-30 19:38:56 +02:00
Uwe Hermann 3535a6eeee Fix an issue when building in directories that are symlinks.
Explicitly use SRCDIR and BUILDDIR in Doxyfile files to reference input
files. This seems to be a sufficient fix for an issue where the build
would fail when libsigrok/ was located in a directory that was a symlink.

This fixes bug #547.
2019-05-01 17:58:06 +02:00
Martin Ling ea7a83a437 bindings: Add Output::format() 2018-12-30 14:10:13 +01:00
Martin Ling a9ed2eb069 bindings: Add new Context::create_end_packet() method. 2018-12-28 12:47:59 +01:00
Martin Ling 62bd644f55 python: Add override for Context.create_logic_packet() 2018-12-28 12:47:59 +01:00
Sven Bursch-Osewold 4905215909 Python-Binding: Added data array for logic packet payload 2018-11-10 23:20:16 +01:00
Jon Burgess 3940abcb47 Free list returned by sr_session_dev_list()
==214948== 16 bytes in 1 blocks are definitely lost in loss record 161 of 6,440
==214948==    at 0x4C2EE0B: malloc (vg_replace_malloc.c:299)
==214948==    by 0x650F435: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x6527056: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x65284B0: g_slist_copy_deep (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x592BBA6: sr_session_dev_list (session.c:402)
==214948==    by 0x56EF7B5: sigrok::Session::Session(std::shared_ptr<sigrok::Context>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (classes.cpp:932)

==214948== 16 bytes in 1 blocks are definitely lost in loss record 162 of 6,440
==214948==    at 0x4C2EE0B: malloc (vg_replace_malloc.c:299)
==214948==    by 0x650F435: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x6527056: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x65284B0: g_slist_copy_deep (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x592BBA6: sr_session_dev_list (session.c:402)
==214948==    by 0x56F1EB1: sigrok::Session::devices() (classes.cpp:967)
2018-10-22 00:02:40 +02:00
Uwe Hermann 0875f11de4 Fix multiple C++ bindings warnings with gcc 8.
bindings/cxx/classes.cpp: In function ‘int sigrok::call_log_callback(void*, int, const char*, __va_list_tag*)’:
  bindings/cxx/classes.cpp:242:17: warning: catching polymorphic type ‘class sigrok::Error’ by value [-Wcatch-value=]
    } catch (Error e) {
                   ^
  In file included from bindings/cxx/classes.cpp:1667:
  bindings/cxx/enums.cpp: In static member function ‘static Glib::VariantBase sigrok::ConfigKey::parse_string(std::__cxx11::string, sr_datatype)’:
  bindings/cxx/enums.cpp:789:13: warning: catching polymorphic type ‘class std::invalid_argument’ by value [-Wcatch-value=]
      } catch (invalid_argument) {
               ^~~~~~~~~~~~~~~~
  bindings/cxx/enums.cpp:804:13: warning: catching polymorphic type ‘class std::invalid_argument’ by value [-Wcatch-value=]
      } catch (invalid_argument) {
               ^~~~~~~~~~~~~~~~
2018-07-22 17:08:44 +02:00
Gerhard Sittig 092843eb42 bindings: wrap sr_input_scan_file() in the C++ language binding
Allow C++ applications to have the input format automatically detected,
and get a corresponding InputFormat instance. This makes the format match
logic available to PulseView.
2018-05-17 22:31:27 +02:00
Gerhard Sittig 90cc52260c bindings/ruby: include config.h before any other header file 2018-02-21 11:19:17 +01:00
Gerhard Sittig 21964348bc bindings/python: include config.h before any other header file 2018-02-21 11:19:17 +01:00
Gerhard Sittig 1e95832b3e bindings/cxx: include config.h as early as possible
Move the inclusion of <config.h> before any other source code.
2018-02-21 11:19:17 +01:00
Frank Stettner 79034d4f39 strutil: Locale independent snprintf() and vsnprintf() functions 2018-02-11 23:15:39 +01:00
Soeren Apel 6ad2fbaad2 Introduce A2L methods
The memory allocation for sr_datafeed_logic is broken, the memory
will never be freed. #994 is used to handle this issue.
2017-07-06 00:16:24 +02:00
Soeren Apel 895cbcdd3c Bindings: constify data pointer 2017-07-06 00:07:30 +02:00
Uwe Hermann b605edf38f Revert "C++: Avoid std::map::emplace() for GCC 4.7 compatibility"
This reverts commit 8c52989811.

We now require g++ >= 4.8.1 which supports std::map::emplace(), as does
clang >= 3.3.
2017-07-03 11:20:26 +02:00
Gerhard Sittig e7eb29685c C++ binding: Nits, style cleanup (braces, whitespace) 2017-06-25 20:42:21 +02:00
Gerhard Sittig 61a6d983bd C++ binding: Allow to re-use ConfigKey::parse_string() for Option class
Split the data type detection from the actual data type conversion in
the ConfigKey::parse_string() method. Allow the Option class to re-use
the public ConfigKey method, to share the maximum amount of data type
conversion code for both Driver and InputFormat option specs.

This is the least intrusive yet most reliable and consistent approach in
the libsigrok C++ binding that allows applications to support driver scan
and input file format options from command line arguments.
2017-06-25 20:42:21 +02:00
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 6324805018 ruby bindings: Fix a compiler warning.
bindings/ruby/classes_wrap.cpp:10481:1: warning: control may reach end
  of non-void function [-Wreturn-type]
2017-06-09 23:54:41 +02:00
Uwe Hermann 35334baa90 Fix various -Wundefined-var-template clang warnings.
This fixes bug #915.
2017-06-09 23:50:44 +02:00
Gerhard Sittig e3e1f20c7f C++ binding: Fixup memory leak in input module receive() calls
The Input::send() method allocated glib strings and copied input data,
but only released the glib string container and leaked the actual string
content. This led to leaks in the size of the verbatim input file, which
is especially wasteful for uncompressed textual representations.

This fixes bug #976.
2017-06-09 23:21:03 +02:00
Uwe Hermann 176d785d33 Drop trailing whitespace in various files. 2017-06-06 14:10:02 +02:00
Soeren Apel c5d081f721 Bindings: Provide helper method that auto-converts analog 2017-05-27 22:37:28 +02:00
Soeren Apel 0cee3a3ea5 Bindings: Flesh out the analog payload bindings 2017-05-27 22:37:28 +02:00
Marcus Comstedt e83a8f4958 Java: Use correct JNI function when calling Vector.add 2016-12-06 21:04:05 +01:00
Marcus Comstedt f504779c12 Bindings: Make Ruby bindings build with Ruby 2.0
The alias "rb_ary_new_from_args" for "rb_ary_new3" was not introduced
until in Ruby 2.1.
2016-12-05 01:10:37 +01: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
Soeren Apel b6b4f03e40 Input: Add reset() function 2016-05-09 13:02:29 +02:00
Soeren Apel 0221cbdde3 Bindings: Check for empty opts also in Configurable::config_keys() 2016-05-09 12:55:04 +02:00
EJ 116670b15d Fix #786 by checking for opts in the bindings 2016-04-17 09:30:54 +02:00
Soeren Apel d9d57ceb28 Bindings: Update create_analog_packet() to the new analog format 2016-03-22 08:25:08 +01:00
Aurelien Jacobs 27d44cf6e0 Implement Ruby bindings on top of SWIG/C++ bindings. 2016-01-28 19:03:52 +01:00
Daniel Elstner 32ba0d8005 resource: Replace ssize_t with gssize to avoid unistd.h 2016-01-04 20:53:30 +01: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
Daniel Elstner 8c52989811 C++: Avoid std::map::emplace() for GCC 4.7 compatibility
This fixes bug #720.
2016-01-03 00:51:37 +01:00
Uwe Hermann 8141a0325c Rename sr_driver_scan_options() to sr_driver_scan_options_list(). 2015-12-31 19:04:34 +01:00
Uwe Hermann 0c697a4b33 Rename sr_dev_config_capabilities() to sr_dev_config_capabilities_list(). 2015-12-31 19:04:28 +01:00
Martin Ling 36bb818d6f bindings: New configuration enumeration API.
The new methods wrap the new libsigrok C API helper functions and eliminate
the need to pass complex types back to the user and wrap them with SWIG.

Fixes bugs #479 and #480.
2015-12-31 19:00:16 +01:00
Martin Ling 12f2f640cb bindings: Wrap enum sr_configcap as Capability class. 2015-12-31 18:27:56 +01:00
Stefan Brüns 7cccc9155c bindings/cxx: make sure the config value reference is kept
fixes glib warning:
GLib-CRITICAL **: g_variant_unref: assertion 'value->ref_count > 0' failed
2015-12-04 23:18:14 +01:00