summaryrefslogtreecommitdiff
path: root/decoder.c
AgeCommit message (Collapse)Author
2016-08-25Factor out srd_decoder_apiver().Uwe Hermann
2015-11-04srd_decoder_unload(): Remove PD from the internal list.Uwe Hermann
This issue was discovered via the newly added unit tests.
2015-10-06util: Factor out Python module loadDaniel Elstner
Create a utility function for loading a Python module by its name in UTF-8.
2015-10-06decoder: Refactor loading code and plug leaksDaniel Elstner
2015-10-06Python: Restrict code to stable ABI subsetDaniel Elstner
Limit usage of the Python C API to the stable ABI subset as defined by PEP 384. This removes some type definitions and functions which libsigrokdecode made use of. Convert all affected code to suitable API alternatives. Also fix a few leaks that became apparent while working on the code. The most visible change is that PyTypeObject is now an opaque type. Thus, the custom Decoder and srd_logic types are now created on the heap via an alternative API. Unfortunately, since tp_name is now inaccessible, type names had to be removed from the log output. Stack traces after Python exceptions are now formatted by calling into Python, since the trace object C API is no longer available.
2015-09-13Build: Include <config.h> first in all source filesDaniel Elstner
Since Autoconf places some important feature flags only into the configuration header, it is necessary to include it globally to guarantee a consistent build.
2015-09-13Fix srd_log() format warningsDaniel Elstner
2015-04-01Use g_malloc*() consistently, simplify error handling.Uwe Hermann
Use g_malloc*() for small allocations and assume they always succeed. Simplify error handling in a few places accordingly. Document the rules in the README file.
2014-07-20Fix incorrect doxygen comment for srd_decoder_list().Uwe Hermann
This fixes bug #378.
2014-07-08Remove dependency on Python.h from public API headerMarcus Comstedt
This prevents Python.h from being included into client code, where it can mess things up by e.g. redefining _POSIX_C_SOURCE.
2014-07-08srd_decoder_load_all_path: Support zipimport pathsMarcus Comstedt
srd_decoder_load() works perfectly with decoders stored inside zip files. However, srd_decoder_load_all{_path,}() did not, because it assumed that normal directory listings can be used to enumerate decoders, which is not the case for zipped decoders. Fix this by providing a fallback based on the zipimporter Python class.
2014-05-04Only load and use PDs of API version 2.Uwe Hermann
Decoders that implement any other PD API version are per definition not compatible and cannot work with this library version.
2014-05-04Mark some variables more consistently as SRD_PRIV.Uwe Hermann
2014-05-04Update a few Doxygen @since tags.Uwe Hermann
2014-05-03Move srd_check_init() to decoder.c and make it static.Uwe Hermann
The function srd_check_init() is only used in decoder.c.
2014-05-03Make 'pd_list' static, it's only used in one file.Uwe Hermann
2014-04-13Rename 'probe' to 'channel' everywhere.Uwe Hermann
Variables of type 'struct srd_channel *' are consistently named 'pdch' to make them easily distinguishable from libsigrok's 'struct sr_channel *' variables that are consistently named 'ch'.
2014-03-11Fix enumeration of option values.Bert Vermeulen
2014-03-10Probes, optional probes and annotations now take a tuple.Bert Vermeulen
Annotation entries also consist of a tuple, not a list.
2014-03-10Change PD options to be a tuple of dictionaries.Bert Vermeulen
Each option consists of a dictionary with the following keys: id The option id, which is passed in when setting a value. desc A description of the option, suitable for display. def The default value for this option. values (optional) If present, a tuple containing values the option may take. They must be of the same type as the default. Valid types for the options are UTF-8-encoded strings, integers, and floating point values.
2014-01-31Add support for annotation rows.Uwe Hermann
An annotation row is a list of annotation classes that should all be displayed in the same "row" in GUIs. For example, the UART decoder would have at least two rows (for decoded RX and TX data/startbits/stopbits/paritybits), the SPI decoder would have at least two rows (for decoded MISO and MOSI data), and so on. Each annotation row has a short ID string (mostly for use in command-line frontends), a description string (mostly for use by GUIs), and a tuple/list of annotation class IDs belonging to this row. If no annotation rows are provided by the decoder, frontends can consider this as the "trivial" case of all annotation classes being displayed on the same (only) row.
2013-12-12Binary classes are now defined as (name, description).Bert Vermeulen
2013-12-11Easier access to sequences of strings, not just lists.Bert Vermeulen
2013-12-11Load decoders from all search paths, not just the default.Bert Vermeulen
srd_decoder_load_all() was really only getting a list of decoders from the default (installation) path, so could not find uninstalled decoders, or those in a custom added search path. This broke development of new PDs when using the SIGROKDECODE_DIR environment variable, and broke many of the unit tests in the tests/ directory -- those actually tested against the already-installed decoders, not the ones about to be installed.
2013-12-11Clear decoder list after unloading, not just at exit.Bert Vermeulen
2013-12-09Avoid GError warning when unloading decoders.Bert Vermeulen
2013-11-18Don't try to load an already-loaded moduleBert Vermeulen
Python silently uses the existing module anyway, but the library was counting it as an extra module. This was exposed by a test case in the test suite.
2013-11-18Don't decrease borrowed reference to probe definition dictBert Vermeulen
This fixes bug 177.
2013-11-18Check library initialization before handling decodersBert Vermeulen
2013-11-15Implement OUTPUT_BINARYBert Vermeulen
This requires the PD to have a tuple in its class called 'binary', which contains a list of strings describing the different binary classes it can output. For the SPI decoder this might be 'MOSI' and 'MISO', for example. The data is submitted to the frontend as struct srd_proto_data_binary, which contains the class that data belongs to.
2013-10-18Report invalid module name on decoder loadBert Vermeulen
2013-10-14Move all decoder instances and callbacks into a session structBert Vermeulen
The struct srd_session also holds configuration parameters formerly passed to srd_session_start(). The new call srd_session_new() takes a pointer where a newly allocated pointer to struct srd_session will be stored. This pointer must be passed as the first argument to all functions that require it. The SRD_CONF_NUM_PROBES, SRD_CONF_UNITSIZE and SRD_CONF_SAMPLERATE keys must be configured with srd_config_set() before srd_session_start() is called. A new call srd_session_destroy() is also available. This cleans up all resources the session holds. This is also called from srd_exit() for all sessions.
2013-05-08Fix double freeBert Vermeulen
2013-05-05Fix various memory leaksBert Vermeulen
2013-05-03Doxygen: Various fixes.Uwe Hermann
2013-05-03Main header is <libsigrokdecode/libsigrokdecode.h> now.Uwe Hermann
This matches the convention used in libsigrok. Potential other headers might end up in libsigrokdecode/, but only libsigrokdecode.h is meant to be #included by frontends directly.
2013-05-03Doxygen: Add @since markers to API functions.Uwe Hermann
Also, document the functions in version.c.
2013-04-23GPL headers: Use correct project name.Uwe Hermann
2013-03-19use GVariant for passing decoder options and probesBert Vermeulen
Decoder options are now exposed in struct srd_decoder, via a GSList of the new struct srd_decoder_option. The 'def' field represents the default value as set in the decoder, converted to GVariant. This allows a library user to determine the type as well as default value.
2013-02-09Doxygen: Initial groups and topic short descriptions.Uwe Hermann
2013-02-09Doxygen: Add @file items for the relevant files.Uwe Hermann
These short descriptions are shown in the "Files" section of the Doxygen output.
2013-02-09Doxygen: Mark private functions/variables properly.Uwe Hermann
2013-02-02Bring back temporarily reverted changes.Uwe Hermann
2013-01-27Temporarily revert API changes in preparation of release.Uwe Hermann
The upcoming libsigrokdecode release should not contain any API changes so it is compatible with existing released frontends (sigrok-cli 0.3.1).
2013-01-01constify srd_decoder_list() outputBert Vermeulen
2012-05-10srd: Support for one or more optional probes.Uwe Hermann
In the protocol decoder you always get all required probes, then _all_ optional probes in the list of probes in the decode() call. Example: (r1, r2, r3, o1, o2, o3, o4) = pins In this case r1-r3 are required probes, o1-o4 are optional probes. However, the value of valid/used/specified probes will be 0 or 1, whereas the value of probes that were not specified/assigned by the user will be (at the moment) 42. The PD can check for a valid probe like this: if p in (0, 1): ... Or check for an invalid probe: if (p > 1): ... The value of 42 could change to be -1 or None later.
2012-05-09srd: Fix a few Doxygen errors.Uwe Hermann
2012-03-28srd: Some more (optional) consistency renames.Uwe Hermann
2012-03-28srd/cli/qt: Some more API consistency renames.Uwe Hermann
2012-03-21srd: Drop unused inputformats/outputformats entries.Uwe Hermann