* iface/gspn/gspn.cc, src/ltlvisit/basicreduce.cc,

src/ltlvisit/destroy.cc, src/ltlvisit/dotty.cc,
src/ltlvisit/dump.cc, src/ltlvisit/length.cc,
src/ltlvisit/nenoform.cc, src/ltlvisit/reduce.cc,
src/ltlvisit/syntimpl.cc, src/ltlvisit/tostring.cc,
src/tgba/formula2bdd.cc, src/tgba/tgbabddconcreteproduct.cc,
src/tgba/tgbatba.cc, src/tgbaalgos/dotty.cc,
src/tgbaalgos/dupexp.cc, src/tgbaalgos/lbtt.cc,
src/tgbaalgos/ltl2tgba_lacim.cc, src/tgbaalgos/neverclaim.cc,
src/tgbaalgos/save.cc, src/tgbaalgos/stats.cc,
src/tgbaalgos/gtec/nsheap.cc, src/tgbaalgos/gtec/nsheap.hh:
Declare private classes and helper function in anonymous namespaces.
* HACKING, src/sanity/style.test: Document and check this.
Also check for trailing { after namespace or class.
* src/ltlast/predecl.hh, src/ltlast/visitor.hh,
src/tgba/tgbareduc.hh: Fix trailing {.
This commit is contained in:
Alexandre Duret-Lutz 2004-10-18 13:56:31 +00:00
parent 5176caf4d2
commit 7d27fd3796
28 changed files with 3128 additions and 3025 deletions

View file

@ -32,153 +32,155 @@
namespace spot
{
class never_claim_bfs : public tgba_reachable_iterator_breadth_first
namespace
{
public:
never_claim_bfs(const tgba_tba_proxy* a, std::ostream& os,
const ltl::formula* f)
: tgba_reachable_iterator_breadth_first(a),
os_(os), f_(f), accept_all_(-1), fi_needed_(false)
class never_claim_bfs : public tgba_reachable_iterator_breadth_first
{
}
public:
never_claim_bfs(const tgba_tba_proxy* a, std::ostream& os,
const ltl::formula* f)
: tgba_reachable_iterator_breadth_first(a),
os_(os), f_(f), accept_all_(-1), fi_needed_(false)
{
}
void
start()
{
os_ << "never {";
if (f_)
{
os_ << " /* ";
to_string(f_, os_);
os_ << " */";
}
os_ << std::endl;
init_ = automata_->get_init_state();
}
void
start()
{
os_ << "never {";
if (f_)
{
os_ << " /* ";
to_string(f_, os_);
os_ << " */";
}
os_ << std::endl;
init_ = automata_->get_init_state();
}
void
end()
{
if (fi_needed_)
os_ << " fi;" << std::endl;
if (accept_all_ != -1)
{
os_ << "accept_all:" << std::endl;
os_ << " skip" << std::endl;
}
os_ << "}" << std::endl;
delete init_;
}
void
end()
{
if (fi_needed_)
os_ << " fi;" << std::endl;
if (accept_all_ != -1)
{
os_ << "accept_all:" << std::endl;
os_ << " skip" << std::endl;
}
os_ << "}" << std::endl;
delete init_;
}
bool
state_is_accepting(const state *s)
{
return
dynamic_cast<const tgba_tba_proxy*>(automata_)->state_is_accepting(s);
}
bool
state_is_accepting(const state *s)
{
return
dynamic_cast<const tgba_tba_proxy*>(automata_)->state_is_accepting(s);
}
std::string
get_state_label(const state* s, int n)
{
std::string label;
if (s->compare(init_) == 0)
if (state_is_accepting(s))
label = "accept_init";
else
label = "T0_init";
else
{
std::ostringstream ost;
ost << n;
std::string ns(ost.str());
std::string
get_state_label(const state* s, int n)
{
std::string label;
if (s->compare(init_) == 0)
if (state_is_accepting(s))
label = "accept_init";
else
label = "T0_init";
else
{
std::ostringstream ost;
ost << n;
std::string ns(ost.str());
if (state_is_accepting(s))
{
tgba_succ_iterator* it = automata_->succ_iter(s);
it->first();
if (it->done())
label = "accept_S" + ns;
else
{
state* current = it->current_state();
if (it->current_condition() != bddtrue
|| s->compare(current) != 0)
label = "accept_S" + ns;
else
label = "accept_all";
delete current;
}
delete it;
}
else
label = "T0_S" + ns;
}
return label;
}
if (state_is_accepting(s))
{
tgba_succ_iterator* it = automata_->succ_iter(s);
it->first();
if (it->done())
label = "accept_S" + ns;
else
{
state* current = it->current_state();
if (it->current_condition() != bddtrue
|| s->compare(current) != 0)
label = "accept_S" + ns;
else
label = "accept_all";
delete current;
}
delete it;
}
else
label = "T0_S" + ns;
}
return label;
}
void
process_state(const state* s, int n, tgba_succ_iterator*)
{
tgba_succ_iterator* it = automata_->succ_iter(s);
it->first();
if (it->done())
{
if (fi_needed_ != 0)
os_ << " fi;" << std::endl;
os_ << get_state_label(s, n) << ": ";
os_ << "/* " << automata_->format_state(s) << " */";
os_ << std::endl;
os_ << " if" << std::endl;
os_ << " :: (0) -> goto " << get_state_label(s, n) << std::endl;
fi_needed_ = true;
}
else
{
state* current =it->current_state();
if (state_is_accepting(s)
&& it->current_condition() == bddtrue
&& s->compare(init_) != 0
&& s->compare(current) == 0)
accept_all_ = n;
else
{
if (fi_needed_)
os_ << " fi;" << std::endl;
os_ << get_state_label(s, n) << ": ";
os_ << "/* " << automata_->format_state(s) << " */";
os_ << std::endl;
os_ << " if" << std::endl;
fi_needed_ = true;
}
delete current;
}
delete it;
}
void
process_state(const state* s, int n, tgba_succ_iterator*)
{
tgba_succ_iterator* it = automata_->succ_iter(s);
it->first();
if (it->done())
{
if (fi_needed_ != 0)
os_ << " fi;" << std::endl;
os_ << get_state_label(s, n) << ": ";
os_ << "/* " << automata_->format_state(s) << " */";
os_ << std::endl;
os_ << " if" << std::endl;
os_ << " :: (0) -> goto " << get_state_label(s, n) << std::endl;
fi_needed_ = true;
}
else
{
state* current =it->current_state();
if (state_is_accepting(s)
&& it->current_condition() == bddtrue
&& s->compare(init_) != 0
&& s->compare(current) == 0)
accept_all_ = n;
else
{
if (fi_needed_)
os_ << " fi;" << std::endl;
os_ << get_state_label(s, n) << ": ";
os_ << "/* " << automata_->format_state(s) << " */";
os_ << std::endl;
os_ << " if" << std::endl;
fi_needed_ = true;
}
delete current;
}
delete it;
}
void
process_link(int in, int out, const tgba_succ_iterator* si)
{
if (in != accept_all_)
{
os_ << " :: (";
const ltl::formula* f = bdd_to_formula(si->current_condition(),
automata_->get_dict());
to_spin_string(f, os_);
destroy(f);
state* current = si->current_state();
os_ << ") -> goto " << get_state_label(current, out) << std::endl;
delete current;
}
}
void
process_link(int in, int out, const tgba_succ_iterator* si)
{
if (in != accept_all_)
{
os_ << " :: (";
const ltl::formula* f = bdd_to_formula(si->current_condition(),
automata_->get_dict());
to_spin_string(f, os_);
destroy(f);
state* current = si->current_state();
os_ << ") -> goto " << get_state_label(current, out) << std::endl;
delete current;
}
}
private:
std::ostream& os_;
const ltl::formula* f_;
int accept_all_;
bool fi_needed_;
state* init_;
};
private:
std::ostream& os_;
const ltl::formula* f_;
int accept_all_;
bool fi_needed_;
state* init_;
};
} // anonymous
std::ostream&
never_claim_reachable(std::ostream& os, const tgba_tba_proxy* g,