]> granicus.if.org Git - graphviz/commitdiff
Lasi plugin compiles and loads, but doesn't do anything useful.
authorellson <devnull@localhost>
Tue, 2 Sep 2008 16:32:17 +0000 (16:32 +0000)
committerellson <devnull@localhost>
Tue, 2 Sep 2008 16:32:17 +0000 (16:32 +0000)
Various const'ification to make g++ happy.

lib/gvc/gvcint.h
lib/gvc/gvcjob.h
lib/gvc/gvconfig.c
lib/gvc/gvcproc.h
lib/gvc/gvloadimage.c
lib/gvc/gvplugin.c
lib/gvc/gvplugin.h
plugin/lasi/Makefile.am
plugin/lasi/gvplugin_lasi.c
plugin/lasi/gvrender_lasi.cpp [moved from plugin/lasi/gvrender_lasi.c with 76% similarity]

index 271112142af0f714a48d1d69e0aeb3f78bd5335e..f6caf959f99cf69b84ddf02142cb7adace6f7ac0 100644 (file)
@@ -31,7 +31,7 @@ extern "C" {
         gvlayout_engine_t *engine;
         int id;
         gvlayout_features_t *features;
-        char *type;
+        const char *type;
     } gvplugin_active_layout_t;
 
     typedef struct gvplugin_active_textlayout_s {
@@ -42,7 +42,7 @@ extern "C" {
 
     struct gvplugin_available_s {
        gvplugin_available_t *next;       /* next plugin in linked list, or NULL */
-       char *typestr;           /* type string, e.g. "png" or "ps" */
+       const char *typestr;             /* type string, e.g. "png" or "ps" */
        int quality;             /* programmer assigned quality
                                        ranking within type (+ve or -ve int)
                                        - codegens have quality = 0 */
index 5691d678aa96e2c267c2999ce0548c879c95da6f..80476d19d29654951e2361480bbb23e20c8bf478 100644 (file)
@@ -132,20 +132,20 @@ extern "C" {
         gvdevice_engine_t *engine;
         int id;
         gvdevice_features_t *features;
-        char *type;
+        const char *type;
     } gvplugin_active_device_t;
 
     typedef struct gvplugin_active_render_s {
         gvrender_engine_t *engine;
         int id;
         gvrender_features_t *features;
-        char *type;
+        const char *type;
     } gvplugin_active_render_t;
 
     typedef struct gvplugin_active_loadimage_t {
        gvloadimage_engine_t *engine;
        int id;
-       char *type;
+       const char *type;
     } gvplugin_active_loadimage_t;
 
     typedef struct gv_argvlist_s {
index 1bfca3bc524c780342cc3b180baf0183df015365..21223ffbf2eebceeb99c1e695e044cefca7467d4 100644 (file)
@@ -162,7 +162,8 @@ static char *token(int *nest, char **tokens)
 
 static int gvconfig_plugin_install_from_config(GVC_t * gvc, char *s)
 {
-    char *path, *packagename, *api, *type;
+    char *path, *packagename, *api;
+    const char *type;
     api_t gv_api;
     int quality, rc;
     int nest = 0;
index 7f9257b042d21ec165a6e0ea42f991dcc5c1e54b..cf9a1efeba012a412d2feca2f5f7ff4db626d33c 100644 (file)
@@ -34,9 +34,9 @@ extern "C" {
 /* plugins */
 
     extern boolean gvplugin_install(GVC_t * gvc, api_t api,
-                   char *typestr, int quality, char *packagename, char *path,
+                   const char *typestr, int quality, char *packagename, char *path,
                    gvplugin_installed_t * typeptr);
-    extern gvplugin_available_t *gvplugin_load(GVC_t * gvc, api_t api, char *type);
+    extern gvplugin_available_t *gvplugin_load(GVC_t * gvc, api_t api, const char *type);
     extern gvplugin_library_t *gvplugin_library_load(GVC_t *gvc, char *path);
     extern api_t gvplugin_api(char *str);
     extern char * gvplugin_api_name(api_t api);
@@ -59,7 +59,7 @@ extern "C" {
     extern boolean gvtextlayout(GVC_t *gvc, textpara_t *para, char **fontpath);
 
 /* loadimage */
-    extern void gvloadimage(GVJ_t *job, usershape_t *us, boxf b, boolean filled, char *target);
+    extern void gvloadimage(GVJ_t *job, usershape_t *us, boxf b, boolean filled, const char *target);
     
 /* usershapes */
     extern point gvusershape_size_dpi(usershape_t *us, pointf dpi);
index 42b64d07f0925a211a39f3124347d82d72378192..2249d62996198e4d47da9642e6d1a4032c466296 100644 (file)
@@ -49,7 +49,7 @@ static int gvloadimage_select(GVJ_t * job, char *str)
     return NO_SUPPORT;
 }
 
-void gvloadimage(GVJ_t * job, usershape_t *us, boxf b, boolean filled, char *target)
+void gvloadimage(GVJ_t * job, usershape_t *us, boxf b, boolean filled, const char *target)
 {
     gvloadimage_engine_t *gvli;
     char type[SMALLBUF];
index 84003d064004e3731b36d31b09dd8448073e2943..779f17fc81df052ba533ca0f62e51ccd261252c9 100644 (file)
@@ -68,7 +68,7 @@ char *gvplugin_api_name(api_t api)
  * last install wins.
  */
 boolean gvplugin_install(GVC_t * gvc, api_t api,
-                char *typestr, int quality, char *packagename, char *path,
+                const char *typestr, int quality, char *packagename, char *path,
                 gvplugin_installed_t * typeptr)
 {
     gvplugin_available_t *plugin, **pnext;
@@ -127,7 +127,7 @@ boolean gvplugin_install(GVC_t * gvc, api_t api,
  * manually changed in the config file.
  */
 static boolean gvplugin_activate(GVC_t * gvc, api_t api,
-                char *typestr, char *packagename, char *path,
+                const char *typestr, char *packagename, char *path,
                 gvplugin_installed_t * typeptr)
 {
     gvplugin_available_t **pnext;
@@ -250,7 +250,7 @@ gvplugin_library_t *gvplugin_library_load(GVC_t *gvc, char *path)
                png:gd:gd
       
 */
-gvplugin_available_t *gvplugin_load(GVC_t * gvc, api_t api, char *str)
+gvplugin_available_t *gvplugin_load(GVC_t * gvc, api_t api, const char *str)
 {
     gvplugin_available_t **pnext, *rv;
     gvplugin_library_t *library;
@@ -345,7 +345,7 @@ gvplugin_available_t *gvplugin_load(GVC_t * gvc, api_t api, char *str)
 
 /* string buffer management
        - FIXME - must have 20 solutions for this same thing */
-static char *append_buf(char sep, char *str, boolean new)
+static char *append_buf(char sep, const char *str, boolean new)
 {
     static char *buf;
     static int bufsz, pos;
index 4de0dea9b5b92cb21385e7b91bba9dccdf524eb9..4b686403824790d6254e2cc21f4db2740317d246 100644 (file)
@@ -40,7 +40,7 @@ extern "C" {
                        A renderer-type such as "png" in the cairo package
                        has an id that is different from the "ps" type
                        in the same package */
-       char *type;     /* a string name, such as "png" or "ps" that
+       const char *type;       /* a string name, such as "png" or "ps" that
                        distinguishes different types withing the same
                        api (renderer in this case) */
        int quality;    /* an arbitrary integer used for ordering plugins of
index 291935f36548ef5eef441b1fe7bcf8e9221af016..8fd14034e05135e3e0c79fed124fd37d2a307585 100644 (file)
@@ -23,7 +23,7 @@ endif
 
 libgvplugin_lasi_C_la_SOURCES = \
        gvplugin_lasi.c \
-       gvrender_lasi.c
+       gvrender_lasi.cpp
 
 libgvplugin_lasi_la_LDFLAGS = -version-info @GVPLUGIN_VERSION_INFO@
 libgvplugin_lasi_la_SOURCES = $(libgvplugin_lasi_C_la_SOURCES)
index 717da4b52a0aa76111ab56d686f91cb0ac288625..c6e5543703e9eb55868a6d7fd1fe262b629ba970 100644 (file)
 
 #include "gvplugin.h"
 
+extern gvplugin_installed_t gvdevice_lasi_types;
 extern gvplugin_installed_t gvrender_lasi_types;
 
 static gvplugin_api_t apis[] = {
+    {API_device, &gvdevice_lasi_types},
     {API_render, &gvrender_lasi_types},
     {(api_t)0, 0},
 };
similarity index 76%
rename from plugin/lasi/gvrender_lasi.c
rename to plugin/lasi/gvrender_lasi.cpp
index 282e0b9a4c50aa54c11877a32103013fb5460254..9e8f20bfb289810847ae689c4e4491c7fa640825 100644 (file)
 #include "config.h"
 #endif
 
-#include <stdlib.h>
-#include <string.h>
+#include <iostream>
+#include <fstream>
+#include <stdexcept>
+#include <LASi.h>
 
-#include "gvplugin_render.h"
-#include "graph.h"
-#include "agxbuf.h"
-#include "utils.h"
-
-/* for CHAR_LATIN1  */
-#include "const.h"
 
-/*
- *     J$: added `pdfmark' URL embedding.  PostScript rendered from
- *         dot files with URL attributes will get active PDF links
- *         from Adobe's Distiller.
- */
-#define PDFMAX  14400           /*  Maximum size of PDF page  */
+#include "gvplugin_render.h"
+// #include "graph.h"
+// #include "agxbuf.h"
+// #include "utils.h"
 
-extern void epsf_define(FILE * of);
-extern char *ps_string(char *ins, int latin);
+using namespace LASi;
+using namespace std;
 
 typedef enum { FORMAT_PS, FORMAT_PS2, FORMAT_EPS } format_type;
 
-static int isLatin1;
-static char setupLatin1;
-
-static void psgen_begin_job(GVJ_t * job)
+static void lasi_begin_job(GVJ_t * job)
 {
-    gvdevice_fputs(job, "%!PS-Adobe-3.0 EPSF-3.0\n");
-    gvdevice_printf(job, "%%%%Creator: %s version %s (%s)\n",
-           job->common->info[0], job->common->info[1], job->common->info[2]);
-    gvdevice_printf(job, "%%%%For: %s\n", job->common->user);
+//    gvdevice_fputs(job, "%!PS-Adobe-3.0 EPSF-3.0\n");
+//    gvdevice_printf(job, "%%%%Creator: %s version %s (%s)\n",
+//         job->common->info[0], job->common->info[1], job->common->info[2]);
+//    gvdevice_printf(job, "%%%%For: %s\n", job->common->user);
 }
 
-static void psgen_end_job(GVJ_t * job)
+static void lasi_end_job(GVJ_t * job)
 {
-    gvdevice_fputs(job, "%%Trailer\n");
-    if (job->render.id != FORMAT_EPS)
-        gvdevice_printf(job, "%%%%Pages: %d\n", job->common->viewNum);
-    if (job->common->show_boxes == NULL)
-        if (job->render.id != FORMAT_EPS)
-           gvdevice_printf(job, "%%%%BoundingBox: %d %d %d %d\n",
-               job->boundingBox.LL.x, job->boundingBox.LL.y,
-               job->boundingBox.UR.x, job->boundingBox.UR.y);
-    gvdevice_fputs(job, "end\nrestore\n");
-    gvdevice_fputs(job, "%%EOF\n");
+//    gvdevice_fputs(job, "%%Trailer\n");
+//    if (job->render.id != FORMAT_EPS)
+//        gvdevice_printf(job, "%%%%Pages: %d\n", job->common->viewNum);
+//    if (job->common->show_boxes == NULL)
+//        if (job->render.id != FORMAT_EPS)
+//         gvdevice_printf(job, "%%%%BoundingBox: %d %d %d %d\n",
+//             job->boundingBox.LL.x, job->boundingBox.LL.y,
+//             job->boundingBox.UR.x, job->boundingBox.UR.y);
+//    gvdevice_fputs(job, "end\nrestore\n");
+//    gvdevice_fputs(job, "%%EOF\n");
 }
 
-static void psgen_begin_graph(GVJ_t * job)
+#if 0
+static void lasi_begin_graph(GVJ_t * job)
 {
     obj_state_t *obj = job->obj;
 
@@ -115,12 +106,12 @@ static void psgen_begin_graph(GVJ_t * job)
                "/PUT pdfmark\n", obj->url);
 }
 
-static void psgen_begin_layer(GVJ_t * job, char *layername, int layerNum, int numLayers)
+static void lasi_begin_layer(GVJ_t * job, char *layername, int layerNum, int numLayers)
 {
     gvdevice_printf(job, "%d %d setlayer\n", layerNum, numLayers);
 }
 
-static void psgen_begin_page(GVJ_t * job)
+static void lasi_begin_page(GVJ_t * job)
 {
     box pbr = job->pageBoundingBox;
 
@@ -155,7 +146,7 @@ static void psgen_begin_page(GVJ_t * job)
     }
 }
 
-static void psgen_end_page(GVJ_t * job)
+static void lasi_end_page(GVJ_t * job)
 {
     if (job->common->show_boxes) {
        gvdevice_fputs(job, "0 0 0 edgecolor\n");
@@ -169,7 +160,7 @@ static void psgen_end_page(GVJ_t * job)
     gvdevice_printf(job, "%%%%EndPage: %d\n", job->common->viewNum);
 }
 
-static void psgen_begin_cluster(GVJ_t * job)
+static void lasi_begin_cluster(GVJ_t * job)
 {
     obj_state_t *obj = job->obj;
 
@@ -178,33 +169,33 @@ static void psgen_begin_cluster(GVJ_t * job)
     gvdevice_fputs(job, "gsave\n");
 }
 
-static void psgen_end_cluster(GVJ_t * job)
+static void lasi_end_cluster(GVJ_t * job)
 {
     gvdevice_fputs(job, "grestore\n");
 }
 
-static void psgen_begin_node(GVJ_t * job)
+static void lasi_begin_node(GVJ_t * job)
 {
     gvdevice_fputs(job, "gsave\n");
 }
 
-static void psgen_end_node(GVJ_t * job)
+static void lasi_end_node(GVJ_t * job)
 {
     gvdevice_fputs(job, "grestore\n");
 }
 
 static void
-psgen_begin_edge(GVJ_t * job)
+lasi_begin_edge(GVJ_t * job)
 {
     gvdevice_fputs(job, "gsave\n");
 }
 
-static void psgen_end_edge(GVJ_t * job)
+static void lasi_end_edge(GVJ_t * job)
 {
     gvdevice_fputs(job, "grestore\n");
 }
 
-static void psgen_begin_anchor(GVJ_t *job, char *url, char *tooltip, char *target)
+static void lasi_begin_anchor(GVJ_t *job, char *url, char *tooltip, char *target)
 {
     obj_state_t *obj = job->obj;
 
@@ -272,7 +263,7 @@ static void ps_set_color(GVJ_t *job, gvcolor_t *color)
     }
 }
 
-static void psgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
+static void lasi_textpara(GVJ_t * job, pointf p, textpara_t * para)
 {
     char *str;
 
@@ -302,7 +293,7 @@ static void psgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
     gvdevice_printf(job, " %s alignedtext\n", str);
 }
 
-static void psgen_ellipse(GVJ_t * job, pointf * A, int filled)
+static void lasi_ellipse(GVJ_t * job, pointf * A, int filled)
 {
     /* A[] contains 2 points: the center and corner. */
     pointf AA[2];
@@ -325,7 +316,7 @@ static void psgen_ellipse(GVJ_t * job, pointf * A, int filled)
 }
 
 static void
-psgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
+lasi_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
             int arrow_at_end, int filled)
 {
     int j;
@@ -355,7 +346,7 @@ psgen_bezier(GVJ_t * job, pointf * A, int n, int arrow_at_start,
     }
 }
 
-static void psgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
+static void lasi_polygon(GVJ_t * job, pointf * A, int n, int filled)
 {
     int j;
 
@@ -384,7 +375,7 @@ static void psgen_polygon(GVJ_t * job, pointf * A, int n, int filled)
     }
 }
 
-static void psgen_polyline(GVJ_t * job, pointf * A, int n)
+static void lasi_polyline(GVJ_t * job, pointf * A, int n)
 {
     int j;
 
@@ -402,14 +393,14 @@ static void psgen_polyline(GVJ_t * job, pointf * A, int n)
     }
 }
 
-static void psgen_comment(GVJ_t * job, char *str)
+static void lasi_comment(GVJ_t * job, char *str)
 {
     gvdevice_fputs(job, "% ");
     gvdevice_fputs(job, str);
     gvdevice_fputs(job, "\n");
 }
 
-static void psgen_library_shape(GVJ_t * job, char *name, pointf * A, int n, int filled)
+static void lasi_library_shape(GVJ_t * job, char *name, pointf * A, int n, int filled)
 {
     if (filled && job->obj->fillcolor.u.HSVA[3] > .5) {
        ps_set_color(job, &(job->obj->fillcolor));
@@ -429,39 +420,40 @@ static void psgen_library_shape(GVJ_t * job, char *name, pointf * A, int n, int
         gvdevice_printf(job, " ]  %d false %s\n", n, name);
     }
 }
+#endif
 
-static gvrender_engine_t psgen_engine = {
-    psgen_begin_job,
-    psgen_end_job,
-    psgen_begin_graph,
-    0,                         /* psgen_end_graph */
-    psgen_begin_layer,
-    0,                         /* psgen_end_layer */
-    psgen_begin_page,
-    psgen_end_page,
-    psgen_begin_cluster,
-    psgen_end_cluster,
-    0,                         /* psgen_begin_nodes */
-    0,                         /* psgen_end_nodes */
-    0,                         /* psgen_begin_edges */
-    0,                         /* psgen_end_edges */
-    psgen_begin_node,
-    psgen_end_node,
-    psgen_begin_edge,
-    psgen_end_edge,
-    psgen_begin_anchor,
-    0,                         /* psgen_end_anchor */
-    psgen_textpara,
-    0,                         /* psgen_resolve_color */
-    psgen_ellipse,
-    psgen_polygon,
-    psgen_bezier,
-    psgen_polyline,
-    psgen_comment,
-    psgen_library_shape,
+static gvrender_engine_t lasi_engine = {
+    lasi_begin_job,
+    lasi_end_job,
+0,//    lasi_begin_graph,
+    0,                         /* lasi_end_graph */
+0,//    lasi_begin_layer,
+    0,                         /* lasi_end_layer */
+0,//    lasi_begin_page,
+0,//    lasi_end_page,
+0,//    lasi_begin_cluster,
+0,//    lasi_end_cluster,
+    0,                         /* lasi_begin_nodes */
+    0,                         /* lasi_end_nodes */
+    0,                         /* lasi_begin_edges */
+    0,                         /* lasi_end_edges */
+0,//    lasi_begin_node,
+0,//    lasi_end_node,
+0,//    lasi_begin_edge,
+0,//    lasi_end_edge,
+0,//    lasi_begin_anchor,
+    0,                         /* lasi_end_anchor */
+0,//    lasi_textpara,
+    0,                         /* lasi_resolve_color */
+0,//    lasi_ellipse,
+0,//    lasi_polygon,
+0,//    lasi_bezier,
+0,//    lasi_polyline,
+0,//    lasi_comment,
+0,//    lasi_library_shape,
 };
 
-static gvrender_features_t render_features_ps = {
+static gvrender_features_t render_features_lasi = {
     GVRENDER_DOES_TRANSFORM
        | GVRENDER_DOES_MAPS
        | GVRENDER_NO_BG
@@ -487,14 +479,14 @@ static gvdevice_features_t device_features_eps = {
     {72.,72.},                 /* default dpi */
 };
 
-gvplugin_installed_t gvrender_ps_types[] = {
-    {FORMAT_PS, "ps", 1, &psgen_engine, &render_features_ps},
+gvplugin_installed_t gvrender_lasi_types[] = {
+    {FORMAT_PS, "lasi", 1, &lasi_engine, &render_features_lasi},
     {0, NULL, 0, NULL, NULL}
 };
 
-gvplugin_installed_t gvdevice_ps_types[] = {
-    {FORMAT_PS, "ps:ps", 1, NULL, &device_features_ps},
-    {FORMAT_PS2, "ps2:ps", 1, NULL, &device_features_ps},
-    {FORMAT_EPS, "eps:ps", 1, NULL, &device_features_eps},
+gvplugin_installed_t gvdevice_lasi_types[] = {
+    {FORMAT_PS, "ps:lasi", -5, NULL, &device_features_ps},
+    {FORMAT_PS2, "ps2:lasi", -5, NULL, &device_features_ps},
+    {FORMAT_EPS, "eps:lasi", -5, NULL, &device_features_eps},
     {0, NULL, 0, NULL, NULL}
 };