Opened 20 years ago

Closed 19 years ago

#139 closed Bugs (Fixed)

read_graphviz

Reported by: nobody Owned by: jsiek
Milestone: Component: graph
Version: None Severity:
Keywords: Cc:

Description

When a dot file contains "graph" attributes (a=b):

digraph G {
	graph [a=b];
	a [c=d];
}

The parser will croak the _second_ time it is called:

  using namespace boost;
  GraphvizDigraph g_dot, g_dot2, g_dot3;
  read_graphviz("tmp.dot", g_dot);
  read_graphviz("tmp.dot", g_dot2); //kaboom


Gordon.
schmoo@oceanfree.net

PS. A "real" dot file that this happens with:

digraph G {
	node [label="\N", shape=box];
	graph [bb="0,0,54,124"];
	0 [label=One, pos="27,98", width="0.75", 
height="0.50"];
	1 [label=Two, pos="27,26", width="0.75", 
height="0.50"];
	0 -> 1 [pos="e,27,44 27,80 27,72 27,63 
27,54"];
}






Change History (2)

comment:1 by nobody, 19 years ago

Logged In: NO 

It seems that a static variable must be reinitialized. 

***************
    void read_graphviz(const std::string& filename,
GRAPHVIZ_GRAPH& g) {
      FILE* file = fopen(filename.c_str(), "r");
      bgl_dir_restart(file);
      void* in = static_cast<void*>(file);
+     if(1){//for debug
+       using namespace graphviz;
+      
std::cerr<<current_vertex<<","<<current_edge<<","<<current_graph
+      
<<","<<previous_graph<<","<<vlist.size()<<","<<attributes.size()<<","
+      
<<attribute_state<<","<<subgraphs.size()<<","<<nodes.size()<<"\n";
+     }
+     graphviz::nodes.clear(); //a hasty fix
      yyparse(static_cast<void*>(&g));
    }

comment:2 by Vladimir Prus, 19 years ago

Status: assignedclosed
Logged In: YES 
user_id=321498

Should be fixed now. 
Note: See TracTickets for help on using tickets.