]> granicus.if.org Git - graphviz/commitdiff
validate -T before possibly hanging on stdin.
authorellson <devnull@localhost>
Wed, 5 Jan 2005 20:03:59 +0000 (20:03 +0000)
committerellson <devnull@localhost>
Wed, 5 Jan 2005 20:03:59 +0000 (20:03 +0000)
various fixes to configure --disable-gvrender

cmd/tools/Makefile.am
lib/common/emit.c
lib/common/globals.h
lib/common/input.c
lib/common/renderprocs.h
lib/common/utils.c
lib/gvc/gvjobs.c
lib/gvc/gvrender.h

index c5eee713eb01a6a530f170a03ba6db0e1e841bdd..b7e4f14101dc28960a066689e62a808ed574a645 100644 (file)
@@ -90,6 +90,15 @@ gc_LDADD = \
 
 gvpack_SOURCES = gvpack.c plugins.c
 
+if DISABLE_GVRENDER
+gvpack_LDADD = \
+       $(top_builddir)/lib/ingraphs/libingraphs.la \
+       $(top_builddir)/lib/neatogen/libneatogen.la \
+       $(top_builddir)/lib/pack/libpack.la \
+       $(top_builddir)/lib/common/libcommon.la \
+       $(top_builddir)/lib/gvc/libgvc.la \
+       $(top_builddir)/lib/pathplan/libpathplan.la
+else
 gvpack_LDADD = \
        $(top_builddir)/lib/ingraphs/libingraphs.la \
        $(top_builddir)/lib/neatogen/libneatogen.la \
@@ -101,6 +110,7 @@ gvpack_LDADD = \
         $(top_builddir)/plugin/gd/libgvplugin_gd.la \
         $(top_builddir)/plugin/text/libgvplugin_text.la \
         $(top_builddir)/plugin/layout/libgvplugin_layout.la @CAIRO_LIBS@
+endif
 
 
 dijkstra_SOURCES = dijkstra.c
