From: John Ellson Date: Fri, 15 Feb 2013 22:01:46 +0000 (-0500) Subject: partial fixes for multiple layouts in tcldot X-Git-Tag: LAST_LIBGRAPH~32^2~229 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=611143f203d6c71ba7e5cf2843f8dd68dfa07ac8;p=graphviz partial fixes for multiple layouts in tcldot --- diff --git a/cmd/dot/dot.c b/cmd/dot/dot.c index bd07325c8..1e23ab423 100644 --- a/cmd/dot/dot.c +++ b/cmd/dot/dot.c @@ -125,6 +125,7 @@ static graph_t *create_test_graph(void) #define NUMNODES 5 Agnode_t *node[NUMNODES]; + Agedge_t *e; Agraph_t *g; Agraph_t *sg; int j, k; @@ -147,7 +148,6 @@ static graph_t *create_test_graph(void) #else /* WITH_CGRAPH */ node[j] = agnode(g, name, 1); agbindrec(node[j], "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); //node custom data - #endif /* WITH_CGRAPH */ } @@ -157,7 +157,8 @@ static graph_t *create_test_graph(void) #ifndef WITH_CGRAPH agedge(g, node[j], node[k]); #else /* WITH_CGRAPH */ - agedge(g, node[j], node[k], NULL, 1); + e = agedge(g, node[j], node[k], NULL, 1); + agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); //edge custom data #endif /* WITH_CGRAPH */ } } @@ -177,8 +178,6 @@ int main(int argc, char **argv) { graph_t *prev = NULL; int r, rc = 0; -#ifndef WITH_CGRAPH -#endif /* WITH_CGRAPH */ Gvc = gvContextPlugins(lt_preloaded_symbols, DEMAND_LOADING); GvExitOnUsage = 1; @@ -209,10 +208,6 @@ int main(int argc, char **argv) } else { while ((G = gvNextInputGraph(Gvc))) { -#ifdef WITH_CGRAPH - - -#endif /* WITH_CGRAPH */ if (prev) { gvFreeLayout(Gvc, prev); agclose(prev); @@ -226,7 +221,6 @@ int main(int argc, char **argv) } gvFinalize(Gvc); - r = gvFreeContext(Gvc); return (MAX(rc,r)); } diff --git a/lib/dotgen/dotinit.c b/lib/dotgen/dotinit.c index c262503d5..0bdd02840 100644 --- a/lib/dotgen/dotinit.c +++ b/lib/dotgen/dotinit.c @@ -190,10 +190,11 @@ dot_cleanup_graph(graph_t * g) else free(GD_rank(g)); } - if (g != agroot(g)) #ifndef WITH_CGRAPH + if (g != agroot(g)) memset(&(g->u), 0, sizeof(Agraphinfo_t)); #else /* WITH_CGRAPH */ + if (g != agroot(g)) agdelrec(g,"Agraphinfo_t"); #endif /* WITH_CGRAPH */ } diff --git a/tclpkg/tcldot/tcldot-graphcmd.c b/tclpkg/tcldot/tcldot-graphcmd.c index a6dec6d10..6af696fc9 100644 --- a/tclpkg/tcldot/tcldot-graphcmd.c +++ b/tclpkg/tcldot/tcldot-graphcmd.c @@ -117,6 +117,7 @@ int graphcmd(ClientData clientData, Tcl_Interp * interp, } #ifndef WITH_CGRAPH e = agedge(g, tail, head); + agbindrec(ce, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); #else e = agedge(g, tail, head, NULL, 1); Tcl_AppendResult(interp, obj2cmd(e), NULL); @@ -146,6 +147,7 @@ int graphcmd(ClientData clientData, Tcl_Interp * interp, /* if odd number of args then argv[2] is name */ #ifdef WITH_CGRAPH n = agnode(g, argv[2], 1); + agbindrec(n, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); #else n = agnode(g, argv[2]); if (!(np = (Agnode_t **) tclhandleXlateIndex(ictx->nodeTblPtr, AGID(n))) || *np != n) { @@ -167,6 +169,7 @@ int graphcmd(ClientData clientData, Tcl_Interp * interp, } else { #ifdef WITH_CGRAPH n = agnode(g, NULL, 1); /* anon node */ + agbindrec(n, "Agnodeinfo_t", sizeof(Agnodeinfo_t), TRUE); #else /* else use handle as name */ np = (Agnode_t **) tclhandleAlloc(ictx->nodeTblPtr, Tcl_GetStringResult(interp), &id); diff --git a/tclpkg/tcldot/tcldot-nodecmd.c b/tclpkg/tcldot/tcldot-nodecmd.c index 0199d95f6..aa9820f9c 100644 --- a/tclpkg/tcldot/tcldot-nodecmd.c +++ b/tclpkg/tcldot/tcldot-nodecmd.c @@ -91,6 +91,7 @@ int nodecmd(ClientData clientData, Tcl_Interp * interp, } #ifdef WITH_CGRAPH e = agedge(g, n, head, NULL, 1); + agbindrec(e, "Agedgeinfo_t", sizeof(Agedgeinfo_t), TRUE); Tcl_AppendResult(interp, obj2cmd(e), NULL); #else e = agedge(g, n, head);