* src/ltltest/Makefile.am (AM_CXXFLAGS): New variable.

* tgba/bdddict.hh (bdd_dict::register_propositions,
bdd_dict::register_accepting_variables): New methods.
* src/bdddict.cc: Likewise.
* tgba/tgbaexplicit.cc (tgba_explicit::add_conditions,
tgba_explicit::add_accepting_conditions): New methods.
(tgba_explicit::get_init_state): Add an "empty" initial
state to empty automata.
* tgba/tgbaexplicit.hh: (tgba_explicit::add_conditions,
tgba_explicit::add_accepting_conditions): New methods.
* tgbaalgos/Makefiles.am (tgbaalgos_HEADERS, libtgbaalgos_la_SOURCES):
Add dupexp.hh and dupexp.cc.
* tgbaalgos/dupexp.hh, tgbaalgos/dupexp.cc: New files.
* tgbatest/Makefile.am (AM_CXXFLAGS): New variable.
(check_SCRIPTS): Add dupexp.test.
(CLEANFILES): Add output1 and output2.
* tgbatest/dupexp.test: New file.
* tgbatest/ltl2tgba.cc: Handle -s and -S.
* tgbatest/tgbaread.cc: Remove unused variable exit_code.
This commit is contained in:
Alexandre Duret-Lutz 2003-11-14 16:44:12 +00:00
parent 51ff9f8dda
commit 982c5efc6c
13 changed files with 271 additions and 8 deletions

View file

@ -4,22 +4,24 @@ AM_CXXFLAGS = $(WARNING_CXXFLAGS)
tgbaalgosdir = $(pkgincludedir)/tgbaalgos
tgbaalgos_HEADERS = \
reachiter.hh \
dotty.hh \
dupexp.hh \
emptinesscheck.hh \
lbtt.hh \
ltl2tgba_fm.hh \
ltl2tgba_lacim.hh \
magic.hh \
emptinesscheck.hh \
reachiter.hh \
save.hh
noinst_LTLIBRARIES = libtgbaalgos.la
libtgbaalgos_la_SOURCES = \
reachiter.cc \
dotty.cc \
dupexp.cc \
emptinesscheck.cc \
lbtt.cc \
ltl2tgba_fm.cc \
ltl2tgba_lacim.cc \
magic.cc \
emptinesscheck.cc \
reachiter.cc \
save.cc

91
src/tgbaalgos/dupexp.cc Normal file
View file

@ -0,0 +1,91 @@
#include "dupexp.hh"
#include <sstream>
#include <string>
#include <map>
#include "reachiter.hh"
namespace spot {
template <class T>
class dupexp_iter: public T
{
public:
dupexp_iter(const tgba* a)
: T(a), out_(new tgba_explicit(a->get_dict()))
{
}
tgba_explicit*
result()
{
return out_;
}
void
process_state(const state* s, int n, tgba_succ_iterator*)
{
std::ostringstream os;
os << "(#" << n << ") " << automata_->format_state(s);
name_[n] = os.str();
}
std::string
declare_state(const state* s, int n)
{
std::string str;
name_map_::const_iterator i = name_.find(n);
if (i == name_.end())
{
std::ostringstream os;
os << "(#" << n << ") " << automata_->format_state(s);
name_[n] = str = os.str();
}
else
{
str = i->second;
}
delete s;
return str;
}
void
process_link(int in, int out, const tgba_succ_iterator* si)
{
// We might need to format out before process_state is called.
name_map_::const_iterator i = name_.find(out);
if (i == name_.end())
{
const state* s = si->current_state();
process_state(s, out, 0);
delete s;
}
tgba_explicit::transition* t =
out_->create_transition(name_[in], name_[out]);
out_->add_conditions(t, si->current_condition());
out_->add_accepting_conditions(t, si->current_accepting_conditions());
}
private:
tgba_explicit* out_;
typedef std::map<int, std::string> name_map_;
std::map<int, std::string> name_;
};
tgba_explicit*
tgba_dupexp_bfs(const tgba* aut)
{
dupexp_iter<tgba_reachable_iterator_breadth_first> di(aut);
di.run();
return di.result();
}
tgba_explicit*
tgba_dupexp_dfs(const tgba* aut)
{
dupexp_iter<tgba_reachable_iterator_depth_first> di(aut);
di.run();
return di.result();
}
}

16
src/tgbaalgos/dupexp.hh Normal file
View file

@ -0,0 +1,16 @@
#ifndef SPOT_TGBAALGOS_DUPEXPL_HH
# define SPOT_TGBAALGOS_DUPEXPL_HH
# include "tgba/tgbaexplicit.hh"
namespace spot
{
/// Build an explicit automata from all states of \a aut, numbering
/// states in bread first order as they are processed.
tgba_explicit* tgba_dupexp_bfs(const tgba* aut);
/// Build an explicit automata from all states of \a aut, numbering
/// states in depth first order as they are processed.
tgba_explicit* tgba_dupexp_dfs(const tgba* aut);
}
#endif // SPOT_TGBAALGOS_DUPEXPL_HH