From 20d816ec5cbfaca23b69a3af700a3fa22a7a1b2a Mon Sep 17 00:00:00 2001 From: Magnus Jacobsson Date: Tue, 20 Jul 2021 07:11:55 +0200 Subject: [PATCH] [nfc] define GVC_API instead of redefining extern --- lib/gvc/gvc.h | 65 +++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/lib/gvc/gvc.h b/lib/gvc/gvc.h index 28909f063..5ce4757cc 100644 --- a/lib/gvc/gvc.h +++ b/lib/gvc/gvc.h @@ -19,77 +19,80 @@ extern "C" { #endif #ifdef GVDLL -#define extern __declspec(dllexport) +#define GVC_API __declspec(dllexport) #else -#define extern +#define GVC_API #endif /*visual studio*/ #ifdef _WIN32 #ifndef GVC_EXPORTS -#undef extern -#define extern __declspec(dllimport) +#undef GVC_API +#define GVC_API __declspec(dllimport) #endif #endif /*end visual studio*/ +#ifndef GVC_API +#define GVC_API extern +#endif #define LAYOUT_DONE(g) (agbindrec(g, "Agraphinfo_t", 0, TRUE) && GD_drawing(g)) /* misc */ /* FIXME - this needs eliminating or renaming */ -extern void gvToggle(int); +GVC_API void gvToggle(int); /* set up a graphviz context */ -extern GVC_t *gvNEWcontext(const lt_symlist_t *builtins, int demand_loading); +GVC_API GVC_t *gvNEWcontext(const lt_symlist_t *builtins, int demand_loading); /* set up a graphviz context - and init graph - retaining old API */ -extern GVC_t *gvContext(void); +GVC_API GVC_t *gvContext(void); /* set up a graphviz context - and init graph - with builtins */ -extern GVC_t *gvContextPlugins(const lt_symlist_t *builtins, int demand_loading); +GVC_API GVC_t *gvContextPlugins(const lt_symlist_t *builtins, int demand_loading); /* get information associated with a graphviz context */ -extern char **gvcInfo(GVC_t*); -extern char *gvcVersion(GVC_t*); -extern char *gvcBuildDate(GVC_t*); +GVC_API char **gvcInfo(GVC_t*); +GVC_API char *gvcVersion(GVC_t*); +GVC_API char *gvcBuildDate(GVC_t*); /* 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); -extern graph_t *gvPluginsGraph(GVC_t *gvc); +GVC_API int gvParseArgs(GVC_t *gvc, int argc, char **argv); +GVC_API graph_t *gvNextInputGraph(GVC_t *gvc); +GVC_API graph_t *gvPluginsGraph(GVC_t *gvc); /* Compute a layout using a specified engine */ -extern int gvLayout(GVC_t *gvc, graph_t *g, const char *engine); +GVC_API int gvLayout(GVC_t *gvc, graph_t *g, const char *engine); /* Compute a layout using layout engine from command line args */ -extern int gvLayoutJobs(GVC_t *gvc, graph_t *g); +GVC_API int gvLayoutJobs(GVC_t *gvc, graph_t *g); /* Render layout into string attributes of the graph */ -extern void attach_attrs(graph_t *g); +GVC_API void attach_attrs(graph_t *g); /* Render layout in a specified format to an open FILE */ -extern int gvRender(GVC_t *gvc, graph_t *g, const char *format, FILE *out); +GVC_API int gvRender(GVC_t *gvc, graph_t *g, const char *format, FILE *out); /* Render layout in a specified format to a file with the given name */ -extern int gvRenderFilename(GVC_t *gvc, graph_t *g, const char *format, const char *filename); +GVC_API int gvRenderFilename(GVC_t *gvc, graph_t *g, const char *format, const char *filename); -/* Render layout in a specified format to an external context */ -extern int gvRenderContext(GVC_t *gvc, graph_t *g, const char *format, void *context); +/* Render layout in a specified format to an GVC_APIal context */ +GVC_API int gvRenderContext(GVC_t *gvc, graph_t *g, const char *format, void *context); /* Render layout in a specified format to a malloc'ed string */ -extern int gvRenderData(GVC_t *gvc, graph_t *g, const char *format, char **result, unsigned int *length); +GVC_API int gvRenderData(GVC_t *gvc, graph_t *g, const char *format, char **result, unsigned int *length); /* Free memory allocated and pointed to by *result in gvRenderData */ -extern void gvFreeRenderData (char* data); +GVC_API void gvFreeRenderData (char* data); /* Render layout according to -T and -o options found by gvParseArgs */ -extern int gvRenderJobs(GVC_t *gvc, graph_t *g); +GVC_API int gvRenderJobs(GVC_t *gvc, graph_t *g); /* Clean up layout data structures - layouts are not nestable (yet) */ -extern int gvFreeLayout(GVC_t *gvc, graph_t *g); +GVC_API int gvFreeLayout(GVC_t *gvc, graph_t *g); /* Clean up graphviz context */ -extern void gvFinalize(GVC_t *gvc); -extern int gvFreeContext(GVC_t *gvc); +GVC_API void gvFinalize(GVC_t *gvc); +GVC_API int gvFreeContext(GVC_t *gvc); /* Return list of plugins of type kind. * kind would normally be "render" "layout" "textlayout" "device" "loadimage" @@ -102,20 +105,20 @@ extern int gvFreeContext(GVC_t *gvc); * At present, the str argument is unused, but may be used to modify * the search as in gvplugin_list above. */ -extern char** gvPluginList (GVC_t *gvc, const char* kind, int* sz, char*); +GVC_API char** gvPluginList (GVC_t *gvc, const char* kind, int* sz, char*); /** Add a library from your user application * @param gvc Graphviz context to add library to * @param lib library to add */ -extern void gvAddLibrary(GVC_t *gvc, gvplugin_library_t *lib); +GVC_API void gvAddLibrary(GVC_t *gvc, gvplugin_library_t *lib); /** Perform a Transitive Reduction on a graph * @param g graph to be transformed. */ -extern int gvToolTred(graph_t *g); +GVC_API int gvToolTred(graph_t *g); -#undef extern +#undef GVC_API #ifdef __cplusplus } -- 2.40.0