X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=cyclegraph.cc;h=aa3d24548a554ab039074282f5bab3246e3d3ccd;hb=bbc3405aa23e6eafb3863738c4e203764694e9a4;hp=ae80fcf8fda2b4b2d8f04dcc9cbc13a40ef72359;hpb=f01c21655bce58ff70b0e8936f2579a7beeafad4;p=model-checker.git diff --git a/cyclegraph.cc b/cyclegraph.cc index ae80fcf..aa3d245 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -122,11 +122,7 @@ void CycleGraph::addRMWEdge(const ModelAction *from, const ModelAction *rmw) { } #if SUPPORT_MOD_ORDER_DUMP -void CycleGraph::dumpGraphToFile(const char *filename) { - char buffer[200]; - sprintf(buffer, "%s.dot",filename); - FILE *file=fopen(buffer, "w"); - fprintf(file, "digraph %s {\n",filename); +void CycleGraph::dumpNodes(FILE *file) { for(unsigned int i=0;i * edges=cn->getEdges(); @@ -141,6 +137,14 @@ void CycleGraph::dumpGraphToFile(const char *filename) { fprintf(file, "N%u -> N%u;\n", action->get_seq_number(), dstaction->get_seq_number()); } } +} + +void CycleGraph::dumpGraphToFile(const char *filename) { + char buffer[200]; + sprintf(buffer, "%s.dot",filename); + FILE *file=fopen(buffer, "w"); + fprintf(file, "digraph %s {\n",filename); + dumpNodes(file); fprintf(file,"}\n"); fclose(file); } @@ -169,8 +173,8 @@ bool CycleGraph::checkReachable(const ModelAction *from, const ModelAction *to) * @return True, @a from can reach @a to; otherwise, false */ bool CycleGraph::checkReachable(CycleNode *from, CycleNode *to) { - std::vector > queue; - HashTable discovered; + std::vector > queue; + HashTable discovered; queue.push_back(from); discovered.put(from, from);