]> granicus.if.org Git - graphviz/commitdiff
add gvcext.h so plugins get GVC_t and GVJ_t without graph_t
authorellson <devnull@localhost>
Tue, 18 Oct 2005 18:35:47 +0000 (18:35 +0000)
committerellson <devnull@localhost>
Tue, 18 Oct 2005 18:35:47 +0000 (18:35 +0000)
12 files changed:
lib/common/color.h [new file with mode: 0644]
lib/common/types.h
lib/common/utils.c
lib/gvc/Makefile.am
lib/gvc/Makefile.old
lib/gvc/gvcext.h [new file with mode: 0644]
lib/gvc/gvplugin.h
lib/gvc/gvplugin_device.h
lib/gvc/gvplugin_layout.h
lib/gvc/gvplugin_render.h
lib/gvc/gvplugin_textlayout.h
lib/gvc/gvplugin_usershape.h

diff --git a/lib/common/color.h b/lib/common/color.h
new file mode 100644 (file)
index 0000000..2185270
--- /dev/null
@@ -0,0 +1,59 @@
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+*      This software is part of the graphviz package      *
+*                http://www.graphviz.org/                 *
+*                                                         *
+*            Copyright (c) 1994-2004 AT&T Corp.           *
+*                and is licensed under the                *
+*            Common Public License, Version 1.0           *
+*                      by AT&T Corp.                      *
+*                                                         *
+*        Information and Software Systems Research        *
+*              AT&T Research, Florham Park NJ             *
+**********************************************************/
+
+#ifndef GV_COLOR_H
+#define GV_COLOR_H
+
+#include "arith.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct hsbcolor_t {
+    char *name;
+    unsigned char h, s, b;
+} hsbcolor_t;
+
+/* possible representations of color in color_t */
+typedef enum { HSV_DOUBLE, RGBA_BYTE, RGBA_WORD, CMYK_BYTE,
+               RGBA_DOUBLE, COLOR_STRING, COLOR_INDEX } color_type_t;
+
+/* color_t can hold a color spec in a choice or representations */
+typedef struct color_s {
+    union {
+       double RGBA[4];
+       double HSV[3];
+       unsigned char rgba[4];
+       unsigned char cmyk[4];
+       int rrggbbaa[4];
+       char *string;
+       int index;
+    } u;
+    color_type_t type;
+} color_t;
+
+#define COLOR_MALLOC_FAIL -1
+#define COLOR_UNKNOWN 1
+#define COLOR_OK 0
+
+extern int colorxlate(char *str, color_t * color, color_type_t target_type);
+extern char *canontoken(char *str);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
index acede7b6fa141f957689e900cb66a848eaefe11e..f5c24a1f904130546072c9e7f215b0b0ddf4e4f1 100644 (file)
@@ -20,6 +20,7 @@
 #include "geom.h"
 #include "pathplan.h"
 #include "color.h"
+#include "gvcext.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -33,14 +34,6 @@ extern "C" {
     typedef struct Agedge_t edge_t;
     typedef struct Agsym_t attrsym_t;
 
