autfilt: better handling of chain of products with -B

Fixes #348, reported by Jeroen Meijer.

* bin/autfilt.cc: If -B is used with many --product,
degeneralize intermediate products as needed.
* NEWS: Mention the change.
* tests/core/prodchain.test: New file.
* tests/Makefile.am: Add it.
* spot/twa/acc.cc, spot/twa/acc.hh: Fix reporting of
overflow.
* tests/core/acc.cc: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2018-05-24 13:36:17 +02:00
parent a738801edf
commit c87c13db67
7 changed files with 149 additions and 19 deletions

View file

@ -32,6 +32,14 @@
namespace spot
{
void acc_cond::report_too_many_sets()
{
#define STR(x) #x
#define VALUESTR(x) STR(x)
throw std::runtime_error("Too many acceptance sets used. "
"The limit is " VALUESTR(SPOT_NB_ACC) ".");
}
std::ostream& operator<<(std::ostream& os, spot::acc_cond::mark_t m)
{
auto a = m;

View file

@ -46,6 +46,11 @@ namespace spot
class SPOT_API acc_cond
{
#ifndef SWIG
private:
[[noreturn]] static void report_too_many_sets();
#endif
public:
struct mark_t : public internal::_32acc<SPOT_NB_ACC == 8*sizeof(unsigned)>
{
@ -214,24 +219,52 @@ namespace spot
mark_t operator<<(unsigned i) const
{
return id << i;
try
{
return id << i;
}
catch (const std::runtime_error& e)
{
report_too_many_sets();
}
}
mark_t& operator<<=(unsigned i)
{
id <<= i;
return *this;
try
{
id <<= i;
return *this;
}
catch (const std::runtime_error& e)
{
report_too_many_sets();
}
}
mark_t operator>>(unsigned i) const
{
return id >> i;
try
{
return id >> i;
}
catch (const std::runtime_error& e)
{
report_too_many_sets();
}
}
mark_t& operator>>=(unsigned i)
{
id >>= i;
return *this;
try
{
id >>= i;
return *this;
}
catch (const std::runtime_error& e)
{
report_too_many_sets();
}
}
mark_t strip(mark_t y) const
@ -1229,7 +1262,7 @@ namespace spot
unsigned j = num_;
num_ += num;
if (num_ > SPOT_NB_ACC)
throw std::runtime_error("Too many acceptance sets used.");
report_too_many_sets();
all_ = all_sets_();
return j;
}