mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-01 16:31:13 +00:00
Break up the GraphWriter into smaller chunks to be used in different ways
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4207 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a16adb7dd2
commit
dc05fffe2b
@ -59,8 +59,9 @@ class GraphWriter {
|
|||||||
typedef typename GTraits::nodes_iterator node_iterator;
|
typedef typename GTraits::nodes_iterator node_iterator;
|
||||||
typedef typename GTraits::ChildIteratorType child_iterator;
|
typedef typename GTraits::ChildIteratorType child_iterator;
|
||||||
public:
|
public:
|
||||||
GraphWriter(std::ostream &o, const GraphType &g,
|
GraphWriter(std::ostream &o, const GraphType &g) : O(o), G(g) {}
|
||||||
const std::string &Name) : O(o), G(g) {
|
|
||||||
|
void writeHeader(const std::string &Name) {
|
||||||
if (Name.empty())
|
if (Name.empty())
|
||||||
O << "digraph foo {\n"; // Graph name doesn't matter
|
O << "digraph foo {\n"; // Graph name doesn't matter
|
||||||
else
|
else
|
||||||
@ -71,15 +72,9 @@ public:
|
|||||||
O << "\tlabel=\"" << DOT::EscapeString(GraphName) << "\";\n";
|
O << "\tlabel=\"" << DOT::EscapeString(GraphName) << "\";\n";
|
||||||
O << DOTTraits::getGraphProperties(G);
|
O << DOTTraits::getGraphProperties(G);
|
||||||
O << "\n";
|
O << "\n";
|
||||||
|
|
||||||
// Emit all of the nodes in the graph...
|
|
||||||
writeNodes();
|
|
||||||
|
|
||||||
// Output any customizations on the graph
|
|
||||||
DOTTraits::addCustomGraphFeatures(G, *this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~GraphWriter() {
|
void writeFooter() {
|
||||||
// Finish off the graph
|
// Finish off the graph
|
||||||
O << "}\n";
|
O << "}\n";
|
||||||
}
|
}
|
||||||
@ -180,7 +175,19 @@ template<typename GraphType>
|
|||||||
std::ostream &WriteGraph(std::ostream &O, const GraphType &G,
|
std::ostream &WriteGraph(std::ostream &O, const GraphType &G,
|
||||||
const std::string &Name = "") {
|
const std::string &Name = "") {
|
||||||
// Start the graph emission process...
|
// Start the graph emission process...
|
||||||
GraphWriter<GraphType> W(O, G, Name);
|
GraphWriter<GraphType> W(O, G);
|
||||||
|
|
||||||
|
// Output the header for the graph...
|
||||||
|
W.writeHeader(Name);
|
||||||
|
|
||||||
|
// Emit all of the nodes in the graph...
|
||||||
|
W.writeNodes();
|
||||||
|
|
||||||
|
// Output any customizations on the graph
|
||||||
|
DOTGraphTraits<GraphType>::addCustomGraphFeatures(G, W);
|
||||||
|
|
||||||
|
// Output the end of the graph
|
||||||
|
W.writeFooter();
|
||||||
return O;
|
return O;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,8 +59,9 @@ class GraphWriter {
|
|||||||
typedef typename GTraits::nodes_iterator node_iterator;
|
typedef typename GTraits::nodes_iterator node_iterator;
|
||||||
typedef typename GTraits::ChildIteratorType child_iterator;
|
typedef typename GTraits::ChildIteratorType child_iterator;
|
||||||
public:
|
public:
|
||||||
GraphWriter(std::ostream &o, const GraphType &g,
|
GraphWriter(std::ostream &o, const GraphType &g) : O(o), G(g) {}
|
||||||
const std::string &Name) : O(o), G(g) {
|
|
||||||
|
void writeHeader(const std::string &Name) {
|
||||||
if (Name.empty())
|
if (Name.empty())
|
||||||
O << "digraph foo {\n"; // Graph name doesn't matter
|
O << "digraph foo {\n"; // Graph name doesn't matter
|
||||||
else
|
else
|
||||||
@ -71,15 +72,9 @@ public:
|
|||||||
O << "\tlabel=\"" << DOT::EscapeString(GraphName) << "\";\n";
|
O << "\tlabel=\"" << DOT::EscapeString(GraphName) << "\";\n";
|
||||||
O << DOTTraits::getGraphProperties(G);
|
O << DOTTraits::getGraphProperties(G);
|
||||||
O << "\n";
|
O << "\n";
|
||||||
|
|
||||||
// Emit all of the nodes in the graph...
|
|
||||||
writeNodes();
|
|
||||||
|
|
||||||
// Output any customizations on the graph
|
|
||||||
DOTTraits::addCustomGraphFeatures(G, *this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~GraphWriter() {
|
void writeFooter() {
|
||||||
// Finish off the graph
|
// Finish off the graph
|
||||||
O << "}\n";
|
O << "}\n";
|
||||||
}
|
}
|
||||||
@ -180,7 +175,19 @@ template<typename GraphType>
|
|||||||
std::ostream &WriteGraph(std::ostream &O, const GraphType &G,
|
std::ostream &WriteGraph(std::ostream &O, const GraphType &G,
|
||||||
const std::string &Name = "") {
|
const std::string &Name = "") {
|
||||||
// Start the graph emission process...
|
// Start the graph emission process...
|
||||||
GraphWriter<GraphType> W(O, G, Name);
|
GraphWriter<GraphType> W(O, G);
|
||||||
|
|
||||||
|
// Output the header for the graph...
|
||||||
|
W.writeHeader(Name);
|
||||||
|
|
||||||
|
// Emit all of the nodes in the graph...
|
||||||
|
W.writeNodes();
|
||||||
|
|
||||||
|
// Output any customizations on the graph
|
||||||
|
DOTGraphTraits<GraphType>::addCustomGraphFeatures(G, W);
|
||||||
|
|
||||||
|
// Output the end of the graph
|
||||||
|
W.writeFooter();
|
||||||
return O;
|
return O;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user