/**
* Get the decoder with the specified ID.
*
* @param id The ID string of the decoder to return.
* @return The decoder with the specified ID, or NULL if not found.
*/
/**
* Get the decoder with the specified ID.
*
* @param id The ID string of the decoder to return.
* @return The decoder with the specified ID, or NULL if not found.
*/
static int get_probes(struct srd_decoder *d, char *attr, GSList **pl)
{
PyObject *py_probelist, *py_entry;
static int get_probes(struct srd_decoder *d, char *attr, GSList **pl)
{
PyObject *py_probelist, *py_entry;
py_probelist = PyObject_GetAttrString(d->py_dec, attr);
if (!PyList_Check(py_probelist)) {
srd_err("Protocol decoder %s %s attribute is not "
py_probelist = PyObject_GetAttrString(d->py_dec, attr);
if (!PyList_Check(py_probelist)) {
srd_err("Protocol decoder %s %s attribute is not "
py_entry = PyList_GetItem(py_probelist, i);
if (!PyDict_Check(py_entry)) {
srd_err("Protocol decoder %s %s attribute is not "
py_entry = PyList_GetItem(py_probelist, i);
if (!PyDict_Check(py_entry)) {
srd_err("Protocol decoder %s %s attribute is not "
{
PyObject *py_basedec, *py_method, *py_attr, *py_annlist, *py_ann;
struct srd_decoder *d;
{
PyObject *py_basedec, *py_method, *py_attr, *py_annlist, *py_ann;
struct srd_decoder *d;
if (!PyObject_IsSubclass(d->py_dec, py_basedec)) {
srd_err("Decoder class in protocol decoder module %s is not "
if (!PyObject_IsSubclass(d->py_dec, py_basedec)) {
srd_err("Decoder class in protocol decoder module %s is not "
/* Check for a proper start() method. */
if (!PyObject_HasAttrString(d->py_dec, "start")) {
srd_err("Protocol decoder %s has no start() method Decoder "
/* Check for a proper start() method. */
if (!PyObject_HasAttrString(d->py_dec, "start")) {
srd_err("Protocol decoder %s has no start() method Decoder "
goto err_out;
}
py_method = PyObject_GetAttrString(d->py_dec, "start");
if (!PyFunction_Check(py_method)) {
srd_err("Protocol decoder %s Decoder class attribute 'start' "
goto err_out;
}
py_method = PyObject_GetAttrString(d->py_dec, "start");
if (!PyFunction_Check(py_method)) {
srd_err("Protocol decoder %s Decoder class attribute 'start' "
/* Check for a proper decode() method. */
if (!PyObject_HasAttrString(d->py_dec, "decode")) {
srd_err("Protocol decoder %s has no decode() method Decoder "
/* Check for a proper decode() method. */
if (!PyObject_HasAttrString(d->py_dec, "decode")) {
srd_err("Protocol decoder %s has no decode() method Decoder "
goto err_out;
}
py_method = PyObject_GetAttrString(d->py_dec, "decode");
if (!PyFunction_Check(py_method)) {
srd_err("Protocol decoder %s Decoder class attribute 'decode' "
goto err_out;
}
py_method = PyObject_GetAttrString(d->py_dec, "decode");
if (!PyFunction_Check(py_method)) {
srd_err("Protocol decoder %s Decoder class attribute 'decode' "
py_attr = PyObject_GetAttrString(d->py_dec, "options");
if (!PyDict_Check(py_attr)) {
srd_err("Protocol decoder %s options attribute is not "
py_attr = PyObject_GetAttrString(d->py_dec, "options");
if (!PyDict_Check(py_attr)) {
srd_err("Protocol decoder %s options attribute is not "
if (PyObject_HasAttrString(d->py_dec, "annotations")) {
py_annlist = PyObject_GetAttrString(d->py_dec, "annotations");
if (!PyList_Check(py_annlist)) {
if (PyObject_HasAttrString(d->py_dec, "annotations")) {
py_annlist = PyObject_GetAttrString(d->py_dec, "annotations");
if (!PyList_Check(py_annlist)) {
goto err_out;
}
alen = PyList_Size(py_annlist);
for (i = 0; i < alen; i++) {
py_ann = PyList_GetItem(py_annlist, i);
if (!PyList_Check(py_ann) || PyList_Size(py_ann) != 2) {
goto err_out;
}
alen = PyList_Size(py_annlist);
for (i = 0; i < alen; i++) {
py_ann = PyList_GetItem(py_annlist, i);
if (!PyList_Check(py_ann) || PyList_Size(py_ann) != 2) {
- srd_err("Protocol decoder module %s annotation %d should "
- "be a list with two elements.", name, i+1);
+ srd_err("Protocol decoder module %s "
+ "annotation %d should be a list with "
+ "two elements.", name, i + 1);
srd_dbg("unloading decoder %s", dec->name);
/* Since any instances of this decoder need to be released as well,
* but they could be anywhere in the stack, just free the entire
* stack. A frontend reloading a decoder thus has to restart all
* instances, and rebuild the stack. */
srd_dbg("unloading decoder %s", dec->name);
/* Since any instances of this decoder need to be released as well,
* but they could be anywhere in the stack, just free the entire
* stack. A frontend reloading a decoder thus has to restart all
* instances, and rebuild the stack. */