python: add get_name & set_name for automata
* wrap/python/spot_impl.i (get_name, set_name): New methods for twa. * wrap/python/tests/remfin.py: Test them. * wrap/python/ajax/spotcgi.in: Use set_name(). * NEWS: Mention it.
This commit is contained in:
parent
176c9e2e17
commit
43a5187ab4
4 changed files with 26 additions and 0 deletions
1
NEWS
1
NEWS
|
|
@ -48,6 +48,7 @@ New in spot 1.99.4a (not yet released)
|
||||||
https://spot.lrde.epita.fr/tut01.html for examples.
|
https://spot.lrde.epita.fr/tut01.html for examples.
|
||||||
* The Debian package is now compiled for all Python3 versions
|
* The Debian package is now compiled for all Python3 versions
|
||||||
supported by Debian, not just the default one.
|
supported by Debian, not just the default one.
|
||||||
|
* Automata now have get_name()/set_name() methods.
|
||||||
|
|
||||||
Bugs fixed:
|
Bugs fixed:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -658,6 +658,7 @@ if output_type == 'm':
|
||||||
unbufprint('<div class="automata-stats">')
|
unbufprint('<div class="automata-stats">')
|
||||||
dont_run_dot = print_stats(automaton)
|
dont_run_dot = print_stats(automaton)
|
||||||
unbufprint('</div>')
|
unbufprint('</div>')
|
||||||
|
automaton.set_name(str(f))
|
||||||
render_automaton(automaton, dont_run_dot)
|
render_automaton(automaton, dont_run_dot)
|
||||||
automaton = 0
|
automaton = 0
|
||||||
finish()
|
finish()
|
||||||
|
|
@ -752,6 +753,7 @@ if output_type == 'a':
|
||||||
del s
|
del s
|
||||||
else: # 't' or 's'
|
else: # 't' or 's'
|
||||||
dont_run_dot = print_stats(degen, True)
|
dont_run_dot = print_stats(degen, True)
|
||||||
|
automaton.set_name(str(f))
|
||||||
render_automaton(degen, dont_run_dot)
|
render_automaton(degen, dont_run_dot)
|
||||||
degen = 0
|
degen = 0
|
||||||
automaton = 0
|
automaton = 0
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,13 @@ using namespace spot;
|
||||||
$result = SWIG_NewPointerObj(new spot::formula($1), $descriptor(spot::formula*), SWIG_POINTER_OWN);
|
$result = SWIG_NewPointerObj(new spot::formula($1), $descriptor(spot::formula*), SWIG_POINTER_OWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(out) std::string* {
|
||||||
|
if (!$1)
|
||||||
|
$result = SWIG_Py_Void();
|
||||||
|
else
|
||||||
|
$result = SWIG_FromCharPtr($1->c_str());
|
||||||
|
}
|
||||||
|
|
||||||
%exception {
|
%exception {
|
||||||
try {
|
try {
|
||||||
$action
|
$action
|
||||||
|
|
@ -330,6 +337,18 @@ namespace std {
|
||||||
std::string __str__() { return spot::str_psl(*self); }
|
std::string __str__() { return spot::str_psl(*self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%extend spot::twa {
|
||||||
|
void set_name(std::string name)
|
||||||
|
{
|
||||||
|
self->set_named_prop("automaton-name", new std::string(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string* get_name()
|
||||||
|
{
|
||||||
|
return self->get_named_prop<std::string>("automaton-name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
%extend spot::acc_cond::acc_code {
|
%extend spot::acc_cond::acc_code {
|
||||||
std::string __repr__()
|
std::string __repr__()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -35,3 +35,7 @@ State: 0
|
||||||
State: 1
|
State: 1
|
||||||
[t] 1
|
[t] 1
|
||||||
--END--""")
|
--END--""")
|
||||||
|
|
||||||
|
assert(aut.get_name() == None)
|
||||||
|
aut.set_name("test me")
|
||||||
|
assert(aut.get_name() == "test me")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue