From: ellson Date: Tue, 18 Oct 2005 18:35:47 +0000 (+0000) Subject: add gvcext.h so plugins get GVC_t and GVJ_t without graph_t X-Git-Tag: LAST_LIBGRAPH~32^2~7299 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c033b9fecaee158e52362b8369cad68dfab6442;p=graphviz add gvcext.h so plugins get GVC_t and GVJ_t without graph_t --- diff --git a/lib/common/color.h b/lib/common/color.h new file mode 100644 index 000000000..2185270d9 --- /dev/null +++ b/lib/common/color.h @@ -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 diff --git a/lib/common/types.h b/lib/common/types.h index acede7b6f..f5c24a1f9 100644 --- a/lib/common/types.h +++ b/lib/common/types.h @@ -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 diff --git a/lib/common/utils.c b/lib/common/utils.c index 770c0dddf..2fe31fbe6 100644 --- a/lib/common/utils.c +++ b/lib/common/utils.c @@ -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); diff --git a/lib/gvc/Makefile.am b/lib/gvc/Makefile.am index abf17e88f..c078d48e0 100644 --- a/lib/gvc/Makefile.am +++ b/lib/gvc/Makefile.am @@ -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 diff --git a/lib/gvc/Makefile.old b/lib/gvc/Makefile.old index f0c4c66ae..caef61ae7 100644 --- a/lib/gvc/Makefile.old +++ b/lib/gvc/Makefile.old @@ -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 index 000000000..9e94e8085 --- /dev/null +++ b/lib/gvc/gvcext.h @@ -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 diff --git a/lib/gvc/gvplugin.h b/lib/gvc/gvplugin.h index 70ecb7187..3ed6e2a6d 100644 --- a/lib/gvc/gvplugin.h +++ b/lib/gvc/gvplugin.h @@ -19,6 +19,8 @@ #ifndef GVPLUGIN_H #define GVPLUGIN_H +#include "gvcext.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/lib/gvc/gvplugin_device.h b/lib/gvc/gvplugin_device.h index 67f3b9036..a90bbf664 100644 --- a/lib/gvc/gvplugin_device.h +++ b/lib/gvc/gvplugin_device.h @@ -18,6 +18,8 @@ #define GVDEVICE_PLUGIN_H #include "gvplugin.h" +#include "geom.h" +#include "color.h" #include "gvcint.h" #ifdef __cplusplus diff --git a/lib/gvc/gvplugin_layout.h b/lib/gvc/gvplugin_layout.h index e47cbfd78..626bf2112 100644 --- a/lib/gvc/gvplugin_layout.h +++ b/lib/gvc/gvplugin_layout.h @@ -18,6 +18,8 @@ #define GVLAYOUT_PLUGIN_H #include "gvplugin.h" +#include "geom.h" +#include "color.h" #include "gvcint.h" #ifdef __cplusplus diff --git a/lib/gvc/gvplugin_render.h b/lib/gvc/gvplugin_render.h index d86d9ecea..8b1cb67c0 100644 --- a/lib/gvc/gvplugin_render.h +++ b/lib/gvc/gvplugin_render.h @@ -18,6 +18,8 @@ #define GVRENDER_PLUGIN_H #include "gvplugin.h" +#include "geom.h" +#include "color.h" #include "gvcint.h" #ifdef __cplusplus diff --git a/lib/gvc/gvplugin_textlayout.h b/lib/gvc/gvplugin_textlayout.h index 314c9782a..b96e366fe 100644 --- a/lib/gvc/gvplugin_textlayout.h +++ b/lib/gvc/gvplugin_textlayout.h @@ -18,6 +18,8 @@ #define GVTEXTLAYOUT_PLUGIN_H #include "gvplugin.h" +#include "geom.h" +#include "color.h" #include "gvcint.h" #ifdef __cplusplus diff --git a/lib/gvc/gvplugin_usershape.h b/lib/gvc/gvplugin_usershape.h index c0707c921..defaf9986 100644 --- a/lib/gvc/gvplugin_usershape.h +++ b/lib/gvc/gvplugin_usershape.h @@ -18,6 +18,8 @@ #define GVUSERSHAPE_PLUGIN_H #include "gvplugin.h" +#include "geom.h" +#include "color.h" #include "gvcint.h" #ifdef __cplusplus