-    typedef struct GVC_s GVC_t;
-    typedef struct GVJ_s GVJ_t;
-    typedef struct gvdevice_engine_s gvdevice_engine_t;
-    typedef struct gvrender_engine_s gvrender_engine_t;
-    typedef struct gvlayout_engine_s gvlayout_engine_t;
-    typedef struct gvtextlayout_engine_s gvtextlayout_engine_t;
-    typedef struct gvusershape_engine_s gvusershape_engine_t;
-
     typedef struct htmllabel_t htmllabel_t;
 
     typedef union inside_t {
@@ -192,7 +185,7 @@ extern "C" {
     } shape_desc;
 
 #ifndef DISABLE_CODEGENS
-    typedef struct codegen_t {
+    struct codegen_s {
        void (*reset) (void);
        void (*begin_job) (FILE * ofp, graph_t * g, char **lib, char *user,
                           char *info[], point pages);
@@ -233,15 +226,15 @@ extern "C" {
        void (*textsize) (void);        /* not used */
        void (*user_shape) (char *name, point * A, int sides, int filled);
        void (*usershapesize) (void);   /* not used */
-    } codegen_t;
+    };
 
-    typedef struct codegen_info_t {
+    struct codegen_info_s {
        codegen_t *cg;          /* discovered codegen */
        char *name;             /* output format, null for sentinel */
        int id;                 /* id of output format */
        void *info;             /* additional info provided by discovery routine */
        /* Quartz uses this to store the Quicktime Component */
-    } codegen_info_t;
+    };
 
 #endif
 
index 770c0dddf561bba179deba9e2d1f950afae7fdf9..2fe31fbe6b45b04a074c3d2cfc6fd1c7deeb9391 100644 (file)
@@ -519,7 +519,7 @@ point dotneato_closest(splines * spl, point p)
 
            b.x = bz.list[j].x;
            b.y = bz.list[j].y;
-           d2 = dist2(b, pt);
+           d2 = DIST2(b, pt);
            if ((bestj == -1) || (d2 < bestdist2)) {
                besti = i;
                bestj = j;
@@ -538,8 +538,8 @@ point dotneato_closest(splines * spl, point p)
     }
     low = 0.0;
     high = 1.0;
-    dlow2 = dist2(c[0], pt);
-    dhigh2 = dist2(c[3], pt);
+    dlow2 = DIST2(c[0], pt);
+    dhigh2 = DIST2(c[3], pt);
     do {
        t = (low + high) / 2.0;
        pt2 = Bezier(c, 3, t, NULL, NULL);
@@ -549,10 +549,10 @@ point dotneato_closest(splines * spl, point p)
            break;
        if (dlow2 < dhigh2) {
            high = t;
-           dhigh2 = dist2(pt2, pt);
+           dhigh2 = DIST2(pt2, pt);
        } else {
            low = t;
-           dlow2 = dist2(pt2, pt);
+           dlow2 = DIST2(pt2, pt);
        }
     } while (1);
     PF2P(pt2, rv);
index abf17e88f17b5df4e849ce7d0c20c49c761ead0a..c078d48e0f4732b8a62a5cc2fff80538925dd0dc 100644 (file)
@@ -12,9 +12,9 @@ AM_CPPFLAGS = \
 
 LIBS = $(LIBLTDL) $(SOCKET_LIBS)
 
-pkginclude_HEADERS = gvc.h gvcint.h gvplugin.h gvcproc.h gvplugin_render.h \
-       gvplugin_layout.h gvplugin_textlayout.h gvplugin_device.h \
-       gvplugin_usershape.h
+pkginclude_HEADERS = gvc.h gvcint.h gvcext.h gvplugin.h gvcproc.h \
+       gvplugin_render.h gvplugin_layout.h gvplugin_textlayout.h \
+       gvplugin_device.h gvplugin_usershape.h
 pkglib_LTLIBRARIES = libgvc.la
 pkgconfig_DATA = libgvc.pc
 
index f0c4c66ae7760d3885bc8aff58133353ba66bb0e..caef61ae7c03ad2cbc364d752859150d027e8d96 100644 (file)
@@ -13,7 +13,7 @@ INCS =  -I. \
 
 DEFINES = -DHAVE_CONFIG_H -DGVLIBDIR=\"$(LIBDIR)\"
 
-HDRS = gvc.h gvcint.h gvcproc.h gvplugin_render.h gvplugin_device.h \
+HDRS = gvc.h gvcint.h gvcext.h gvcproc.h gvplugin_render.h gvplugin_device.h \
        gvplugin_layout.h gvplugin_textlayout.h \
        gvplugin_usershape.h gvplugin.h
 
diff --git a/lib/gvc/gvcext.h b/lib/gvc/gvcext.h
new file mode 100644 (file)
index 0000000..9e94e80
--- /dev/null
@@ -0,0 +1,44 @@
+/* $Id$ $Revision$ */
+/* vim:set shiftwidth=4 ts=8: */
+
+/**********************************************************
+*      This software is part of the graphviz package      *
+*                http://www.graphviz.org/                 *
+*                                                         *
+*            Copyright (c) 1994-2004 AT&T Corp.           *
+*                and is licensed under the                *
+*            Common Public License, Version 1.0           *
+*                      by AT&T Corp.                      *
+*                                                         *
+*        Information and Software Systems Research        *
+*              AT&T Research, Florham Park NJ             *
+**********************************************************/
+
+/* Common header used by both clients and plugins */
+
+#ifndef GVCEXT_H
+#define GVCEXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    typedef struct gvdevice_engine_s gvdevice_engine_t;
+    typedef struct gvrender_engine_s gvrender_engine_t;
+    typedef struct gvlayout_engine_s gvlayout_engine_t;
+    typedef struct gvtextlayout_engine_s gvtextlayout_engine_t;
+    typedef struct gvusershape_engine_s gvusershape_engine_t;
+
+    typedef struct GVJ_s GVJ_t;
+    typedef struct GVC_s GVC_t;
+
+#ifndef DISABLE_CODEGENS
+    typedef struct codegen_s codegen_t;
+    typedef struct codegen_info_s codegen_info_t;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index 70ecb718790f139c6306d7d260cb3915175d9502..3ed6e2a6de23651e360bd6a3eb09c1285dfb4ff6 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef GVPLUGIN_H
 #define GVPLUGIN_H
 
+#include "gvcext.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
index 67f3b903678128a85794e7d0b17bece93900090f..a90bbf664b5425952c48a33ac8e7d95fea96cc6f 100644 (file)
@@ -18,6 +18,8 @@
 #define GVDEVICE_PLUGIN_H
 
 #include "gvplugin.h"
+#include "geom.h"
+#include "color.h"
 #include "gvcint.h"
 
 #ifdef __cplusplus
index e47cbfd7842169700ea934454a68da2decb6b032..626bf2112401aad0b9eea647bcc4e0130e5142a9 100644 (file)
@@ -18,6 +18,8 @@
 #define GVLAYOUT_PLUGIN_H
 
 #include "gvplugin.h"
+#include "geom.h"
+#include "color.h"
 #include "gvcint.h"
 
 #ifdef __cplusplus
index d86d9ecea78b7143748b774fc55c7da3c089cfbe..8b1cb67c039d65b11a9bbf76788b37f804c7eadf 100644 (file)
@@ -18,6 +18,8 @@
 #define GVRENDER_PLUGIN_H
 
 #include "gvplugin.h"
+#include "geom.h"
+#include "color.h"
 #include "gvcint.h"
 
 #ifdef __cplusplus
index 314c9782a2edd0fbbd16dad934008a9785843ab7..b96e366fee75276ffbee5d4cfea6d62584eebbbc 100644 (file)
@@ -18,6 +18,8 @@
 #define GVTEXTLAYOUT_PLUGIN_H
 
 #include "gvplugin.h"
+#include "geom.h"
+#include "color.h"
 #include "gvcint.h"
 
 #ifdef __cplusplus
index c0707c9212464823d1048c9c06a89ff76bdd4582..defaf99861e6770a4d795c2d33e628e99fe9aed1 100644 (file)
@@ -18,6 +18,8 @@
 #define GVUSERSHAPE_PLUGIN_H
 
 #include "gvplugin.h"
+#include "geom.h"
+#include "color.h"
 #include "gvcint.h"
 
 #ifdef __cplusplus