MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / srd_session_end

Function srd_session_end

libsigrokdecode4DSL/session.c:428–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426}
427
428SRD_API int srd_session_end(struct srd_session *sess, char **error)
429{
430 GSList *d;
431 struct srd_decoder_inst *di;
432 PyGILState_STATE gstate;
433 PyObject *py_res;
434 int ret;
435
436 if (!sess || !sess->di_list){
437 return SRD_ERR;
438 }
439
440 gstate = PyGILState_Ensure();
441
442 for (d = sess->di_list; d; d = d->next)
443 {
444 di = d->data;
445
446 if (PyObject_HasAttrString(di->py_inst, "end"))
447 {
448 //set the last sample index
449 PyObject *py_cur_samplenum = PyLong_FromUnsignedLongLong(di->abs_cur_samplenum);
450 PyObject_SetAttrString(di->py_inst, "last_samplenum", py_cur_samplenum);
451 Py_DECREF(py_cur_samplenum);
452
453 py_res = PyObject_CallMethod(di->py_inst, "end", NULL);
454
455 if (!py_res)
456 {
457 srd_exception_catch(error, "Protocol decoder instance %s",
458 di->inst_id);
459 PyGILState_Release(gstate);
460 return SRD_ERR_PYTHON;
461 }
462 }
463
464 if (di->next_di != NULL){
465 ret = srd_call_sub_decoder_end(di, error);
466 if (ret != SRD_OK){
467 PyGILState_Release(gstate);
468 return ret;
469 }
470 }
471 }
472
473 PyGILState_Release(gstate);
474 return SRD_OK;
475}
476
477
478SRD_PRIV int srd_call_sub_decoder_end(struct srd_decoder_inst *di, char **error)

Callers 1

decode_dataMethod · 0.85

Calls 2

srd_exception_catchFunction · 0.85
srd_call_sub_decoder_endFunction · 0.85

Tested by

no test coverage detected