Skip to content

Commit 16ede53

Browse files
authored
Update graphviz to 8.1.0 (#53)
1 parent 88e5fd8 commit 16ede53

File tree

144 files changed

+980
-574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+980
-574
lines changed

GraphvizWrapper/Main.cpp

Lines changed: 96 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,39 @@ using namespace std;
1212

1313
extern "C" {
1414

15+
// Some wrappers around cgraph macros
16+
__declspec(dllexport) Agedge_t* rj_agmkin(Agedge_t* e);
17+
__declspec(dllexport) Agedge_t* rj_agmkout(Agedge_t* e);
18+
__declspec(dllexport) Agnode_t* rj_aghead(Agedge_t* edge);
19+
__declspec(dllexport) Agnode_t* rj_agtail(Agedge_t* edge);
20+
__declspec(dllexport) int rj_ageqedge(Agedge_t* e, Agedge_t* f);
21+
1522
// Some wrappers around existing cgraph functions to handle string marshaling
1623
__declspec(dllexport) const char* rj_agmemwrite(Agraph_t* g);
17-
__declspec(dllexport) Agraph_t* rj_agmemread(const char* s);
18-
__declspec(dllexport) const char* rj_agget(void* obj, char* name);
19-
__declspec(dllexport) const char* rj_agnameof(void* obj);
20-
__declspec(dllexport) Agraph_t* rj_agopen(char* name, int graphtype);
24+
__declspec(dllexport) Agraph_t* rj_agmemread(const char* s);
25+
__declspec(dllexport) const char* rj_agget(void* obj, char* name);
26+
__declspec(dllexport) const char* rj_agnameof(void* obj);
27+
__declspec(dllexport) Agraph_t* rj_agopen(char* name, int graphtype);
2128
__declspec(dllexport) const char* rj_sym_key(Agsym_t* sym);
2229

23-
__declspec(dllexport) double node_x(Agnode_t* node);
24-
__declspec(dllexport) double node_y(Agnode_t* node);
25-
__declspec(dllexport) double node_width(Agnode_t* node);
26-
__declspec(dllexport) double node_height(Agnode_t* node);
30+
__declspec(dllexport) double node_x(Agnode_t* node);
31+
__declspec(dllexport) double node_y(Agnode_t* node);
32+
__declspec(dllexport) double node_width(Agnode_t* node);
33+
__declspec(dllexport) double node_height(Agnode_t* node);
2734

28-
__declspec(dllexport) textlabel_t* node_label(Agnode_t* node);
29-
__declspec(dllexport) textlabel_t* edge_label(Agedge_t* edge);
30-
__declspec(dllexport) textlabel_t* graph_label(Agraph_t* graph);
35+
__declspec(dllexport) textlabel_t* node_label(Agnode_t* node);
36+
__declspec(dllexport) textlabel_t* edge_label(Agedge_t* edge);
37+
__declspec(dllexport) textlabel_t* graph_label(Agraph_t* graph);
3138

32-
__declspec(dllexport) double label_x(textlabel_t* label);
33-
__declspec(dllexport) double label_y(textlabel_t* label);
34-
__declspec(dllexport) double label_width(textlabel_t* label);
35-
__declspec(dllexport) double label_height(textlabel_t* label);
36-
__declspec(dllexport) const char* label_text(textlabel_t* label);
37-
__declspec(dllexport) double label_fontsize(textlabel_t* label);
38-
__declspec(dllexport) const char* label_fontname(textlabel_t* label);
39+
__declspec(dllexport) double label_x(textlabel_t* label);
40+
__declspec(dllexport) double label_y(textlabel_t* label);
41+
__declspec(dllexport) double label_width(textlabel_t* label);
42+
__declspec(dllexport) double label_height(textlabel_t* label);
43+
__declspec(dllexport) const char* label_text(textlabel_t* label);
44+
__declspec(dllexport) double label_fontsize(textlabel_t* label);
45+
__declspec(dllexport) const char* label_fontname(textlabel_t* label);
3946

40-
__declspec(dllexport) void clone_attribute_declarations(Agraph_t* from, Agraph_t* to);
47+
__declspec(dllexport) void clone_attribute_declarations(Agraph_t* from, Agraph_t* to);
4148
__declspec(dllexport) void convert_to_undirected(Agraph_t* graph);
4249
}
4350

@@ -46,66 +53,99 @@ extern "C" {
4653
// Probably expose a free_string() function that needs to be called by C#
4754
char* marshalCString(const char* s)
4855
{
49-
if (!s) return 0;
50-
int len = (int)strlen(s) + 1;
56+
if (!s) return 0;
57+
int len = (int)strlen(s) + 1;
5158
char* ptr = (char*)CoTaskMemAlloc(len);
52-
strcpy_s(ptr, len, s);
53-
return ptr;
59+
strcpy_s(ptr, len, s);
60+
return ptr;
5461
}
5562

5663

5764
static int rj_afread(void* stream, char* buffer, int bufsize)
5865
{
5966
istringstream* is = (istringstream*)stream;
60-
is->read(buffer, bufsize);
67+
is->read(buffer, bufsize);
6168
int result = (int)is->gcount();
62-
return result;
69+
return result;
6370
}
6471

6572
static int rj_putstr(void* stream, const char* s)
6673
{
6774
ostringstream* os = (ostringstream*)stream;
68-
(*os) << s;
69-
return 0;
75+
(*os) << s;
76+
return 0;
7077
}
7178

7279
static int rj_flush(void* stream)
7380
{
7481
ostringstream* os = (ostringstream*)stream;
75-
os->flush();
76-
return 0;
82+
os->flush();
83+
return 0;
7784
}
7885

7986
static Agiodisc_t memIoDisc = { rj_afread, rj_putstr, rj_flush };
8087
static Agdisc_t memDisc = { 0, 0, &memIoDisc };
8188

89+
/* directed, strict, no_loops, maingraph */
90+
Agdesc_t Agdirected = { 1, 0, 0, 1 };
91+
Agdesc_t Agstrictdirected = { 1, 1, 0, 1 };
92+
Agdesc_t Agundirected = { 0, 0, 0, 1 };
93+
Agdesc_t Agstrictundirected = { 0, 1, 0, 1 };
94+
//Agdesc_t Agdirected = { .directed = true, .maingraph = true };
95+
//Agdesc_t Agstrictdirected = { .directed = true, .strict = true, .maingraph = true };
96+
//Agdesc_t Agundirected = { .maingraph = true };
97+
//Agdesc_t Agstrictundirected = { .strict = true, .maingraph = true };
98+
99+
82100
Agraph_t* rj_agopen(char* name, int graphtype)
83101
{
84-
if (graphtype == 0)
85-
return agopen(name, Agdirected, &memDisc);
86-
if (graphtype == 1)
102+
if (graphtype == 0)
103+
return agopen(name, Agdirected, &memDisc);
104+
if (graphtype == 1)
87105
return agopen(name, Agstrictdirected, &memDisc);
88-
if (graphtype == 2)
106+
if (graphtype == 2)
89107
return agopen(name, Agundirected, &memDisc);
90-
if (graphtype == 3)
108+
if (graphtype == 3)
91109
return agopen(name, Agstrictundirected, &memDisc);
92110
return 0;
93111
}
94112

95113
Agraph_t* rj_agmemread(const char* s)
96114
{
97-
stringstream stream;
98-
stream << s;
99-
Agraph_t* g = agread(&stream, &memDisc);
100-
return g;
115+
stringstream stream;
116+
stream << s;
117+
Agraph_t* g = agread(&stream, &memDisc);
118+
return g;
119+
}
120+
121+
// Expose removed cgraph functions https://gitlab.com/graphviz/graphviz/-/issues/2433
122+
Agnode_t* rj_aghead(Agedge_t* edge)
123+
{
124+
return AGHEAD(edge);
125+
}
126+
Agnode_t* rj_agtail(Agedge_t* edge)
127+
{
128+
return AGTAIL(edge);
129+
}
130+
int rj_ageqedge(Agedge_t* e, Agedge_t* f)
131+
{
132+
return AGEQEDGE(e, f);
133+
}
134+
Agedge_t* rj_agmkin(Agedge_t* e)
135+
{
136+
return AGMKIN(e);
137+
}
138+
Agedge_t* rj_agmkout(Agedge_t* e)
139+
{
140+
return AGMKOUT(e);
101141
}
102142

103143
// Note: for this function to work, the graph has to be created with the memDisc, e.g. using rj_agopen
104144
const char* rj_agmemwrite(Agraph_t* g)
105145
{
106-
ostringstream os;
107-
agwrite(g, &os);
108-
return marshalCString(os.str().c_str());
146+
ostringstream os;
147+
agwrite(g, &os);
148+
return marshalCString(os.str().c_str());
109149
}
110150

111151

@@ -132,37 +172,37 @@ const char* rj_sym_key(Agsym_t* sym) { return marshalCString(sym->name); }
132172

133173
const char* rj_agget(void* obj, char* name)
134174
{
135-
char* result = agget(obj, name);
136-
return marshalCString(result);
175+
char* result = agget(obj, name);
176+
return marshalCString(result);
137177
}
138178

139179
const char* rj_agnameof(void* obj)
140180
{
141-
char* result = agnameof(obj);
142-
return marshalCString(result);
181+
char* result = agnameof(obj);
182+
return marshalCString(result);
143183
}
144184

145185
Agdisc_t* getdisc()
146186
{
147-
return &memDisc;
187+
return &memDisc;
148188
}
149189

150190
void clone_attribute_declarations(Agraph_t* from, Agraph_t* to)
151191
{
152-
for (int kind = 0; kind < 3; kind++)
153-
{
154-
Agsym_t* current = agnxtattr(from, kind, NULL);
155-
while (current)
156-
{
157-
agattr(to, kind, current->name, current->defval);
158-
current = agnxtattr(from, kind, current);
159-
}
160-
}
192+
for (int kind = 0; kind < 3; kind++)
193+
{
194+
Agsym_t* current = agnxtattr(from, kind, NULL);
195+
while (current)
196+
{
197+
agattr(to, kind, current->name, current->defval);
198+
current = agnxtattr(from, kind, current);
199+
}
200+
}
161201
}
162202

163203
void convert_to_undirected(Agraph_t* graph)
164204
{
165-
graph->desc.directed = 0;
205+
graph->desc.directed = 0;
166206
}
167207

168208
#pragma region "DEBUGGING AND TESTING"
56.5 KB
Binary file not shown.
74.5 KB
Binary file not shown.
82.5 KB
Binary file not shown.
1.5 KB
Binary file not shown.
56 KB
Binary file not shown.
5 KB
Binary file not shown.
53 KB
Binary file not shown.
631 KB
Binary file not shown.

GraphvizWrapper/graphvizfiles/Debug/config6

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ gvplugin_core.dll core {
4848
device {
4949
tk:tk 1
5050
}
51-
device {
52-
vml:vml 1
53-
}
5451
device {
5552
pic:pic -1
5653
}
@@ -85,9 +82,6 @@ gvplugin_core.dll core {
8582
render {
8683
tk 1
8784
}
88-
render {
89-
vml 1
90-
}
9185
render {
9286
pic -1
9387
}
@@ -138,11 +132,6 @@ gvplugin_core.dll core {
138132
eps:xdot 1
139133
svg:xdot 1
140134
svg:svg 1
141-
png:vml 1
142-
gif:vml 1
143-
jpeg:vml 1
144-
jpe:vml 1
145-
jpg:vml 1
146135
gif:tk 1
147136
}
148137
}

0 commit comments

Comments
 (0)