@private */
| 695 | |
| 696 | /** @private */ |
| 697 | SRD_PRIV int srd_inst_start(struct srd_decoder_inst *di, char **error) |
| 698 | { |
| 699 | PyObject *py_res; |
| 700 | GSList *l; |
| 701 | struct srd_decoder_inst *next_di; |
| 702 | int ret; |
| 703 | PyGILState_STATE gstate; |
| 704 | |
| 705 | srd_dbg("Calling start() of instance %s.", di->inst_id); |
| 706 | |
| 707 | gstate = PyGILState_Ensure(); |
| 708 | |
| 709 | /* Run self.start(). */ |
| 710 | if (!(py_res = PyObject_CallMethod(di->py_inst, "start", NULL))) { |
| 711 | srd_exception_catch(error, "Protocol decoder instance %s", |
| 712 | di->inst_id); |
| 713 | PyGILState_Release(gstate); |
| 714 | return SRD_ERR_PYTHON; |
| 715 | } |
| 716 | Py_DecRef(py_res); |
| 717 | |
| 718 | /* first pos */ |
| 719 | di->first_pos = TRUE; |
| 720 | |
| 721 | /* none matched */ |
| 722 | di->abs_cur_matched = FALSE; |
| 723 | |
| 724 | /* skip zero flag */ |
| 725 | di->skip_zero = FALSE; |
| 726 | |
| 727 | /* Set self.samplenum to 0. */ |
| 728 | PyObject_SetAttrString(di->py_inst, "samplenum", PyLong_FromLong(0)); |
| 729 | |
| 730 | /* Set self.matched to 0. */ |
| 731 | PyObject_SetAttrString(di->py_inst, "matched", PyLong_FromLong(0)); |
| 732 | |
| 733 | PyGILState_Release(gstate); |
| 734 | |
| 735 | /* Start all the PDs stacked on top of this one. */ |
| 736 | for (l = di->next_di; l; l = l->next) { |
| 737 | next_di = l->data; |
| 738 | if ((ret = srd_inst_start(next_di, error)) != SRD_OK) |
| 739 | return ret; |
| 740 | } |
| 741 | |
| 742 | return SRD_OK; |
| 743 | } |
| 744 | |
| 745 | /** |
| 746 | * Check whether the specified sample matches the specified term. |
no test coverage detected