From 2178684528ab31ca89698f29a211979da5fa3a81 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 11 Apr 2019 18:06:00 +0200 Subject: [PATCH] sccinfo: rename scc_info(x,opt) into scc_info_with_options(x,opt) * spot/twaalgos/sccinfo.hh, python/spot/impl.i: Here. This avoid ambiguities where options (integer in Python) are interpreted as initial states. * tests/python/genem.py: Adjust. --- python/spot/impl.i | 3 +++ spot/twaalgos/sccinfo.hh | 11 +++++++++-- tests/python/genem.py | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/python/spot/impl.i b/python/spot/impl.i index 492fe27c8..799dd98fb 100644 --- a/python/spot/impl.i +++ b/python/spot/impl.i @@ -653,6 +653,9 @@ def state_is_accepting(self, src) -> "bool": } %noexception spot::scc_info::edges_of; %noexception spot::scc_info::inner_edges_of; +%rename(scc_info_with_options) spot::scc_info::scc_info(const_twa_graph_ptr aut, scc_info_options options); +%rename(scc_info_with_options) spot::scc_info::scc_info(scc_and_mark_filter& filt, scc_info_options options); + %include %template(scc_info_scc_edges) spot::internal::scc_edges const, spot::internal::keep_all>; %template(scc_info_inner_scc_edges) spot::internal::scc_edges const, spot::internal::keep_inner_scc>; diff --git a/spot/twaalgos/sccinfo.hh b/spot/twaalgos/sccinfo.hh index 0cd100ac1..a79daf043 100644 --- a/spot/twaalgos/sccinfo.hh +++ b/spot/twaalgos/sccinfo.hh @@ -457,8 +457,15 @@ namespace spot /// This is usually used to prevent some edges from being /// considered as part of cycles, and can additionally restrict /// to exploration to some SCC discovered by another SCC. - scc_info(scc_and_mark_filter& filt, - scc_info_options options = scc_info_options::ALL); + scc_info(scc_and_mark_filter& filt, scc_info_options options); + // we separate the two functions so that we can rename + // scc_info(x,options) into scc_info_with_options(x,options) in Python. + // Otherwrise calling scc_info(aut,options) can be confused with + // scc_info(aut,initial_state). + scc_info(scc_and_mark_filter& filt) + : scc_info(filt, scc_info_options::ALL) + { + } /// @} const_twa_graph_ptr get_aut() const diff --git a/tests/python/genem.py b/tests/python/genem.py index d579097c0..cdfae4505 100644 --- a/tests/python/genem.py +++ b/tests/python/genem.py @@ -169,7 +169,7 @@ def generic_emptiness2(aut): # A more modern python version of spot.generic_emptiness_check() def is_empty1(g): - si = spot.scc_info(g, spot.scc_info_options_NONE) + si = spot.scc_info_with_options(g, spot.scc_info_options_NONE) for scc_num in range(si.scc_count()): if si.is_trivial(scc_num): continue @@ -207,7 +207,7 @@ def is_scc_empty1(si, scc_num, acc=None): return True def is_empty2(g): - si = spot.scc_info(g, spot.scc_info_options_STOP_ON_ACC) + si = spot.scc_info_with_options(g, spot.scc_info_options_STOP_ON_ACC) if si.one_accepting_scc() >= 0: return False for scc_num in range(si.scc_count()):