Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:42:49

0001 /**
0002  * @file
0003  * @brief Graphviz context library
0004  * @ingroup gvc_api
0005  *
0006  * **libgvc** provides a context for applications wishing to manipulate
0007  * and render graphs. It provides command line parsing,
0008  * common rendering code, and a plugin mechanism for renderers.
0009  *
0010  * [man 3 gvc](https://graphviz.org/pdf/gvc.3.pdf)
0011  *
0012  */
0013 
0014 /*************************************************************************
0015  * Copyright (c) 2011 AT&T Intellectual Property 
0016  * All rights reserved. This program and the accompanying materials
0017  * are made available under the terms of the Eclipse Public License v1.0
0018  * which accompanies this distribution, and is available at
0019  * https://www.eclipse.org/legal/epl-v10.html
0020  *
0021  * Contributors: Details at https://graphviz.org
0022  *************************************************************************/
0023 
0024 #pragma once
0025 
0026 #include <stdbool.h>
0027 
0028 #include "types.h"
0029 #include "gvplugin.h"
0030 
0031 #ifdef __cplusplus
0032 extern "C" {
0033 #endif
0034 
0035 #ifdef GVDLL
0036 #ifdef GVC_EXPORTS
0037 #define GVC_API __declspec(dllexport)
0038 #else
0039 #define GVC_API __declspec(dllimport)
0040 #endif
0041 #endif
0042 
0043 #ifndef GVC_API
0044 #define GVC_API /* nothing */
0045 #endif
0046 
0047 /// @defgroup gvc_api Graphviz context library (GVC) API
0048 /// @ingroup public_apis
0049 /// @{
0050     
0051 #define LAYOUT_DONE(g) (agbindrec(g, "Agraphinfo_t", 0, true) && GD_drawing(g))
0052 
0053 /* misc */
0054 /* FIXME - this needs eliminating or renaming */
0055 GVC_API void gvToggle(int);
0056 
0057 /* set up a graphviz context */
0058 GVC_API GVC_t *gvNEWcontext(const lt_symlist_t *builtins, int demand_loading);
0059 
0060 /*  set up a graphviz context - and init graph - retaining old API */
0061 GVC_API GVC_t *gvContext(void);
0062 /*  set up a graphviz context - and init graph - with builtins */
0063 GVC_API GVC_t *gvContextPlugins(const lt_symlist_t *builtins, int demand_loading);
0064 
0065 /* get information associated with a graphviz context */
0066 GVC_API char **gvcInfo(GVC_t*);
0067 GVC_API char *gvcVersion(GVC_t*);
0068 GVC_API char *gvcBuildDate(GVC_t*);
0069 
0070 /* parse command line args - minimally argv[0] sets layout engine */
0071 GVC_API int gvParseArgs(GVC_t *gvc, int argc, char **argv);
0072 GVC_API graph_t *gvNextInputGraph(GVC_t *gvc);
0073 GVC_API graph_t *gvPluginsGraph(GVC_t *gvc);
0074 
0075 /* Compute a layout using a specified engine */
0076 GVC_API int gvLayout(GVC_t *gvc, graph_t *g, const char *engine);
0077 
0078 /* Compute a layout using layout engine from command line args */
0079 GVC_API int gvLayoutJobs(GVC_t *gvc, graph_t *g);
0080 
0081 /* Check if a layout has been done */
0082 GVC_API bool gvLayoutDone(graph_t *g);
0083 
0084 /* Render layout into string attributes of the graph */
0085 GVC_API void attach_attrs(graph_t *g);
0086 
0087 /* Render layout in a specified format to an open FILE */
0088 GVC_API int gvRender(GVC_t *gvc, graph_t *g, const char *format, FILE *out);
0089 
0090 /* Render layout in a specified format to a file with the given name */
0091 GVC_API int gvRenderFilename(GVC_t *gvc, graph_t *g, const char *format, const char *filename);
0092 
0093 /* Render layout in a specified format to an GVC_APIal context */
0094 GVC_API int gvRenderContext(GVC_t *gvc, graph_t *g, const char *format, void *context);
0095 
0096 /* Render layout in a specified format to a malloc'ed string */
0097 GVC_API int gvRenderData(GVC_t *gvc, graph_t *g, const char *format, char **result, unsigned int *length);
0098 
0099 /* Free memory allocated and pointed to by *result in gvRenderData */
0100 GVC_API void gvFreeRenderData (char* data);
0101 
0102 /* Render layout according to -T and -o options found by gvParseArgs */
0103 GVC_API int gvRenderJobs(GVC_t *gvc, graph_t *g);
0104 
0105 /* Clean up layout data structures - layouts are not nestable (yet) */
0106 GVC_API int gvFreeLayout(GVC_t *gvc, graph_t *g);
0107 
0108 /* Clean up graphviz context */
0109 GVC_API void gvFinalize(GVC_t *gvc);
0110 GVC_API int gvFreeContext(GVC_t *gvc);
0111 
0112 /* Return list of plugins of type kind.
0113  * kind would normally be "render" "layout" "textlayout" "device" "loadimage"
0114  * The size of the list is stored in sz.
0115  * The caller is responsible for freeing the storage. This involves
0116  * freeing each item, then the list.
0117  * Returns NULL on error, or if there are no plugins.
0118  * In the former case, sz is unchanged; in the latter, sz = 0.
0119  */
0120 GVC_API char **gvPluginList(GVC_t *gvc, const char *kind, int *sz);
0121 
0122 /** Add a library from your user application
0123  * @param gvc Graphviz context to add library to
0124  * @param lib library to add
0125  */
0126 GVC_API void gvAddLibrary(GVC_t *gvc, gvplugin_library_t *lib);
0127 
0128 /** Perform a Transitive Reduction on a graph
0129  * @param g  graph to be transformed.
0130  */
0131 GVC_API int gvToolTred(graph_t *g);
0132 
0133 /// @}
0134 
0135 #undef GVC_API
0136 
0137 #ifdef __cplusplus
0138 }
0139 #endif