From ac5294e8ec0047f4761fe2781819da66a072d3a0 Mon Sep 17 00:00:00 2001 From: ellson <devnull@localhost> Date: Thu, 20 Jan 2005 17:41:11 +0000 Subject: [PATCH] add wrapper functions for display plugin --- lib/gvc/Makefile.am | 4 +-- lib/gvc/gvcint.h | 4 ++- lib/gvc/gvdisplay.c | 73 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 lib/gvc/gvdisplay.c diff --git a/lib/gvc/Makefile.am b/lib/gvc/Makefile.am index e0a343bef..50ac75e2d 100644 --- a/lib/gvc/Makefile.am +++ b/lib/gvc/Makefile.am @@ -21,7 +21,7 @@ pkginclude_HEADERS = gvc.h gvcint.h gvplugin.h \ pkglib_LTLIBRARIES = libgvc.la pkgconfig_DATA = libgvc.pc -libgvc_la_SOURCES = gvrender.c gvlayout.c gvtext.c gvcontext.c gvjobs.c \ - gvemit.c gvplugin.c gvconfig.c +libgvc_la_SOURCES = gvrender.c gvlayout.c gvdisplay.c gvtext.c gvcontext.c \ + gvjobs.c gvemit.c gvplugin.c gvconfig.c EXTRA_DIST = Makefile.old diff --git a/lib/gvc/gvcint.h b/lib/gvc/gvcint.h index 10b151b38..69525f00a 100644 --- a/lib/gvc/gvcint.h +++ b/lib/gvc/gvcint.h @@ -154,7 +154,9 @@ extern "C" { gv_plugin_t *api[NUM_APIS]; /* array of current plugins for each api */ void *display; /* window display data for gvdisplay plugin */ - gvtext_engine_t *text_engine; /* current text layout engine */ + gvdisplay_engine_t *display_engine; /* current display engine */ + + gvtext_engine_t *text_engine; /* current text_layout engine */ /* gvrender_begin_job() */ char *layout_type; /* string name of layout type */ diff --git a/lib/gvc/gvdisplay.c b/lib/gvc/gvdisplay.c new file mode 100644 index 000000000..84227c804 --- /dev/null +++ b/lib/gvc/gvdisplay.c @@ -0,0 +1,73 @@ +/* $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 * +**********************************************************/ + +/* + * display engine wrapper + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> + +#include "const.h" +#include "types.h" +#include "macros.h" + +#include "gvplugin_display.h" +#include "gvc.h" + +int gvdisplay_select(GVC_t * gvc, char *display) +{ + gv_plugin_t *plugin; + gvplugin_type_t *typeptr; + + plugin = gvplugin_load(gvc, API_display, display); + if (plugin) { + typeptr = plugin->typeptr; + gvc->display_engine = (gvdisplay_engine_t *) (typeptr->engine); + return GVRENDER_PLUGIN; /* FIXME - need more suitable success code */ + } + return NO_SUPPORT; +} + +void gvdisplay_init(GVC_t *gvc) +{ + gvdisplay_engine_t *gvde = gvc->display_engine; + + if (gvde && gvde->init) { + gvde->init(gvc); + } +} + +void gvdisplay_process(GVC_t *gvc) +{ + gvdisplay_engine_t *gvde = gvc->display_engine; + + if (gvde && gvde->process) { + gvde->process(gvc); + } +} + +void gvdisplay_deinit(GVC_t *gvc) +{ + gvdisplay_engine_t *gvde = gvc->display_engine; + + if (gvde && gvde->deinit) { + gvde->deinit(gvc); + } +} -- 2.40.0