Graphviz 13.0.0~dev.20241220.2304
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#include <stddef.h>
28
29#include "types.h"
30#include "gvplugin.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#ifdef GVDLL
37#ifdef GVC_EXPORTS
38#define GVC_API __declspec(dllexport)
39#else
40#define GVC_API __declspec(dllimport)
41#endif
42#endif
43
44#ifndef GVC_API
45#define GVC_API /* nothing */
46#endif
47
51
52#define LAYOUT_DONE(g) (agbindrec(g, "Agraphinfo_t", 0, true) && GD_drawing(g))
53
54/* misc */
55/* FIXME - this needs eliminating or renaming */
56GVC_API void gvToggle(int);
57
58/* set up a graphviz context */
59GVC_API GVC_t *gvNEWcontext(const lt_symlist_t *builtins, int demand_loading);
60
61/* set up a graphviz context - and init graph - retaining old API */
62GVC_API GVC_t *gvContext(void);
63/* set up a graphviz context - and init graph - with builtins */
64GVC_API GVC_t *gvContextPlugins(const lt_symlist_t *builtins, int demand_loading);
65
66/* get information associated with a graphviz context */
67GVC_API char **gvcInfo(GVC_t*);
68GVC_API char *gvcVersion(GVC_t*);
69GVC_API char *gvcBuildDate(GVC_t*);
70
71/* parse command line args - minimally argv[0] sets layout engine */
72GVC_API int gvParseArgs(GVC_t *gvc, int argc, char **argv);
75
76/* Compute a layout using a specified engine */
77GVC_API int gvLayout(GVC_t *gvc, graph_t *g, const char *engine);
78
79/* Compute a layout using layout engine from command line args */
80GVC_API int gvLayoutJobs(GVC_t *gvc, graph_t *g);
81
82/* Check if a layout has been done */
83GVC_API bool gvLayoutDone(graph_t *g);
84
85/* Render layout into string attributes of the graph */
86GVC_API void attach_attrs(graph_t *g);
87
88/* Render layout in a specified format to an open FILE */
89GVC_API int gvRender(GVC_t *gvc, graph_t *g, const char *format, FILE *out);
90
91/* Render layout in a specified format to a file with the given name */
92GVC_API int gvRenderFilename(GVC_t *gvc, graph_t *g, const char *format, const char *filename);
93
94/* Render layout in a specified format to an GVC_APIal context */
95GVC_API int gvRenderContext(GVC_t *gvc, graph_t *g, const char *format, void *context);
96
97/* Render layout in a specified format to a malloc'ed string */
98GVC_API int gvRenderData(GVC_t *gvc, graph_t *g, const char *format,
99 char **result, size_t *length);
100
101/* Free memory allocated and pointed to by *result in gvRenderData */
102GVC_API void gvFreeRenderData (char* data);
103
104/* Render layout according to -T and -o options found by gvParseArgs */
105GVC_API int gvRenderJobs(GVC_t *gvc, graph_t *g);
106
107/* Clean up layout data structures - layouts are not nestable (yet) */
108GVC_API int gvFreeLayout(GVC_t *gvc, graph_t *g);
109
110/* Clean up graphviz context */
111GVC_API void gvFinalize(GVC_t *gvc);
112GVC_API int gvFreeContext(GVC_t *gvc);
113
114/* Return list of plugins of type kind.
115 * kind would normally be "render" "layout" "textlayout" "device" "loadimage"
116 * The size of the list is stored in sz.
117 * The caller is responsible for freeing the storage. This involves
118 * freeing each item, then the list.
119 * Returns NULL on error, or if there are no plugins.
120 * In the former case, sz is unchanged; in the latter, sz = 0.
121 */
122GVC_API char **gvPluginList(GVC_t *gvc, const char *kind, int *sz);
123
128GVC_API void gvAddLibrary(GVC_t *gvc, gvplugin_library_t *lib);
129
133GVC_API int gvToolTred(graph_t *g);
134
136
137#undef GVC_API
138
139#ifdef __cplusplus
140}
141#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:427
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:501
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:401
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:3893
int gvRenderData(GVC_t *gvc, graph_t *g, const char *format, char **result, size_t *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:208
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:394
int gvToolTred(graph_t *g)
Definition gvtool_tred.c:70
static GVC_t * gvc
Definition gv.cpp:23
GVIO_API const char * format
Definition gvio.h:51
static gvloadimage_engine_t engine
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