gen: pass the bdd_dict to aut_pattern()

* spot/gen/automata.hh (aut_pattern): Add the dict argument.
* spot/gen/automata.cc, python/spot/gen.i: Adjust.
* tests/python/gen.py: Make sure two automata built without
specifying any dictionary share the same one.
This commit is contained in:
Alexandre Duret-Lutz 2017-04-27 18:00:51 +02:00
parent 11ca2803c9
commit 649793df75
4 changed files with 24 additions and 5 deletions

View file

@ -28,7 +28,7 @@ namespace spot
namespace
{
static twa_graph_ptr
ks_cobuchi(unsigned n)
ks_cobuchi(unsigned n, bdd_dict_ptr dict)
{
if (n == 0)
throw std::runtime_error("ks_cobuchi expects a positive argument");
@ -45,7 +45,6 @@ namespace spot
// the automaton has 2n+1 states, numbered from 0 to 2n
// 0 is the initial state and the only non-deterministic state
auto dict = make_bdd_dict();
auto aut = make_twa_graph(dict);
// register aps
@ -91,7 +90,7 @@ namespace spot
}
}
twa_graph_ptr aut_pattern(aut_pattern_id pattern, int n)
twa_graph_ptr aut_pattern(aut_pattern_id pattern, int n, bdd_dict_ptr dict)
{
if (n < 0)
{
@ -105,7 +104,7 @@ namespace spot
{
// Keep this alphabetically-ordered!
case AUT_KS_COBUCHI:
return ks_cobuchi(n);
return ks_cobuchi(n, dict);
case AUT_END:
break;
}

View file

@ -21,6 +21,7 @@
#include <spot/misc/common.hh>
#include <spot/twa/fwd.hh>
#include <spot/twa/bdddict.hh>
namespace spot
{
@ -55,7 +56,13 @@ namespace spot
/// The pattern is specified using one value from the aut_pattern_id
/// enum. See the man page of the `genaut` binary for a
/// description of those patterns, and bibliographic references.
SPOT_API twa_graph_ptr aut_pattern(aut_pattern_id pattern, int n);
///
/// In case you want to combine this automaton with other
/// automata, pass the bdd_dict to use to make sure that all share
/// the same.
SPOT_API twa_graph_ptr
aut_pattern(aut_pattern_id pattern, int n,
spot::bdd_dict_ptr dict = make_bdd_dict());
/// \brief convert an aut_pattern_it value into a name
///