Age | Commit message (Collapse) | Author |
|
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.
|
|
Since Autoconf places some important feature flags only into the
configuration header, it is necessary to include it globally to
guarantee a consistent build.
|
|
This prevents Python.h from being included into client code, where
it can mess things up by e.g. redefining _POSIX_C_SOURCE.
|
|
This replaces the Decoder.add() method with Decoder.register().
The first argument is still output type, but all arguments are now
optional:
Decoder.register(output_type,
id='someid',
meta=(object-type, 'Name', 'Description'))
'id' defaults to the protocol decoder instance id, and only needs changing
if a decoder chain needs to fork.
'object-type' refers to a Python object, such as int or str.
After registering, the PD submits data as usual with Decoder.put(), with
the only argument a value of the registered object-type.
|
|
This better reflects what it is: a python object generated and
processed by python code.
|
|
The SRD_CONF_NUM_PROBES metadata key was removed. It wasn't actually
used for anything, since this is trivially available via the configured
(or default) probe list.
The SRD_CONF_UNITSIZE key was removed. The unit size is instead derived
from the probe list: the number of probes packed into the least amount
of space possible defines the unit size.
PD changes:
* The start() method no longer takes a 'metadata' parameter.
* Metadata now comes in only via the metadata() method, which takes
a key and value. The only key defined so far is SRD_CONF_SAMPLERATE,
which is exported into the module namespace.
API changes:
* srd_session_send() now takes an end_samplenum parameter, and had its
options rearranged.
* srd_session_config_set() is now srd_session_metadata_set(). This keeps
"config" options for a future feature to allow PDs or frontends to
configure each other's options on the fly, up and down the stack.
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
This is not yet finished, more things should be made private.
|
|
|
|
|
|
|
|
PDs are now checked for a proper Decoder object, with at least the
required attributes.
The author, long_desc and func attributes in the decoder object are gone.
|
|
|
|
Using srd.SRD_OUTPUT_ANN is unneeded, srd.OUTPUT_ANN is better/shorter.
|
|
In the PDs (Python code), the 'annotation' variable/attribute is a list
of annotation formats. Use the plural 'annotations' as we do for other
lists such as 'inputs', 'outputs', 'probes', 'options', and so on.
|
|
|
|
The DDC decoder takes input from the I2C PD.
|
|
|
|
|
|
|
|
|
|
|
|
This is in preparation for passing annotation data back to the calling
frontend, and python data up to the next protocol in the stack.
|
|
|