4 * Copyright (C) 2009 Martin Olsson
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * Martin Olsson <martin@minimum.se>
24 [CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "graphviz/gvc.h")]
27 [CCode (cname = "aginitlib", cheader_filename="gvc.h")]
28 public void initlib ( size_t graphinfo, size_t nodeinfo, size_t edgeinfo);
30 [CCode (cname = "aginit")]
32 public void init (Graph g, int kind, string rec_name, bool move_to_front);
39 [CCode (cname = "Agdesc_t")]
43 public Desc Agdirected; // Desc.DIRECTED | Desc.MAINGRAPH;
44 public Desc Agstrictdirected; // Desc.DIRECTED | Desc.STRICT | Desc.MAINGRAPH;
45 public Desc Agundirected; // Desc.MAINGRAPH;
46 public Desc Agstrictundirected; // Desc.STRICT | Desc.MAINGRAPH;
48 [CCode (cprefix = "", has_type_id = false)]
49 public enum GraphKind {
58 [CCode (cname = "agerrlevel_t", cheader_filename = "gvc.h", cprefix = "", has_type_id = false)]
59 public enum ErrorLevel {
67 [CCode (cname = "GVC_t", free_function = "gvFreeContext")]
68 public class Context {
69 [CCode (cname = "gvContext")]
72 [CCode (cname = "gvParseArgs")]
73 public int parse_args ( [CCode (array_length_pos = 0.9)] string[] argv );
75 [CCode (cname = "gvLayout")]
76 public int layout (Graph graph, [CCode (type = "char*")] string layout_engine);
78 [CCode (cname = "gvFreeLayout")]
79 public int free_layout (Graph graph);
81 [CCode (cname = "gvRender")]
82 public int render (Graph graph, [CCode (type = "char*")] string file_type, GLib.FileStream? file);
84 [CCode (cname = "gvRenderFilename")]
85 public int render_filename (Graph graph, [CCode (type = "char*")] string file_type, [CCode (type = "char*")] string filename);
87 [CCode (cname = "gvLayoutJobs")]
88 public int layout_jobs (Graph graph);
90 [CCode (cname = "gvRenderJobs")]
91 public int render_jobs (Graph graph);
93 [CCode (cname = "gvRenderData")]
94 public int render_data (Graph graph, [CCode (type = "char*")] string file_type, [CCode (type = "char**")] out uint8[] output_data);
98 [CCode (cname = "Agnode_t", ref_function = "", unref_function = "", free_function = "")]
100 [CCode (cname = "name")]
103 [CCode (cname = "agget")]
104 public unowned string? get ([CCode (type = "char*")] string attribute_name);
106 [CCode (cname = "agset")]
107 public void set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value);
109 [CCode (cname = "agsafeset")]
110 public void safe_set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value, [CCode (type = "char*")] string? default_value);
114 [CCode (cname = "Agedge_t", ref_function = "", unref_function = "", free_function = "")]
116 [CCode (cname = "agget")]
117 public unowned string? get ([CCode (type = "char*")] string attribute_name);
119 [CCode (cname = "agset")]
120 public int set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value);
122 [CCode (cname = "agsafeset")]
123 public int safe_set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value, [CCode (type = "char*")] string? default_value);
127 [CCode (cname = "Agraph_t", free_function = "agclose")]
129 [CCode (cname = "agopen")]
131 public Graph ([CCode (type = "char*")] string graph_name, Desc desc, int disc = 0);
133 public Graph ([CCode (type = "char*")] string graph_name, GraphKind kind);
136 [CCode (cname = "agread")]
137 public static Graph read (GLib.FileStream file);
139 [CCode (cname = "agmemread")]
140 public static Graph read_string (string str);
142 [CCode (cname = "agnode")]
144 public Node create_node ([CCode (type = "char*")] string node_name, int createflag = 1);
146 public Node create_node ([CCode (type = "char*")] string node_name);
149 [CCode (cname = "agedge")]
151 public Edge create_edge (Node from, Node to, string? name = null, int createflag = 1);
153 public Edge create_edge (Node from, Node to);
156 [CCode (cname = "agsubg")]
157 public unowned Graph create_subgraph ([CCode (type = "char*")] string? name);
159 [CCode (cname = "agfindsubg")]
160 public Graph find_subgraph ([CCode (type = "char*")] string name);
162 [CCode (cname = "agidsubg")]
163 public Graph create_subgraph_id (ulong id);
165 [CCode (cname = "agfstsubg")]
166 public Graph get_first_subgraph ();
168 [CCode (cname = "agnxtsubg")]
169 public Graph get_next_subgraph ();
171 [CCode (cname = "agparent")]
172 public Graph get_parent_graph ();
174 [CCode (cname = "agdelsubg")]
175 public int delete_subgraph (Graph subgraph);
177 [CCode (cname = "agfindnode")]
178 public Node? find_node ([CCode (type = "char*")] string node_name);
180 [CCode (cname = "agfstnode")]
181 public Node? get_first_node ();
183 [CCode (cname = "agnxtnode")]
184 public Node? get_next_node (Node node);
186 [CCode (cname = "agget")]
187 public unowned string? get ([CCode (type = "char*")] string attribute_name);
189 [CCode (cname = "agset")]
190 public int set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value);
192 [CCode (cname = "agsafeset")]
193 public int safe_set ([CCode (type = "char*")] string attribute_name, [CCode (type = "char*")] string attribute_value, [CCode (type = "char*")] string? default_value);
195 [CCode (cname = "AG_IS_DIRECTED")]
196 public bool is_directed ();
198 [CCode (cname = "AG_IS_STRICT")]
199 public bool is_strict ();
203 [CCode (cname = "char", copy_function = "agdupstr_html", free_function = "agstrfree")]
204 public class HtmlString : string {
205 [CCode (cname = "agstrdup_html")]
206 public HtmlString (string markup);
209 [CCode(cprefix = "ag")]
211 [CCode (cname = "agerrno")]
212 public static ErrorLevel errno;
214 [CCode (cname = "agerr")]
216 public static int error (ErrorLevel level, string fmt, ...);
218 [CCode (cname = "agerrors")]
219 public static int errors ();
221 [CCode (cname = "agseterr")]
222 public static void set_error (ErrorLevel err);
224 [CCode (cname = "aglasterr")]
225 public static string? last_error ();
227 [CCode (cname = "agerrorf")]
229 public static void errorf (string format, ...);
231 [CCode (cname = "agwarningf")]
233 void warningf (string fmt, ...);