From: glenlow Date: Fri, 23 May 2008 14:34:36 +0000 (+0000) Subject: gvFirstPlugin, gvLastPlugin, gvPluginType to walk the available plugins and get plugi... X-Git-Tag: LAST_LIBGRAPH~32^2~4006 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9e493057044ab54fa9bc5bcd5c9021e81983606;p=graphviz gvFirstPlugin, gvLastPlugin, gvPluginType to walk the available plugins and get plugin type; readjusted header definitions to fit --- diff --git a/lib/gvc/gvc.c b/lib/gvc/gvc.c index e94e7507d..ce2c0f29d 100644 --- a/lib/gvc/gvc.c +++ b/lib/gvc/gvc.c @@ -199,3 +199,8 @@ char **gvcInfo(GVC_t* gvc) { return gvc->common.info; } char *gvcUsername(GVC_t* gvc) { return gvc->common.user; } char *gvcVersion(GVC_t* gvc) { return gvc->common.info[1]; } char *gvcBuildDate(GVC_t* gvc) { return gvc->common.info[2]; } + +gvplugin_available_t *gvFirstPlugin(GVC_t *gvc, api_t api) { return gvc->apis[api]; } +gvplugin_available_t *gvNextPlugin(gvplugin_available_t *plugin) { return plugin->next; } +char *gvPluginType(gvplugin_available_t *plugin) { return plugin->typestr; } + diff --git a/lib/gvc/gvc.h b/lib/gvc/gvc.h index cd417ec21..71608bd6e 100644 --- a/lib/gvc/gvc.h +++ b/lib/gvc/gvc.h @@ -67,6 +67,11 @@ extern char *gvcVersion(GVC_t*); extern char *gvcBuildDate(GVC_t*); extern char *gvcUsername(GVC_t*); +/* get plugins associated with a graphviz context */ +extern gvplugin_available_t *gvFirstPlugin(GVC_t *gvc, api_t api); +extern gvplugin_available_t *gvNextPlugin(gvplugin_available_t *plugin); +extern char *gvPluginType(gvplugin_available_t *plugin); + /* parse command line args - minimally argv[0] sets layout engine */ extern int gvParseArgs(GVC_t *gvc, int argc, char **argv); extern graph_t *gvNextInputGraph(GVC_t *gvc); diff --git a/lib/gvc/gvcext.h b/lib/gvc/gvcext.h index 091a486a1..d0687f843 100644 --- a/lib/gvc/gvcext.h +++ b/lib/gvc/gvcext.h @@ -28,6 +28,38 @@ extern "C" { typedef struct codegen_info_s codegen_info_t; #endif +/* + * Define an apis array of name strings using an enumerated api_t as index. + * The enumerated type is defined here. The apis array is + * inititialized in gvplugin.c by redefining ELEM and reinvoking APIS. + */ +#define APIS ELEM(render) ELEM(layout) ELEM(textlayout) ELEM(device) ELEM(loadimage) + +/* + * Define api_t using names based on the plugin names with API_ prefixed. + */ +#define ELEM(x) API_##x, + typedef enum { APIS _DUMMY_ELEM_=0 } api_t; /* API_render, API_layout, ... */ + /* Stupid but true: The sole purpose of "_DUMMY_ELEM_=0" + * is to avoid a "," after the last element of the enum + * because some compilers when using "-pedantic" + * generate an error for about the dangling "," + * but only if this header is used from a .cpp file! + * Setting it to 0 makes sure that the enumeration + * does not define an extra value. (It does however + * define _DUMMY_ELEM_ as an enumeration symbol, + * but its value duplicates that of the first + * symbol in the enumeration - in this case "render".) + */ + + /* One could wonder why trailing "," in: + * int nums[]={1,2,3,}; + * is OK, but in: + * typedef enum {a,b,c,} abc_t; + * is not!!! + */ +#undef ELEM + typedef struct GVJ_s GVJ_t; typedef struct GVC_s GVC_t; @@ -36,6 +68,7 @@ extern "C" { void* address; } lt_symlist_t; + typedef struct gvplugin_available_s gvplugin_available_t; #if defined(GVDLL) && !defined(ENABLE_LTDL) extern lt_symlist_t lt_preloaded_symbols[]; diff --git a/lib/gvc/gvcint.h b/lib/gvc/gvcint.h index 08a15e1e9..03e6d93a9 100644 --- a/lib/gvc/gvcint.h +++ b/lib/gvc/gvcint.h @@ -40,8 +40,6 @@ extern "C" { char *type; } gvplugin_active_textlayout_t; - typedef struct gvplugin_available_s gvplugin_available_t; - struct gvplugin_available_s { gvplugin_available_t *next; /* next plugin in linked list, or NULL */ char *typestr; /* type string, e.g. "png" or "ps" */ diff --git a/lib/gvc/gvplugin.h b/lib/gvc/gvplugin.h index 00097bcc3..4de0dea9b 100644 --- a/lib/gvc/gvplugin.h +++ b/lib/gvc/gvplugin.h @@ -33,38 +33,6 @@ extern "C" { * type - e.g. "png", "ps" */ -/* - * Define an apis array of name strings using an enumerated api_t as index. - * The enumerated type is defined here. The apis array is - * inititialized in gvplugin.c by redefining ELEM and reinvoking APIS. - */ -#define APIS ELEM(render) ELEM(layout) ELEM(textlayout) ELEM(device) ELEM(loadimage) - -/* - * Define api_t using names based on the plugin names with API_ prefixed. - */ -#define ELEM(x) API_##x, - typedef enum { APIS _DUMMY_ELEM_=0 } api_t; /* API_render, API_layout, ... */ - /* Stupid but true: The sole purpose of "_DUMMY_ELEM_=0" - * is to avoid a "," after the last element of the enum - * because some compilers when using "-pedantic" - * generate an error for about the dangling "," - * but only if this header is used from a .cpp file! - * Setting it to 0 makes sure that the enumeration - * does not define an extra value. (It does however - * define _DUMMY_ELEM_ as an enumeration symbol, - * but its value duplicates that of the first - * symbol in the enumeration - in this case "render".) - */ - - /* One could wonder why trailing "," in: - * int nums[]={1,2,3,}; - * is OK, but in: - * typedef enum {a,b,c,} abc_t; - * is not!!! - */ -#undef ELEM - typedef struct { int id; /* an id that is only unique within a package of plugins of the same api.