* 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

@ -29,99 +29,101 @@ namespace spot
{
namespace ltl
{
class dotty_visitor : public const_visitor
namespace
{
public:
typedef Sgi::hash_map<const formula*, int, ptr_hash<formula> > map;
dotty_visitor(std::ostream& os, map& m)
: os_(os), father_(-1), node_(m)
class dotty_visitor: public const_visitor
{
}
public:
typedef Sgi::hash_map<const formula*, int, ptr_hash<formula> > map;
dotty_visitor(std::ostream& os, map& m)
: os_(os), father_(-1), node_(m)
{
}
virtual
~dotty_visitor()
{
}
virtual
~dotty_visitor()
{
}
void
visit(const atomic_prop* ap)
{
draw_node_(ap, ap->name(), true);
}
void
visit(const atomic_prop* ap)
{
draw_node_(ap, ap->name(), true);
}
void
visit(const constant* c)
{
draw_node_(c, c->val_name(), true);
}
void
visit(const constant* c)
{
draw_node_(c, c->val_name(), true);
}
void
visit(const binop* bo)
{
if (draw_node_(bo, bo->op_name()))
{
dotty_visitor v(*this);
bo->first()->accept(v);
bo->second()->accept(*this);
}
}
void
visit(const binop* bo)
{
if (draw_node_(bo, bo->op_name()))
{
dotty_visitor v(*this);
bo->first()->accept(v);
bo->second()->accept(*this);
}
}
void
visit(const unop* uo)
{
if (draw_node_(uo, uo->op_name()))
uo->child()->accept(*this);
}
void
visit(const unop* uo)
{
if (draw_node_(uo, uo->op_name()))
uo->child()->accept(*this);
}
void
visit(const multop* mo)
{
if (!draw_node_(mo, mo->op_name()))
return;
unsigned max = mo->size();
for (unsigned n = 0; n < max; ++n)
{
dotty_visitor v(*this);
mo->nth(n)->accept(v);
}
}
private:
std::ostream& os_;
int father_;
map& node_;
void
visit(const multop* mo)
{
if (!draw_node_(mo, mo->op_name()))
return;
unsigned max = mo->size();
for (unsigned n = 0; n < max; ++n)
{
dotty_visitor v(*this);
mo->nth(n)->accept(v);
}
}
private:
std::ostream& os_;
int father_;
map& node_;
bool
draw_node_(const formula* f, const std::string& str, bool rec = false)
{
map::iterator i = node_.find(f);
int node;
bool node_exists = false;
if (i != node_.end())
{
node = i->second;
node_exists = true;
}
else
{
node = node_.size();
node_[f] = node;
}
// the link
if (father_ >= 0)
os_ << " " << father_ << " -> " << node << ";" << std::endl;
father_ = node;
// the node
if (node_exists)
return false;
os_ << " " << node
<< " [label=\"" << str << "\"";
if (rec)
os_ << ", shape=box";
os_ << "];" << std::endl;
return true;
}
};
bool
draw_node_(const formula* f, const std::string& str, bool rec = false)
{
map::iterator i = node_.find(f);
int node;
bool node_exists = false;
if (i != node_.end())
{
node = i->second;
node_exists = true;
}
else
{
node = node_.size();
node_[f] = node;
}
// the link
if (father_ >= 0)
os_ << " " << father_ << " -> " << node << ";" << std::endl;
father_ = node;
// the node
if (node_exists)
return false;
os_ << " " << node
<< " [label=\"" << str << "\"";
if (rec)
os_ << ", shape=box";
os_ << "];" << std::endl;
return true;
}
};
}
std::ostream&
dotty(std::ostream& os, const formula* f)