]> granicus.if.org Git - graphviz/commitdiff
Cleanup and extend the API in gvc.h
authorellson <devnull@localhost>
Wed, 27 Jul 2005 19:55:28 +0000 (19:55 +0000)
committerellson <devnull@localhost>
Wed, 27 Jul 2005 19:55:28 +0000 (19:55 +0000)
Add #defines to give compile warnings for old API entry points

Update: dot, tcldot, script bindings, and dot.demo/  to use the modified API

cmd/dot/dot.c
dot.demo/demo.c
dot.demo/dot.c

index 7df38a2fdf0e2fb0fa9a68439451c5b0e8d3e284..50abf6093192ceefb4bab4fdaa3e6e16f0e2202a 100644 (file)
@@ -36,8 +36,6 @@
 # include <sys/fpu.h>
 #endif
 
-extern void parse_args(GVC_t * gvc, int argc, char **argv);
-
 char *Info[] = {
     "dot",                     /* Program */
     VERSION,                   /* Version */
@@ -51,9 +49,8 @@ static graph_t * G;
 static void intr(int s)
 {
     if (G)
-       emit_jobs(Gvc, G);
-    dotneato_terminate(Gvc);
-    exit(1);
+       gvRenderJobs(Gvc, G);
+    exit (gvFreeContext(Gvc));
 }
 
 static void fperr(int s)
@@ -138,7 +135,7 @@ int main(int argc, char **argv)
     graph_t *prev = NULL;
 
     Gvc = gvNEWcontext(Info, username());
-    parse_args(Gvc, argc, argv);
+    gvParseArgs(Gvc, argc, argv);
 
 #ifndef MSWIN32
     signal(SIGUSR1, toggle);
@@ -152,8 +149,8 @@ int main(int argc, char **argv)
            G = create_test_graph();
 
            /* Perform layout and cleanup */
-           gvlayout_layout(Gvc, G);
-           gvlayout_cleanup(Gvc, G);
+           gvLayoutJobs(Gvc, G);  /* take layout engine from command line */
+           gvFreeLayout(Gvc, G);
 
            /* Delete graph */
            agclose(G);
@@ -162,14 +159,13 @@ int main(int argc, char **argv)
     } else {
        while ((G = next_input_graph())) {
            if (prev) {
-               gvlayout_cleanup(Gvc, prev);
+               gvFreeLayout(Gvc, prev);
                agclose(prev);
            }
-           gvlayout_layout(Gvc, G);
-           emit_jobs(Gvc, G);
+           gvLayoutJobs(Gvc, G);  /* take layout engine from command line */
+           gvRenderJobs(Gvc, G);
            prev = G;
        }
     }
-    dotneato_terminate(Gvc);
-    return 1;
+    return (gvFreeContext(Gvc));
 }
index 9e46447611a978804736870b932c441084272d26..652c5e3e767894a6e8976945dd36bc4d45f27fe9 100644 (file)
@@ -24,11 +24,11 @@ int main(int argc, char **argv)
     Agsym_t *a;
     GVC_t *gvc;
 
-    /* set up renderer context */
+    /* set up a graphviz context */
     gvc = gvContext();
 
     /* parse command line args - minimally argv[0] sets layout engine */
-    parse_args(gvc, argc, argv);
+    gvParseArgs(gvc, argc, argv);
 
     /* Create a simple digraph */
     g = agopen("g", AGDIGRAPH);
@@ -41,20 +41,18 @@ int main(int argc, char **argv)
        a = agnodeattr(g, "color", "");
     agxset(n, a->index, "red");
 
-    /* Compute a layout */
-    gvlayout_layout(gvc, g);
+    /* Compute a layout using layout engine from command line args */
+    gvLayoutJobs(gvc, g);
 
     /* Write the graph according to -T and -o options */
-    emit_jobs(gvc, g);
+    gvRenderJobs(gvc, g);
 
-    /* Clean out layout data */
-    gvlayout_cleanup(gvc, g);
+    /* Free layout data */
+    gvFreeLayout(gvc, g);
 
     /* Free graph structures */
     agclose(g);
 
-    /* Clean up output file and errors */
-    dotneato_terminate(gvc);
-
-    return 0;
+    /* close output file, free context, and return number of errors */
+    return (gvFreeContext(gvc));
 }
index 9ee3e43eb2750e887a41ea4ff1e252e1c6ed0287..3707f63a743d8237834ec8f7180bc551244aa387 100644 (file)
@@ -22,17 +22,16 @@ int main(int argc, char **argv)
     GVC_t *gvc;
 
     gvc = gvContext();
-    parse_args(gvc, argc, argv);
+    gvParseArgs(gvc, argc, argv);
 
     while ((g = next_input_graph())) {
        if (prev) {
-           gvlayout_cleanup(gvc, prev);
+           gvFreeLayout(gvc, prev);
            agclose(prev);
        }
-       gvlayout_layout(gvc, g);
-       emit_jobs(gvc, g);
+       gvLayoutJobs(gvc, g);
+       gvRenderJobs(gvc, g);
        prev = g;
     }
-    dotneato_terminate(gvc);
-    return 0;
+    return (gvFreeContext(gvc));
 }