python: rewrite translate() to deal with unambiguous and sbacc

and make it easier to extend and use.

* src/twaalgos/postproc.hh, src/twaalgos/translate.cc,
src/twaalgos/translate.hh: Incorporate the Unambiguous option
with the other preferences.  It's cleaner this way, and the
previous setup did not work well with Python.
* src/bin/ltl2tgba.cc: Adjust to this change.
* wrap/python/spot.py (translate): Rewrite.
* wrap/python/tests/automata.ipynb: Adjust existing cases, and
add more as well as some comments.
This commit is contained in:
Alexandre Duret-Lutz 2015-05-15 23:50:19 +02:00
parent 1ef3e5f3ff
commit 19a273929c
6 changed files with 666 additions and 190 deletions

View file

@ -83,7 +83,7 @@ const struct argp_child children[] =
};
static spot::option_map extra_options;
bool unambiguous = false;
static spot::postprocessor::output_pref unambig = 0;
static int
parse_opt(int key, char* arg, struct argp_state*)
@ -98,7 +98,7 @@ parse_opt(int key, char* arg, struct argp_state*)
type = spot::postprocessor::Monitor;
break;
case 'U':
unambiguous = true;
unambig = spot::postprocessor::Unambiguous;
break;
case 'x':
{
@ -186,11 +186,9 @@ main(int argc, char** argv)
program_name);
spot::translator trans(&extra_options);
trans.set_pref(pref | comp | sbacc);
trans.set_pref(pref | comp | sbacc | unambig);
trans.set_type(type);
trans.set_level(level);
if (unambiguous)
trans.set_pref(spot::translator::Unambiguous);
try
{