summaryrefslogtreecommitdiff
path: root/libvaladoc/gvc-compat.c
blob: 5846334632ebdbc2c088e4929ca2781ebe575fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* gvc-compat.c
 *
 * Copyright (C) 2017  Rico Tzschichholz
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 * Author:
 *  Rico Tzschichholz <ricotz@ubuntu.com>
 */

#include <gvc.h>

/* Compat-layer for Graphviz with/without cgraph support */

void
valadoc_compat_gvc_init (void);

Agnode_t*
valadoc_compat_gvc_graph_create_node (Agraph_t* graph, const char *name);

Agraph_t*
valadoc_compat_gvc_graph_new (const char *name);

Agedge_t*
valadoc_compat_gvc_graph_create_edge (Agraph_t* graph, Agnode_t* from, Agnode_t* to);

void
valadoc_compat_gvc_init (void)
{
#ifndef WITH_CGRAPH
	aginit ();
#endif
}

Agnode_t*
valadoc_compat_gvc_graph_create_node (Agraph_t* graph, const char *name)
{
#ifdef WITH_CGRAPH
	return agnode (graph, (char*) name, TRUE);
#else
	return agnode (graph, (char*) name);
#endif
}

Agraph_t*
valadoc_compat_gvc_graph_new (const char *name)
{
#ifdef WITH_CGRAPH
	return agopen ((char*) name, Agdirected, NULL);
#else
	return agopen ((char*) name, AGDIGRAPH);
#endif
}

Agedge_t*
valadoc_compat_gvc_graph_create_edge (Agraph_t* graph, Agnode_t* from, Agnode_t* to)
{
#ifdef WITH_CGRAPH
	return agedge (graph, from, to, NULL, TRUE);
#else
	return agedge (graph, from, to);
#endif
}