1/* $Id$ $Revision$ */
2/* vim:set shiftwidth=4 ts=8: */
3
4/*************************************************************************
5 * Copyright (c) 2011 AT&T Intellectual Property
6 * All rights reserved. This program and the accompanying materials
7 * are made available under the terms of the Eclipse Public License v1.0
8 * which accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
10 *
11 * Contributors: See CVS logs. Details at http://www.graphviz.org/
12 *************************************************************************/
13
14#ifndef GVC_H
15#define GVC_H
16
17#include "types.h"
18#include "gvplugin.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#ifdef GVDLL
25#define extern __declspec(dllexport)
26#else
27#define extern
28#endif
29
30/*visual studio*/
31#ifdef _WIN32
32#ifndef GVC_EXPORTS
33#undef extern
34#define extern __declspec(dllimport)
35#endif
36#endif
37/*end visual studio*/
38
39#define LAYOUT_DONE(g) (agbindrec(g, "Agraphinfo_t", 0, TRUE) && GD_drawing(g))
40
41/* misc */
42/* FIXME - this needs eliminating or renaming */
43extern void gvToggle(int);
44
45/* set up a graphviz context */
46extern GVC_t *gvNEWcontext(const lt_symlist_t *builtins, int demand_loading);
47
48/* set up a graphviz context - and init graph - retaining old API */
49extern GVC_t *gvContext(void);
50/* set up a graphviz context - and init graph - with builtins */
51extern GVC_t *gvContextPlugins(const lt_symlist_t *builtins, int demand_loading);
52
53/* get information associated with a graphviz context */
54extern char **gvcInfo(GVC_t*);
55extern char *gvcVersion(GVC_t*);
56extern char *gvcBuildDate(GVC_t*);
57
58/* parse command line args - minimally argv[0] sets layout engine */
59extern int gvParseArgs(GVC_t *gvc, int argc, char **argv);
60extern graph_t *gvNextInputGraph(GVC_t *gvc);
61extern graph_t *gvPluginsGraph(GVC_t *gvc);
62
63/* Compute a layout using a specified engine */
64extern int gvLayout(GVC_t *gvc, graph_t *g, const char *engine);
65
66/* Compute a layout using layout engine from command line args */
67extern int gvLayoutJobs(GVC_t *gvc, graph_t *g);
68
69/* Render layout into string attributes of the graph */
70extern void attach_attrs(graph_t *g);
71
72/* Render layout in a specified format to an open FILE */
73extern int gvRender(GVC_t *gvc, graph_t *g, const char *format, FILE *out);
74
75/* Render layout in a specified format to a file with the given name */
76extern int gvRenderFilename(GVC_t *gvc, graph_t *g, const char *format, const char *filename);
77
78/* Render layout in a specified format to an external context */
79extern int gvRenderContext(GVC_t *gvc, graph_t *g, const char *format, void *context);
80
81/* Render layout in a specified format to a malloc'ed string */
82extern int gvRenderData(GVC_t *gvc, graph_t *g, const char *format, char **result, unsigned int *length);
83
84/* Free memory allocated and pointed to by *result in gvRenderData */
85extern void gvFreeRenderData (char* data);
86
87/* Render layout according to -T and -o options found by gvParseArgs */
88extern int gvRenderJobs(GVC_t *gvc, graph_t *g);
89
90/* Clean up layout data structures - layouts are not nestable (yet) */
91extern int gvFreeLayout(GVC_t *gvc, graph_t *g);
92
93/* Clean up graphviz context */
94extern void gvFinalize(GVC_t *gvc);
95extern int gvFreeContext(GVC_t *gvc);
96
97/* Return list of plugins of type kind.
98 * kind would normally be "render" "layout" "textlayout" "device" "loadimage"
99 * The size of the list is stored in sz.
100 * The caller is responsible for freeing the storage. This involves
101 * freeing each item, then the list.
102 * Returns NULL on error, or if there are no plugins.
103 * In the former case, sz is unchanged; in the latter, sz = 0.
104 *
105 * At present, the str argument is unused, but may be used to modify
106 * the search as in gvplugin_list above.
107 */
108extern char** gvPluginList (GVC_t *gvc, const char* kind, int* sz, char*);
109
110/** Add a library from your user application
111 * @param gvc Graphviz context to add library to
112 * @param lib library to add
113 */
114extern void gvAddLibrary(GVC_t *gvc, gvplugin_library_t *lib);
115
116/** Perform a Transitive Reduction on a graph
117 * @param g graph to be transformed.
118 */
119extern int gvToolTred(graph_t *g);
120
121#undef extern
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* GVC_H */
128