Graphviz 12.0.1~dev.20240715.2254
Loading...
Searching...
No Matches
gvc.h
Go to the documentation of this file.
1
14/*************************************************************************
15 * Copyright (c) 2011 AT&T Intellectual Property
16 * All rights reserved. This program and the accompanying materials
17 * are made available under the terms of the Eclipse Public License v1.0
18 * which accompanies this distribution, and is available at
19 * https://www.eclipse.org/legal/epl-v10.html
20 *
21 * Contributors: Details at https://graphviz.org
22 *************************************************************************/
23
24#pragma once
25
26#include <stdbool.h>
27
28#include "types.h"
29#include "gvplugin.h"
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35#ifdef GVDLL
36#ifdef GVC_EXPORTS
37#define GVC_API __declspec(dllexport)
38#else
39#define GVC_API __declspec(dllimport)
40#endif
41#endif
42
43#ifndef GVC_API
44#define GVC_API /* nothing */
45#endif
46
50
51#define LAYOUT_DONE(g) (agbindrec(g, "Agraphinfo_t", 0, true) && GD_drawing(g))
52
53/* misc */
54/* FIXME - this needs eliminating or renaming */
55GVC_API void gvToggle(int);
56
57/* set up a graphviz context */
58GVC_API GVC_t *gvNEWcontext(const lt_symlist_t *builtins, int demand_loading);
59
60/* set up a graphviz context - and init graph - retaining old API */
61GVC_API GVC_t *gvContext(void);
62/* set up a graphviz context - and init graph - with builtins */
63GVC_API GVC_t *gvContextPlugins(const lt_symlist_t *builtins, int demand_loading);
64
65/* get information associated with a graphviz context */
66GVC_API char **gvcInfo(GVC_t*);
67GVC_API char *gvcVersion(GVC_t*);
68GVC_API char *gvcBuildDate(GVC_t*);
69
70/* parse command line args - minimally argv[0] sets layout engine */
71GVC_API int gvParseArgs(GVC_t *gvc, int argc, char **argv);
74
75/* Compute a layout using a specified engine */
76GVC_API int gvLayout(GVC_t *gvc, graph_t *g, const char *engine);
77
78/* Compute a layout using layout engine from command line args */
79GVC_API int gvLayoutJobs(GVC_t *gvc, graph_t *g);
80
81/* Check if a layout has been done */
82GVC_API bool gvLayoutDone(graph_t *g);
83
84/* Render layout into string attributes of the graph */
85GVC_API void attach_attrs(graph_t *g);
86
87/* Render layout in a specified format to an open FILE */
88GVC_API int gvRender(GVC_t *gvc, graph_t *g, const char *format, FILE *out);
89
90/* Render layout in a specified format to a file with the given name */
91GVC_API int gvRenderFilename(GVC_t *gvc, graph_t *g, const char *format, const char *filename);
92
93/* Render layout in a specified format to an GVC_APIal context */
94GVC_API int gvRenderContext(GVC_t *gvc, graph_t *g, const char *format, void *context);
95
96/* Render layout in a specified format to a malloc'ed string */
97GVC_API int gvRenderData(GVC_t *gvc, graph_t *g, const char *format, char **result, unsigned int *length);
98
99/* Free memory allocated and pointed to by *result in gvRenderData */
100GVC_API void gvFreeRenderData (char* data);
101
102/* Render layout according to -T and -o options found by gvParseArgs */
103GVC_API int gvRenderJobs(GVC_t *gvc, graph_t *g);
104
105/* Clean up layout data structures - layouts are not nestable (yet) */
106GVC_API int gvFreeLayout(GVC_t *gvc, graph_t *g);
107
108/* Clean up graphviz context */
109GVC_API void gvFinalize(GVC_t *gvc);
110GVC_API int gvFreeContext(GVC_t *gvc);
111
112/* Return list of plugins of type kind.
113 * kind would normally be "render" "layout" "textlayout" "device" "loadimage"
114 * The size of the list is stored in sz.
115 * The caller is responsible for freeing the storage. This involves
116 * freeing each item, then the list.
117 * Returns NULL on error, or if there are no plugins.
118 * In the former case, sz is unchanged; in the latter, sz = 0.
119 */
120GVC_API char **gvPluginList(GVC_t *gvc, const char *kind, int *sz);
121
126GVC_API void gvAddLibrary(GVC_t *gvc, gvplugin_library_t *lib);
127
131GVC_API int gvToolTred(graph_t *g);
132
134
135#undef GVC_API
136
137#ifdef __cplusplus
138}
139#endif
static void out(agerrlevel_t level, const char *fmt, va_list args)
Report messages using a user-supplied or default write function.
Definition agerror.c:84
bool gvLayoutDone(graph_t *g)
Definition gvlayout.c:94
void gvAddLibrary(GVC_t *gvc, gvplugin_library_t *lib)
Definition gvc.c:228
int gvParseArgs(GVC_t *gvc, int argc, char **argv)
Definition args.c:220
char ** gvPluginList(GVC_t *gvc, const char *kind, int *sz)
Definition gvplugin.c:417
GVC_t * gvNEWcontext(const lt_symlist_t *builtins, int demand_loading)
Definition gvcontext.c:45
void gvFinalize(GVC_t *gvc)
Definition gvcontext.c:57
graph_t * gvNextInputGraph(GVC_t *gvc)
Definition input.c:505
int gvFreeLayout(GVC_t *gvc, graph_t *g)
Definition gvlayout.c:105
char * gvcBuildDate(GVC_t *)
Definition gvc.c:235
void gvToggle(int)
Definition utils.c:402
int gvLayout(GVC_t *gvc, graph_t *g, const char *engine)
Definition gvc.c:52
GVC_t * gvContext(void)
Definition gvc.c:24
int gvRender(GVC_t *gvc, graph_t *g, const char *format, FILE *out)
Definition gvc.c:84
int gvRenderJobs(GVC_t *gvc, graph_t *g)
Definition emit.c:3912
int gvRenderData(GVC_t *gvc, graph_t *g, const char *format, char **result, unsigned int *length)
Definition gvc.c:175
int gvLayoutJobs(GVC_t *gvc, graph_t *g)
Definition gvlayout.c:53
GVC_t * gvContextPlugins(const lt_symlist_t *builtins, int demand_loading)
Definition gvc.c:35
char ** gvcInfo(GVC_t *)
Definition gvc.c:233
char * gvcVersion(GVC_t *)
Definition gvc.c:234
int gvFreeContext(GVC_t *gvc)
Definition gvcontext.c:64
void gvFreeRenderData(char *data)
Definition gvc.c:223
int gvRenderContext(GVC_t *gvc, graph_t *g, const char *format, void *context)
Definition gvc.c:143
graph_t * gvPluginsGraph(GVC_t *gvc)
Definition input.c:206
int gvRenderFilename(GVC_t *gvc, graph_t *g, const char *format, const char *filename)
Definition gvc.c:114
void attach_attrs(graph_t *g)
Definition output.c:383
int gvToolTred(graph_t *g)
Definition gvtool_tred.c:70
GVIO_API const char * format
Definition gvio.h:51
static gvloadimage_engine_t engine
static Agdesc_t kind
Definition gvpack.cpp:88
GVC_t * gvc
Definition htmlparse.c:99
graph or subgraph
Definition cgraph.h:425
Definition gvcint.h:80
Definition legal.c:50
graphs, nodes and edges info: Agraphinfo_t, Agnodeinfo_t and Agedgeinfo_t