streett_like: clear the pair vector when non Streett-like

When an acceptance condition is not Streett-like, is_streett_like
now clears the rs_pair vector parameter before returning. Fixes #270.

* spot/twa/acc.cc: Clear the pair vector.
* spot/twaalgos/totgba.cc: Stop calling streett_to_generalized_buchi()
  when the acceptance condition is not Streett-like.
This commit is contained in:
Thomas Medioni 2017-06-20 11:50:16 +02:00
parent 0a21a4c87e
commit fc609057d6
2 changed files with 17 additions and 8 deletions

View file

@ -479,9 +479,9 @@ namespace spot
s = 5; s = 5;
} }
else if (mainop != highop) else if (mainop != highop)
{ {
return false; return false;
} }
while (s) while (s)
{ {
auto op = code[--s].sub.op; auto op = code[--s].sub.op;
@ -494,7 +494,10 @@ namespace spot
acc_cond::mark_t inf(0U); acc_cond::mark_t inf(0U);
if (op == singleop && m.count() != 1) if (op == singleop && m.count() != 1)
return false; {
pairs.clear();
return false;
}
for (unsigned mark: m.sets()) for (unsigned mark: m.sets())
{ {
if (op == acc_cond::acc_op::Fin) if (op == acc_cond::acc_op::Fin)
@ -507,7 +510,10 @@ namespace spot
else else
{ {
if (op != lowop || size != 4) if (op != lowop || size != 4)
return false; {
pairs.clear();
return false;
}
auto o1 = code[--s].sub.op; auto o1 = code[--s].sub.op;
auto m1 = code[--s].mark; auto m1 = code[--s].mark;
@ -527,7 +533,10 @@ namespace spot
|| o2 != acc_cond::acc_op::Inf || o2 != acc_cond::acc_op::Inf
|| m1.count() != 1 || m1.count() != 1
|| m2.count() != 1) || m2.count() != 1)
return false; {
pairs.clear();
return false;
}
pairs.emplace_back(m1, m2); pairs.emplace_back(m1, m2);
} }
} }

View file

@ -331,8 +331,8 @@ namespace spot
}(); }();
std::vector<acc_cond::rs_pair> pairs; std::vector<acc_cond::rs_pair> pairs;
in->acc().is_streett_like(pairs); bool res = in->acc().is_streett_like(pairs);
if (min == 0 || min > pairs.size()) if (!res || min == 0 || min > pairs.size())
return nullptr; return nullptr;
else else
return streett_to_generalized_buchi(in); return streett_to_generalized_buchi(in);