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 |
21 | extern "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 */ |
40 | extern void gvToggle(int); |
41 | |
42 | /* set up a graphviz context */ |
43 | extern GVC_t *gvNEWcontext(const lt_symlist_t *builtins, int demand_loading); |
44 | |
45 | /* set up a graphviz context - and init graph - retaining old API */ |
46 | extern GVC_t *gvContext(void); |
47 | /* set up a graphviz context - and init graph - with builtins */ |
48 | extern GVC_t *gvContextPlugins(const lt_symlist_t *builtins, int demand_loading); |
49 | |
50 | /* get information associated with a graphviz context */ |
51 | extern char **gvcInfo(GVC_t*); |
52 | extern char *gvcVersion(GVC_t*); |
53 | extern char *gvcBuildDate(GVC_t*); |
54 | |
55 | /* parse command line args - minimally argv[0] sets layout engine */ |
56 | extern int gvParseArgs(GVC_t *gvc, int argc, char **argv); |
57 | extern graph_t *gvNextInputGraph(GVC_t *gvc); |
58 | extern graph_t *gvPluginsGraph(GVC_t *gvc); |
59 | |
60 | /* Compute a layout using a specified engine */ |
61 | extern int gvLayout(GVC_t *gvc, graph_t *g, const char *engine); |
62 | |
63 | /* Compute a layout using layout engine from command line args */ |
64 | extern int gvLayoutJobs(GVC_t *gvc, graph_t *g); |
65 | |
66 | /* Render layout into string attributes of the graph */ |
67 | extern void attach_attrs(graph_t *g); |
68 | |
69 | /* Render layout in a specified format to an open FILE */ |
70 | extern 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 */ |
73 | extern 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 */ |
76 | extern 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 */ |
79 | extern 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 */ |
82 | extern void gvFreeRenderData (char* data); |
83 | |
84 | /* Render layout according to -T and -o options found by gvParseArgs */ |
85 | extern int gvRenderJobs(GVC_t *gvc, graph_t *g); |
86 | |
87 | /* Clean up layout data structures - layouts are not nestable (yet) */ |
88 | extern int gvFreeLayout(GVC_t *gvc, graph_t *g); |
89 | |
90 | /* Clean up graphviz context */ |
91 | extern void gvFinalize(GVC_t *gvc); |
92 | extern 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 | */ |
105 | extern 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 | |
112 | extern 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 | |