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_DLL
32#ifndef GVC_EXPORTS
33#define extern __declspec(dllimport)
34#endif
35#endif
36/*end visual studio*/
37
38/* misc */
39/* FIXME - this needs eliminating or renaming */
40extern void gvToggle(int);
41
42/* set up a graphviz context */
43extern GVC_t *gvNEWcontext(const lt_symlist_t *builtins, int demand_loading);
44
45/* set up a graphviz context - and init graph - retaining old API */
46extern GVC_t *gvContext(void);
47/* set up a graphviz context - and init graph - with builtins */
48extern GVC_t *gvContextPlugins(const lt_symlist_t *builtins, int demand_loading);
49
50/* get information associated with a graphviz context */
51extern char **gvcInfo(GVC_t*);
52extern char *gvcVersion(GVC_t*);
53extern char *gvcBuildDate(GVC_t*);
54
55/* parse command line args - minimally argv[0] sets layout engine */
56extern int gvParseArgs(GVC_t *gvc, int argc, char **argv);
57extern graph_t *gvNextInputGraph(GVC_t *gvc);
58extern graph_t *gvPluginsGraph(GVC_t *gvc);
59
60/* Compute a layout using a specified engine */
61extern int gvLayout(GVC_t *gvc, graph_t *g, const char *engine);
62
63/* Compute a layout using layout engine from command line args */
64extern int gvLayoutJobs(GVC_t *gvc, graph_t *g);
65
66/* Render layout into string attributes of the graph */
67extern void attach_attrs(graph_t *g);
68
69/* Render layout in a specified format to an open FILE */
70extern int gvRender(GVC_t *gvc, graph_t *g, const char *format, FILE *out);
71
72/* Render layout in a specified format to an open FILE */
73extern int gvRenderFilename(GVC_t *gvc, graph_t *g, const char *format, const char *filename);
74
75/* Render layout in a specified format to an external context */
76extern int gvRenderContext(GVC_t *gvc, graph_t *g, const char *format, void *context);
77
78/* Render layout in a specified format to a malloc'ed string */
79extern int gvRenderData(GVC_t *gvc, graph_t *g, const char *format, char **result, unsigned int *length);
80
81/* Free memory allocated and pointed to by *result in gvRenderData */
82extern void gvFreeRenderData (char* data);
83
84/* Render layout according to -T and -o options found by gvParseArgs */
85extern int gvRenderJobs(GVC_t *gvc, graph_t *g);
86
87/* Clean up layout data structures - layouts are not nestable (yet) */
88extern int gvFreeLayout(GVC_t *gvc, graph_t *g);
89
90/* Clean up graphviz context */
91extern void gvFinalize(GVC_t *gvc);
92extern int gvFreeContext(GVC_t *gvc);
93
94/* Return list of plugins of type kind.
95 * kind would normally be "render" "layout" "textlayout" "device" "loadimage"
96 * The size of the list is stored in sz.
97 * The caller is responsible for freeing the storage. This involves
98 * freeing each item, then the list.
99 * Returns NULL on error, or if there are no plugins.
100 * In the former case, sz is unchanged; in the latter, sz = 0.
101 *
102 * At present, the str argument is unused, but may be used to modify
103 * the search as in gvplugin_list above.
104 */
105extern char** gvPluginList (GVC_t *gvc, char* kind, int* sz, char*);
106
107/** Add a library from your user application
108 * @param gvc Graphviz context to add library to
109 * @param lib library to add
110 */
111
112extern void gvAddLibrary(GVC_t *gvc, gvplugin_library_t *lib);
113
114#undef extern
115
116#ifdef __cplusplus
117}
118#endif
119
120#endif /* GVC_H */
121