@@ -699,6 +699,9 @@ SRD_PRIV int srd_inst_start(struct srd_decoder_inst *di, char **error)
699
699
/* none matched */
700
700
di -> abs_cur_matched = FALSE;
701
701
702
+ /* skip zero flag */
703
+ di -> skip_zero = FALSE;
704
+
702
705
/* Set self.samplenum to 0. */
703
706
PyObject_SetAttrString (di -> py_inst , "samplenum" , PyLong_FromLong (0 ));
704
707
@@ -859,7 +862,7 @@ static void update_old_pins_array_initial_pins(struct srd_decoder_inst *di)
859
862
}
860
863
}
861
864
862
- static gboolean term_matches (const struct srd_decoder_inst * di ,
865
+ static gboolean term_matches (struct srd_decoder_inst * di ,
863
866
struct srd_term * term , gboolean * skip_allow )
864
867
{
865
868
uint8_t old_sample , sample ;
@@ -869,8 +872,11 @@ static gboolean term_matches(const struct srd_decoder_inst *di,
869
872
/* Caller ensures di, di->dec_channelmap, term, sample_pos != NULL. */
870
873
871
874
* skip_allow = FALSE;
872
- if (term -> type == SRD_TERM_SKIP )
875
+ if (term -> type == SRD_TERM_SKIP ) {
876
+ if (di -> abs_cur_matched && term -> num_samples_to_skip == 0 )
877
+ di -> skip_zero = TRUE;
873
878
return sample_matches (0 , 0 , term );
879
+ }
874
880
875
881
ch = term -> channel ;
876
882
if (* (di -> inbuf + ch ) == NULL ) {
@@ -886,7 +892,7 @@ static gboolean term_matches(const struct srd_decoder_inst *di,
886
892
return sample_matches (old_sample , sample , term );
887
893
}
888
894
889
- static gboolean all_terms_match (const struct srd_decoder_inst * di ,
895
+ static gboolean all_terms_match (struct srd_decoder_inst * di ,
890
896
const GSList * cond , gboolean * skip_allow )
891
897
{
892
898
const GSList * l ;
@@ -900,6 +906,10 @@ static gboolean all_terms_match(const struct srd_decoder_inst *di,
900
906
return FALSE;
901
907
}
902
908
909
+ if (di -> skip_zero ) {
910
+ di -> abs_cur_samplenum -- ;
911
+ di -> skip_zero = FALSE;
912
+ }
903
913
return TRUE;
904
914
}
905
915
0 commit comments