Commit 5a5f83f4 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

python: add missing bindings for twa_word and twa_run

Fixes #133.

* python/spot/impl.i: Add bindings for twa_word.  Add a __repr__
for twa_run, and instantiate templates for twa_run's members.
* tests/python/word.ipynb: New file with examples.
* tests/Makefile.am, doc/org/tut.org: Add it.
parent eb0a0b6b
...@@ -63,3 +63,4 @@ real notebooks instead. ...@@ -63,3 +63,4 @@ real notebooks instead.
automaton automaton
- [[https://spot.lrde.epita.fr/ipynb/ltsmin.html][=ltsmin.ipynb=]] minimal test for loading a DiVinE model using - [[https://spot.lrde.epita.fr/ipynb/ltsmin.html][=ltsmin.ipynb=]] minimal test for loading a DiVinE model using
the LTSmin interface. the LTSmin interface.
- [[https://spot.lrde.epita.fr/ipynb/ltsmin.html][=word.ipynb=]] example for the =twa_run= and =twa_word= classes.
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
%shared_ptr(spot::taa_tgba_formula) %shared_ptr(spot::taa_tgba_formula)
%shared_ptr(spot::twa_safra_complement) %shared_ptr(spot::twa_safra_complement)
%shared_ptr(spot::twa_run) %shared_ptr(spot::twa_run)
%shared_ptr(spot::twa_word)
%shared_ptr(spot::emptiness_check_result) %shared_ptr(spot::emptiness_check_result)
%shared_ptr(spot::emptiness_check) %shared_ptr(spot::emptiness_check)
%shared_ptr(spot::emptiness_check_instantiator) %shared_ptr(spot::emptiness_check_instantiator)
...@@ -140,6 +141,7 @@ ...@@ -140,6 +141,7 @@
#include <spot/twaalgos/hoa.hh> #include <spot/twaalgos/hoa.hh>
#include <spot/twaalgos/dtwasat.hh> #include <spot/twaalgos/dtwasat.hh>
#include <spot/twaalgos/relabel.hh> #include <spot/twaalgos/relabel.hh>
#include <spot/twaalgos/word.hh>
#include <spot/parseaut/public.hh> #include <spot/parseaut/public.hh>
...@@ -411,7 +413,9 @@ namespace std { ...@@ -411,7 +413,9 @@ namespace std {
%include <spot/twaalgos/copy.hh> %include <spot/twaalgos/copy.hh>
%include <spot/twaalgos/complete.hh> %include <spot/twaalgos/complete.hh>
%include <spot/twaalgos/complement.hh> %include <spot/twaalgos/complement.hh>
%feature("flatnested") spot::twa_run::step;
%include <spot/twaalgos/emptiness.hh> %include <spot/twaalgos/emptiness.hh>
%template(list_step) std::list<spot::twa_run::step>;
%include <spot/twaalgos/gtec/gtec.hh> %include <spot/twaalgos/gtec/gtec.hh>
%include <spot/twaalgos/lbtt.hh> %include <spot/twaalgos/lbtt.hh>
%include <spot/twaalgos/ltl2taa.hh> %include <spot/twaalgos/ltl2taa.hh>
...@@ -434,6 +438,9 @@ namespace std { ...@@ -434,6 +438,9 @@ namespace std {
%include <spot/twaalgos/hoa.hh> %include <spot/twaalgos/hoa.hh>
%include <spot/twaalgos/dtwasat.hh> %include <spot/twaalgos/dtwasat.hh>
%include <spot/twaalgos/relabel.hh> %include <spot/twaalgos/relabel.hh>
%include <spot/twaalgos/word.hh>
%template(list_bdd) std::list<bdd>;
%include <spot/parseaut/public.hh> %include <spot/parseaut/public.hh>
...@@ -605,6 +612,29 @@ namespace std { ...@@ -605,6 +612,29 @@ namespace std {
} }
%extend spot::twa_run { %extend spot::twa_run {
std::string __repr__()
{
std::ostringstream os;
os << *self;
return os.str();
}
std::string __str__()
{
std::ostringstream os;
os << *self;
return os.str();
}
}
%extend spot::twa_word {
std::string __repr__()
{
std::ostringstream os;
os << *self;
return os.str();
}
std::string __str__() std::string __str__()
{ {
std::ostringstream os; std::ostringstream os;
......
...@@ -313,7 +313,8 @@ TESTS_python = \ ...@@ -313,7 +313,8 @@ TESTS_python = \
python/satmin.py \ python/satmin.py \
python/setxor.py \ python/setxor.py \
python/testingaut.ipynb \ python/testingaut.ipynb \
python/trival.py python/trival.py \
python/word.ipynb
endif endif
CLEANFILES = python/test1.dve python/test1.dve2C python/test1.dve.cpp CLEANFILES = python/test1.dve python/test1.dve2C python/test1.dve.cpp
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment