* 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:
parent
5176caf4d2
commit
7d27fd3796
28 changed files with 3128 additions and 3025 deletions
|
|
@ -30,129 +30,132 @@
|
|||
|
||||
namespace spot
|
||||
{
|
||||
// At some point we'll need to print an acceptance set into LBTT's
|
||||
// format. LBTT expects numbered acceptance sets, so first we'll
|
||||
// number each acceptance condition, and latter when we have to print
|
||||
// them we'll just have to look up each of them.
|
||||
class acceptance_cond_splitter
|
||||
namespace
|
||||
{
|
||||
public:
|
||||
acceptance_cond_splitter(bdd all_acc)
|
||||
// At some point we'll need to print an acceptance set into LBTT's
|
||||
// format. LBTT expects numbered acceptance sets, so first we'll
|
||||
// number each acceptance condition, and latter when we have to print
|
||||
// them we'll just have to look up each of them.
|
||||
class acceptance_cond_splitter
|
||||
{
|
||||
unsigned count = 0;
|
||||
while (all_acc != bddfalse)
|
||||
{
|
||||
bdd acc = bdd_satone(all_acc);
|
||||
all_acc -= acc;
|
||||
sm[acc] = count++;
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
split(std::ostream& os, bdd b)
|
||||
{
|
||||
while (b != bddfalse)
|
||||
{
|
||||
bdd acc = bdd_satone(b);
|
||||
b -= acc;
|
||||
os << sm[acc] << " ";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
unsigned
|
||||
count() const
|
||||
{
|
||||
return sm.size();
|
||||
}
|
||||
|
||||
private:
|
||||
typedef std::map<bdd, unsigned, bdd_less_than> split_map;
|
||||
split_map sm;
|
||||
};
|
||||
|
||||
// Convert a BDD formula to the syntax used by LBTT's transition guards.
|
||||
// Conjunctions are printed by bdd_format_sat, so we just have
|
||||
// to handle the other cases.
|
||||
static std::string
|
||||
bdd_to_lbtt(bdd b, const bdd_dict* d)
|
||||
{
|
||||
if (b == bddfalse)
|
||||
return "f";
|
||||
else if (b == bddtrue)
|
||||
return "t";
|
||||
else
|
||||
public:
|
||||
acceptance_cond_splitter(bdd all_acc)
|
||||
{
|
||||
bdd cube = bdd_satone(b);
|
||||
b -= cube;
|
||||
if (b != bddfalse)
|
||||
unsigned count = 0;
|
||||
while (all_acc != bddfalse)
|
||||
{
|
||||
return "| " + bdd_to_lbtt(b, d) + " " + bdd_to_lbtt(cube, d);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string res = "";
|
||||
for (int count = bdd_nodecount(cube); count > 1; --count)
|
||||
res += "& ";
|
||||
return res + bdd_format_sat(d, cube);
|
||||
bdd acc = bdd_satone(all_acc);
|
||||
all_acc -= acc;
|
||||
sm[acc] = count++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
std::ostream&
|
||||
split(std::ostream& os, bdd b)
|
||||
{
|
||||
while (b != bddfalse)
|
||||
{
|
||||
bdd acc = bdd_satone(b);
|
||||
b -= acc;
|
||||
os << sm[acc] << " ";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
class lbtt_bfs : public tgba_reachable_iterator_breadth_first
|
||||
{
|
||||
public:
|
||||
lbtt_bfs(const tgba* a, std::ostream& os)
|
||||
: tgba_reachable_iterator_breadth_first(a),
|
||||
os_(os),
|
||||
acc_count_(0),
|
||||
acs_(a->all_acceptance_conditions())
|
||||
unsigned
|
||||
count() const
|
||||
{
|
||||
return sm.size();
|
||||
}
|
||||
|
||||
private:
|
||||
typedef std::map<bdd, unsigned, bdd_less_than> split_map;
|
||||
split_map sm;
|
||||
};
|
||||
|
||||
// Convert a BDD formula to the syntax used by LBTT's transition guards.
|
||||
// Conjunctions are printed by bdd_format_sat, so we just have
|
||||
// to handle the other cases.
|
||||
static std::string
|
||||
bdd_to_lbtt(bdd b, const bdd_dict* d)
|
||||
{
|
||||
// Count the number of acceptance_conditions.
|
||||
bdd all = a->all_acceptance_conditions();
|
||||
while (all != bddfalse)
|
||||
{
|
||||
bdd one = bdd_satone(all);
|
||||
all -= one;
|
||||
++acc_count_;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
process_state(const state*, int n, tgba_succ_iterator*)
|
||||
{
|
||||
--n;
|
||||
if (n == 0)
|
||||
body_ << "0 1" << std::endl;
|
||||
if (b == bddfalse)
|
||||
return "f";
|
||||
else if (b == bddtrue)
|
||||
return "t";
|
||||
else
|
||||
body_ << "-1" << std::endl << n << " 0" << std::endl;
|
||||
{
|
||||
bdd cube = bdd_satone(b);
|
||||
b -= cube;
|
||||
if (b != bddfalse)
|
||||
{
|
||||
return "| " + bdd_to_lbtt(b, d) + " " + bdd_to_lbtt(cube, d);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string res = "";
|
||||
for (int count = bdd_nodecount(cube); count > 1; --count)
|
||||
res += "& ";
|
||||
return res + bdd_format_sat(d, cube);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
process_link(int, int out, const tgba_succ_iterator* si)
|
||||
class lbtt_bfs : public tgba_reachable_iterator_breadth_first
|
||||
{
|
||||
body_ << out - 1 << " ";
|
||||
acs_.split(body_, si->current_acceptance_conditions());
|
||||
body_ << "-1 " << bdd_to_lbtt(si->current_condition(),
|
||||
automata_->get_dict()) << std::endl;
|
||||
}
|
||||
public:
|
||||
lbtt_bfs(const tgba* a, std::ostream& os)
|
||||
: tgba_reachable_iterator_breadth_first(a),
|
||||
os_(os),
|
||||
acc_count_(0),
|
||||
acs_(a->all_acceptance_conditions())
|
||||
|
||||
void
|
||||
end()
|
||||
{
|
||||
os_ << seen.size() << " " << acc_count_ << "t" << std::endl
|
||||
<< body_.str() << "-1" << std::endl;
|
||||
}
|
||||
{
|
||||
// Count the number of acceptance_conditions.
|
||||
bdd all = a->all_acceptance_conditions();
|
||||
while (all != bddfalse)
|
||||
{
|
||||
bdd one = bdd_satone(all);
|
||||
all -= one;
|
||||
++acc_count_;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::ostream& os_;
|
||||
std::ostringstream body_;
|
||||
unsigned acc_count_;
|
||||
acceptance_cond_splitter acs_;
|
||||
};
|
||||
void
|
||||
process_state(const state*, int n, tgba_succ_iterator*)
|
||||
{
|
||||
--n;
|
||||
if (n == 0)
|
||||
body_ << "0 1" << std::endl;
|
||||
else
|
||||
body_ << "-1" << std::endl << n << " 0" << std::endl;
|
||||
}
|
||||
|
||||
void
|
||||
process_link(int, int out, const tgba_succ_iterator* si)
|
||||
{
|
||||
body_ << out - 1 << " ";
|
||||
acs_.split(body_, si->current_acceptance_conditions());
|
||||
body_ << "-1 " << bdd_to_lbtt(si->current_condition(),
|
||||
automata_->get_dict()) << std::endl;
|
||||
}
|
||||
|
||||
void
|
||||
end()
|
||||
{
|
||||
os_ << seen.size() << " " << acc_count_ << "t" << std::endl
|
||||
<< body_.str() << "-1" << std::endl;
|
||||
}
|
||||
|
||||
private:
|
||||
std::ostream& os_;
|
||||
std::ostringstream body_;
|
||||
unsigned acc_count_;
|
||||
acceptance_cond_splitter acs_;
|
||||
};
|
||||
|
||||
} // anonymous
|
||||
|
||||
std::ostream&
|
||||
lbtt_reachable(std::ostream& os, const tgba* g)
|
||||
|
|
@ -161,6 +164,4 @@ namespace spot
|
|||
b.run();
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue