The failure to call agerror() a second time can produce two results:
The source below will reproduce this error:
#include <stdio.h>
#include <agraph.h>
int main()
{
FILE* file = fopen("error.dot", "r");
Agraph_t *dotGraph = 0;
dotGraph = agread(file, 0);
printf("the first read is complete.\n");
dotGraph = agread(file, (Agdisc_t*)NULL);
printf("the second read is complete.\n");
return 0;
}
void agerror(int code, char *str)
{
printf("my agerror : error code %d : %s\n", code, str);
}
Input:
digraph G {
subgraph cluster_c0 {a0 -> a1 -> a2 -> a3;}
subgraph cluster_c1 {b0 -
Comments:
The dot input causing the bug is a truncated version of the cluster1.dot shipped with graphviz-1.8.10.
I chose an arbitrary place to truncate it.
The same behavior is shown with files that have some pretty ugly syntax errors.
Fix:
Sorry, I don't have a fix, but $SRC_DIR/agraph/grammar.c lines 979-1028
appear to be the ones failing to call agerror() the seoncd time. Maybe
that'll help a little bit?
[erg] This is not a bug, but is part of the I/O and parsing model of the
library and stdio.
Owner: erg
Status: Fixed (18 December 2002)