ltsmin: implement a two-step loading
* spot/ltsmin/ltsmin.cc, spot/ltsmin/ltsmin.hh: Split load_ltsmin() into ltsmin_model::load() and ltsmin_model::kripke(). Report errors using exceptions instead of on std::cerr. * python/spot/ltsmin.i: Deal with exceptions. * tests/ltsmin/modelcheck.cc, tests/python/ltsmin.ipynb: Adjust.
This commit is contained in:
parent
84031d2ae1
commit
907b72fbfb
6 changed files with 230 additions and 191 deletions
|
|
@ -47,20 +47,36 @@ using namespace spot;
|
|||
%import(module="spot.impl") <spot/kripke/fairkripke.hh>
|
||||
%import(module="spot.impl") <spot/kripke/kripke.hh>
|
||||
|
||||
%exception {
|
||||
try {
|
||||
$action
|
||||
}
|
||||
catch (const std::runtime_error& e)
|
||||
{
|
||||
SWIG_exception(SWIG_RuntimeError, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
namespace std {
|
||||
%template(atomic_prop_set) set<spot::formula>;
|
||||
}
|
||||
|
||||
%rename(model) spot::ltsmin_model;
|
||||
%rename(kripke_raw) spot::ltsmin_model::kripke;
|
||||
%include <spot/ltsmin/ltsmin.hh>
|
||||
|
||||
%pythoncode %{
|
||||
import spot
|
||||
|
||||
def load(filename, ap_set, dict=spot._bdd_dict,
|
||||
dead=spot.formula_ap('dead'),
|
||||
compress=2, debug=False):
|
||||
def load(filename):
|
||||
return model.load(filename)
|
||||
|
||||
def _kripke(self, ap_set, dict=spot._bdd_dict,
|
||||
dead=spot.formula_ap('dead'),
|
||||
compress=2):
|
||||
s = spot.atomic_prop_set()
|
||||
for ap in ap_set:
|
||||
s.insert(spot.formula_ap(ap))
|
||||
return load_ltsmin(filename, dict, s, dead, compress, debug)
|
||||
return self.kripke_raw(s, dict, dead, compress)
|
||||
model.kripke = _kripke
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue