dot, hoa: default to "k" for kripke structure
* spot/twaalgos/dot.cc, spot/twaalgos/hoa.cc: If a Kripke structure is passed, automatically enable the "k" option. * tests/core/parse_print_test.cc, tests/ltsmin/modelcheck.cc, tests/python/ltsmin.ipynb: Remove the explicit use of "k". * NEWS: Mention the change.
This commit is contained in:
parent
a9b4560f3d
commit
02b5460b91
6 changed files with 155 additions and 126 deletions
|
|
@ -31,6 +31,7 @@
|
|||
#include <spot/twa/formula2bdd.hh>
|
||||
#include <spot/twaalgos/copy.hh>
|
||||
#include <spot/twaalgos/sccinfo.hh>
|
||||
#include <spot/kripke/kripke.hh>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
|
|
@ -663,6 +664,9 @@ namespace spot
|
|||
const char* options)
|
||||
{
|
||||
dotty_output d(os, options);
|
||||
// Enable automatic state labels for Kripke structure.
|
||||
if (std::dynamic_pointer_cast<const kripke>(g))
|
||||
d.parse_opts("k");
|
||||
auto aut = std::dynamic_pointer_cast<const twa_graph>(g);
|
||||
if (!aut || (d.max_states_given() && aut->num_states() >= d.max_states()))
|
||||
aut = copy(g, twa::prop_set::all(), true, d.max_states() - 1);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include <spot/misc/minato.hh>
|
||||
#include <spot/twa/formula2bdd.hh>
|
||||
#include <spot/tl/formula.hh>
|
||||
#include <spot/kripke/kripke.hh>
|
||||
|
||||
namespace spot
|
||||
{
|
||||
|
|
@ -575,15 +576,28 @@ namespace spot
|
|||
|
||||
std::ostream&
|
||||
print_hoa(std::ostream& os,
|
||||
const const_twa_ptr& aut,
|
||||
const char* opt)
|
||||
const const_twa_ptr& aut,
|
||||
const char* opt)
|
||||
{
|
||||
|
||||
auto a = std::dynamic_pointer_cast<const twa_graph>(aut);
|
||||
if (!a)
|
||||
a = make_twa_graph(aut, twa::prop_set::all());
|
||||
|
||||
return print_hoa(os, a, opt);
|
||||
// for Kripke structures, automatically append "k" to the options.
|
||||
char* tmpopt = nullptr;
|
||||
if (std::dynamic_pointer_cast<const kripke>(aut))
|
||||
{
|
||||
unsigned n = opt ? strlen(opt) : 0;
|
||||
tmpopt = new char[n + 2];
|
||||
if (opt)
|
||||
strcpy(tmpopt, opt);
|
||||
tmpopt[n] = 'k';
|
||||
tmpopt[n + 1] = 0;
|
||||
}
|
||||
print_hoa(os, a, tmpopt ? tmpopt : opt);
|
||||
delete[] tmpopt;
|
||||
return os;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue