Commit Graph

282 Commits

Author SHA1 Message Date
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
Marcus Comstedt 8eb4299c5b bindings: Fix doc extraction for enums
The source file enum.hpp was not found when not building in the source
tree.  Also, extraction of the brief description did not work correctly
when there was additional XML markup inside the <para> element.
2015-12-03 22:01:21 +01:00
Marcus Comstedt ee95d6bd8b Java: Remove explicit constructor deletes since SWIG 2 doesn't like them
bindings/java/org/sigrok/core/classes/classes.i:247: Error: \
    Syntax error in input(3).
2015-11-02 18:46:05 +01:00
Marcus Comstedt e13648d041 Java: Fix leaking global refs
This fixes issue #690.
2015-11-02 18:37:10 +01:00
Marcus Comstedt c470ae86da Java: Don't use JNIEnv* captured by lambdas, it may be invalid for the context 2015-11-02 18:37:10 +01:00
Marcus Comstedt 908aad3816 Java: Fill jlongs with 0 when doing SWIG style pointer marshalling
This prevents valgrind complaints and also makes pointer comparison
from the Java side work.
2015-11-02 18:37:10 +01:00
Marcus Comstedt 32fd1edc23 Revert "Java: Avoid dangerous writes via casted pointers"
This reverts commit 865de99391.

This fixes bug #688.
2015-11-02 18:37:10 +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 014512254a C++: Declare std::default_delete friend as struct
std::default_delete<> is originally defined as struct, not class.
This does not really make much of a difference, but some compilers
complain when the struct/class tag is not consistent across all
declarations of the type.
2015-10-30 15:09:40 +01:00
Daniel Elstner cea8c3124f C++: Suppress deprecation warnings from glibmm
Ignore warnings due to use of std::auto_ptr<> in the glibmm headers.
This should be reverted once glibmm is fixed.
2015-10-30 12:51:16 +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
Daniel Elstner 865de99391 Java: Avoid dangerous writes via casted pointers
Writing to an object through a pointer of incompatible type is
really evil. Even when the data size matches, it is still a
violation of strict aliasing rules.

Replace all instances by direct casts of the value, without the
unnecessary and dangerous indirection.
2015-10-26 07:29:50 +01:00