index 1872ef0c347bf4daa0515d429d40b7bdeff51502..0034dd6e954260b2734c924661bd645da045d9c0 100644 (file)
@@ -1305,7 +1305,6 @@ static codegen_info_t cg[MAX_CODEGENS] = {
     {&MIF_CodeGen, "mif", MIF},
     {&PIC_CodeGen, "pic", PIC_format},
 
-#ifdef GD_RENDER
     {&GD_CodeGen, "gd", GD},
 #ifdef HAVE_LIBZ
     {&GD_CodeGen, "gd2", GD2},
@@ -1326,7 +1325,6 @@ static codegen_info_t cg[MAX_CODEGENS] = {
     {&GD_CodeGen, "xbm", XBM},
     {&GD_CodeGen, "xpm", XBM},
 #endif
-#endif                         /* GD_RENDER */
 
 #ifdef QUARTZ_RENDER
     {&QPDF_CodeGen, "pdf", QPDF},
index 3d1c9e05aab2344be3c5c959359e87cbe249bd12..c14ce5914ebcbfe9cfac2c581f37044e32dbc272 100644 (file)
@@ -64,14 +64,10 @@ extern "C" {
     external FILE *Output_file;
     external int Obj;
 
-    extern codegen_t FIG_CodeGen, HPGL_CodeGen,
-       MAP_CodeGen, MIF_CodeGen,
-       XDot_CodeGen, MP_CodeGen, PIC_CodeGen, PS_CodeGen,
-       DIA_CodeGen, SVG_CodeGen, VRML_CodeGen, VTX_CodeGen;
-
-#ifdef GD_RENDER
-    extern codegen_t GD_CodeGen, memGD_CodeGen;
-#endif
+    extern codegen_t FIG_CodeGen, HPGL_CodeGen, MAP_CodeGen,
+       MIF_CodeGen, XDot_CodeGen, MP_CodeGen, PIC_CodeGen,
+       PS_CodeGen, DIA_CodeGen, SVG_CodeGen, VRML_CodeGen,
+       VTX_CodeGen, GD_CodeGen, memGD_CodeGen;
 #ifdef QUARTZ_RENDER
     extern codegen_t QPDF_CodeGen, QEPDF_CodeGen, QBM_CodeGen;
 #endif
index 794e470cab15f550d9fc903926655b8a87fad19d..be82902a0c107a6b7306424213f528360b7f1202 100644 (file)
@@ -139,6 +139,11 @@ void dotneato_initialize(GVC_t * gvc, int argc, char **argv)
     /* establish Gvfilepath, if any */
     Gvfilepath = getenv("GV_FILE_PATH");
 
+    /* configure codegens */
+    config_codegen_builtins(gvc);
+    gvplugin_builtins(gvc);
+    gvconfig(gvc, CONFIG);
+
     aginit();
     nfiles = 0;
     for (i = 1; i < argc; i++)
@@ -181,8 +186,14 @@ void dotneato_initialize(GVC_t * gvc, int argc, char **argv)
                if (!val) {
                    fprintf(stderr, "Missing argument for -T flag\n");
                    dotneato_usage(1);
+                   exit(1);
+               }
+               v = gvrender_output_langname_job(gvc, val);
+               if (v == NO_SUPPORT) {
+                   fprintf(stderr, "Renderer type: \"%s\" not recognized. Use one of:%s\n",
+                       val, gvplugin_list(gvc, API_render, val));
+                   exit(1);
                }
-               gvrender_output_langname_job(gvc, val);
                break;
            case 'V':
                fprintf(stderr, "%s version %s (%s)\n",
@@ -264,13 +275,10 @@ void dotneato_initialize(GVC_t * gvc, int argc, char **argv)
 
     /* if no -Txxx, then set default format */
     if (!gvc->jobs || !gvc->jobs->output_langname) {
-       gvrender_output_langname_job(gvc, "dot");
+       v = gvrender_output_langname_job(gvc, "dot");
+       assert(v != NO_SUPPORT);
     }
 
-    config_codegen_builtins(gvc);
-    gvplugin_builtins(gvc);
-    gvconfig(gvc, CONFIG);
-
 #if !defined(DISABLE_CODEGENS) && !defined(HAVE_GD_FREETYPE)
     Output_codegen = gvc->codegen;
 #endif
@@ -328,7 +336,7 @@ void getdouble(graph_t * g, char *name, double *result)
     }
 }
 
-FILE *next_input_file(void)
+static FILE *next_input_file(void)
 {
     static int ctr = 0;
     FILE *rv = NULL;
index 7259be7db375010e5e93d7ae2ba440f72f76206e..f6210618008c74ed0c62f2eb575f8079ccb56e13 100644 (file)
@@ -145,7 +145,6 @@ extern "C" {
     extern point neato_closest(splines * spl, point p);
     extern bezier *new_spline(edge_t * e, int sz);
     extern queue *new_queue(int);
-    extern FILE *next_input_file(void);
     extern Agraph_t *next_input_graph(void);
     extern int node_in_CB(node_t *);
     extern int node_in_layer(Agraph_t *, node_t *);
index 02679c998a2e23da7d8c1874e2ba41e91ea9f8b2..b84419f7296b9281516e8589bf3c36ee0ecd6141 100644 (file)
@@ -1038,7 +1038,6 @@ point user_shape_size(node_t * n, char *shapefile)
        suffix = shapefile;
     else
        suffix++;
-#ifdef GD_RENDER
     if (!strcasecmp(suffix, "wbmp")
 #ifdef HAVE_GD_GIF
        || !strcasecmp(suffix, "gif")
@@ -1056,7 +1055,6 @@ point user_shape_size(node_t * n, char *shapefile)
        ) {
        rv = gd_user_shape_size(n, shapefile);
     } else
-#endif
 #ifdef QUARTZ_RENDER
     if (Output_lang == QPDF || Output_lang == QEPDF ||
            (Output_lang >= QBM_FIRST && Output_lang <= QBM_LAST))
@@ -1099,7 +1097,6 @@ point image_size(graph_t * g, char *shapefile)
        suffix = shapefile;
     else
        suffix++;
-#ifdef GD_RENDER
     if (!strcasecmp(suffix, "wbmp")
 #ifdef HAVE_GD_GIF
        || !strcasecmp(suffix, "gif")
@@ -1117,7 +1114,6 @@ point image_size(graph_t * g, char *shapefile)
        ) {
        rv = gd_image_size(g, shapefile);
     } else
-#endif
 #ifdef QUARTZ_RENDER
     if (Output_lang == QPDF || Output_lang == QEPDF ||
            (Output_lang >= QBM_FIRST && Output_lang <= QBM_LAST))
index 1915979a05ef08beec4a17973b25cf50ba7e61df..6b1f87a2feff00c042ea2938f6a09c8d18c7a87e 100644 (file)
@@ -67,7 +67,7 @@ void gvrender_output_filename_job(GVC_t * gvc, char *name)
 }
 
 /* -T switches */
-void gvrender_output_langname_job(GVC_t * gvc, char *name)
+int gvrender_output_langname_job(GVC_t * gvc, char *name)
 {
     if (!gvc->jobs) {
        output_langname_job = gvc->job = gvc->jobs =
@@ -84,6 +84,9 @@ void gvrender_output_langname_job(GVC_t * gvc, char *name)
        }
     }
     output_langname_job->output_langname = name;
+
+    /* select it now to check that it exists */
+    return (gvrender_select(gvc, name));
 }
 
 #if 0
index f5587355f7d0ca99dfce109c8a832b3739235226..7f27f1f1c527291c7636a1aba22ef64040ffe12b 100644 (file)
@@ -48,7 +48,7 @@ extern "C" {
 /* job */
 
     extern void gvrender_output_filename_job(GVC_t * gvc, char *name);
-    extern void gvrender_output_langname_job(GVC_t * gvc, char *name);
+    extern int gvrender_output_langname_job(GVC_t * gvc, char *name);
     extern gvrender_job_t *gvrender_first_job(GVC_t * gvc);
     extern gvrender_job_t *gvrender_next_job(GVC_t * gvc);
     extern void gvrender_delete_jobs(GVC_t * gvc);