X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=cyclegraph.cc;h=be7885c5c1d66a71837f16f07433a913b8c209c1;hb=c8de5897b0c8caaab3a695dd677acd38770e48b3;hp=49ff00249fe9c49dbe9a1cda9fdad32af78c0f70;hpb=0330918c2798a36363a197bf500a5646b048a687;p=model-checker.git diff --git a/cyclegraph.cc b/cyclegraph.cc index 49ff002..be7885c 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -151,7 +151,8 @@ bool CycleGraph::mergeNodes(CycleNode *w_node, CycleNode *p_node, ASSERT(p_node->is_promise()); const Promise *promise = p_node->getPromise(); - if (!promise->is_compatible(w_node->getAction())) { + if (!promise->is_compatible(w_node->getAction()) || + !promise->same_value(w_node->getAction())) { hasCycles = true; return false; } @@ -320,7 +321,7 @@ static void print_node(FILE *file, const CycleNode *node, int label) if (node->is_promise()) { const Promise *promise = node->getPromise(); int idx = model->get_promise_number(promise); - fprintf(file, "P%d", idx); + fprintf(file, "P%u", idx); if (label) { int first = 1; fprintf(file, " [label=\"P%d, T", idx); @@ -350,6 +351,23 @@ static void print_edge(FILE *file, const CycleNode *from, const CycleNode *to, c fprintf(file, ";\n"); } +void CycleGraph::dot_print_node(FILE *file, const ModelAction *act) +{ + print_node(file, getNode(act), 1); +} + +template +void CycleGraph::dot_print_edge(FILE *file, const T *from, const U *to, const char *prop) +{ + CycleNode *fromnode = getNode(from); + CycleNode *tonode = getNode(to); + + print_edge(file, fromnode, tonode, prop); +} +/* Instantiate two forms of CycleGraph::dot_print_edge */ +template void CycleGraph::dot_print_edge(FILE *file, const Promise *from, const ModelAction *to, const char *prop); +template void CycleGraph::dot_print_edge(FILE *file, const ModelAction *from, const ModelAction *to, const char *prop); + void CycleGraph::dumpNodes(FILE *file) const { for (unsigned int i = 0; i < nodeList.size(); i++) {