Skip to content

Commit 1f1cda8

Browse files
authored
Update graphviz to 9.0.0 (#77)
1 parent 34dbb90 commit 1f1cda8

Some content is hidden

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

106 files changed

+174
-157
lines changed

GraphvizWrapper/GraphvizWrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ static int rj_flush(void* stream)
3939
return 0;
4040
}
4141

42-
static Agiodisc_t memIoDisc = { rj_afread, rj_putstr, rj_flush };
43-
static Agdisc_t memDisc = { 0, 0, &memIoDisc };
42+
static Agiodisc_t ioDisc = { rj_afread, rj_putstr, rj_flush };
43+
static Agdisc_t disc = { 0, &ioDisc };
4444

4545
extern "C" {
4646

GraphvizWrapper/Main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@ void free_str(char* str) {
1616
Agraph_t* rj_agopen(char* name, int graphtype)
1717
{
1818
if (graphtype == 0)
19-
return agopen(name, Agdirected, &memDisc);
19+
return agopen(name, Agdirected, &disc);
2020
if (graphtype == 1)
21-
return agopen(name, Agstrictdirected, &memDisc);
21+
return agopen(name, Agstrictdirected, &disc);
2222
if (graphtype == 2)
23-
return agopen(name, Agundirected, &memDisc);
23+
return agopen(name, Agundirected, &disc);
2424
if (graphtype == 3)
25-
return agopen(name, Agstrictundirected, &memDisc);
25+
return agopen(name, Agstrictundirected, &disc);
2626
return 0;
2727
}
2828

2929
Agraph_t* rj_agmemread(const char* s)
3030
{
3131
stringstream stream;
3232
stream << s;
33-
Agraph_t* g = agread(&stream, &memDisc);
33+
Agraph_t* g = agread(&stream, &disc);
3434
return g;
3535
}
3636

37-
// Note: for this function to work, the graph has to be created with the memDisc, e.g. using rj_agopen
37+
// Note: for this function to work, the graph has to be created with the disc, e.g. using rj_agopen
3838
// This function transfers ownership of the string result.
3939
// The caller has to call free_str to free it.
4040
const char* rj_agmemwrite(Agraph_t* g)
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
-5.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.
-5.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-1.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
16.5 KB
Binary file not shown.
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-84.5 KB
Binary file not shown.
-512 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
512 Bytes
Binary file not shown.
-1 KB
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-2.5 KB
Binary file not shown.
Binary file not shown.
-2.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
2.5 KB
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-30 KB
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

GraphvizWrapper/include/cdt.h

Lines changed: 17 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
* @file
33
* @brief container data types API
44
* @ingroup public_apis
5+
*
6+
* **CDT** manages run-time dictionaries using standard container data types:
7+
* unordered set/multiset, ordered set/multiset, list, stack, and queue.
8+
*
9+
* [man 3 cdt](https://graphviz.org/pdf/cdt.3.pdf)
10+
*
511
*/
612

713
#pragma once
@@ -42,11 +48,9 @@ typedef struct _dt_s Dict_t; /* for libdict compatibility */
4248
typedef struct _dtstat_s Dtstat_t;
4349
typedef void* (*Dtmemory_f)(Dt_t*,void*,size_t,Dtdisc_t*);
4450
typedef void* (*Dtsearch_f)(Dt_t*,void*,int);
45-
typedef void* (*Dtmake_f)(Dt_t*,void*,Dtdisc_t*);
46-
typedef void (*Dtfree_f)(Dt_t*,void*,Dtdisc_t*);
51+
typedef void* (*Dtmake_f)(void*,Dtdisc_t*);
52+
typedef void (*Dtfree_f)(void*,Dtdisc_t*);
4753
typedef int (*Dtcompar_f)(Dt_t*,void*,void*,Dtdisc_t*);
48-
typedef unsigned int (*Dthash_f)(Dt_t*,void*,Dtdisc_t*);
49-
typedef int (*Dtevent_f)(Dt_t*,int,void*,Dtdisc_t*);
5054

5155
struct _dtlink_s
5256
{ Dtlink_t* right; /* right child */
@@ -79,8 +83,6 @@ struct _dtdata_s
7983
int ntab; /* number of hash slots */
8084
int size; /* number of objects */
8185
int loop; /* number of nested loops */
82-
int minp; /* min path before splay, always even */
83-
/* for hash dt, > 0: fixed table size */
8486
};
8587

8688
/* structure to hold methods that manipulate an object */
@@ -91,16 +93,14 @@ struct _dtdisc_s
9193
Dtmake_f makef; /* object constructor */
9294
Dtfree_f freef; /* object destructor */
9395
Dtcompar_f comparf;/* to compare two objects */
94-
Dthash_f hashf; /* to compute hash value of an object */
9596
Dtmemory_f memoryf;/* to allocate/free memory */
96-
Dtevent_f eventf; /* to process events */
9797
};
9898

99-
#define DTDISC(dc,ky,sz,lk,mkf,frf,cmpf,hshf,memf,evf) \
99+
#define DTDISC(dc, ky, sz, lk, mkf, frf, cmpf, memf) \
100100
( (dc)->key = (ky), (dc)->size = (sz), (dc)->link = (lk), \
101101
(dc)->makef = (mkf), (dc)->freef = (frf), \
102-
(dc)->comparf = (cmpf), (dc)->hashf = (hshf), \
103-
(dc)->memoryf = (memf), (dc)->eventf = (evf) )
102+
(dc)->comparf = (cmpf), \
103+
(dc)->memoryf = (memf) )
104104

105105
/* the dictionary structure itself */
106106
struct _dt_s
@@ -130,19 +130,11 @@ struct _dtstat_s
130130

131131
/* supported storage methods */
132132
#define DT_SET 0000001 /* set with unique elements */
133-
#define DT_BAG 0000002 /* multiset */
134133
#define DT_OSET 0000004 /* ordered set (self-adjusting tree) */
135134
#define DT_OBAG 0000010 /* ordered multiset */
136-
#define DT_LIST 0000020 /* linked list */
137-
#define DT_STACK 0000040 /* stack: insert/delete at top */
138135
#define DT_QUEUE 0000100 /* queue: insert at top, delete at tail */
139-
#define DT_DEQUE 0000200 /* deque: insert at top, append at tail */
140136
#define DT_METHODS 0000377 /* all currently supported methods */
141137

142-
/* asserts to dtdisc() */
143-
#define DT_SAMECMP 0000001 /* compare methods equivalent */
144-
#define DT_SAMEHASH 0000002 /* hash methods equivalent */
145-
146138
/* types of search */
147139
#define DT_INSERT 0000001 /* insert object if not found */
148140
#define DT_DELETE 0000002 /* delete object if found */
@@ -155,54 +147,34 @@ struct _dtstat_s
155147
#define DT_LAST 0000400 /* get last object */
156148
#define DT_MATCH 0001000 /* find object matching key */
157149
#define DT_VSEARCH 0002000 /* search using internal representation */
158-
#define DT_ATTACH 0004000 /* attach an object to the dictionary */
159150
#define DT_DETACH 0010000 /* detach an object from the dictionary */
160-
#define DT_APPEND 0020000 /* used on Dtlist to append an object */
161-
162-
/* events */
163-
#define DT_OPEN 1 /* a dictionary is being opened */
164-
#define DT_CLOSE 2 /* a dictionary is being closed */
165-
#define DT_DISC 3 /* discipline is about to be changed */
166-
#define DT_METH 4 /* method is about to be changed */
167-
#define DT_ENDOPEN 5 /* dtopen() is done */
168-
#define DT_ENDCLOSE 6 /* dtclose() is done */
169-
#define DT_HASHSIZE 7 /* setting hash table size */
170151

171152
CDT_API extern Dtmethod_t* Dtset; ///< set with unique elements
172-
CDT_API extern Dtmethod_t* Dtbag; ///< multiset
173153
CDT_API extern Dtmethod_t* Dtoset; ///< ordered set (self-adjusting tree)
174154
CDT_API extern Dtmethod_t* Dtobag; ///< ordered multiset
175-
CDT_API extern Dtmethod_t* Dtlist; ///< linked list
176-
CDT_API extern Dtmethod_t* Dtstack; ///< stack: insert/delete at top
177155
CDT_API extern Dtmethod_t* Dtqueue; ///< queue: insert at top, delete at tail
178-
CDT_API extern Dtmethod_t* Dtdeque; ///< deque: insert at top, append at tail
179156

180-
CDT_API extern Dtmethod_t* Dtorder;
181157
CDT_API extern Dtmethod_t* Dttree;
182-
CDT_API extern Dtmethod_t* Dthash;
183158
CDT_API extern Dtmethod_t _Dttree;
184-
CDT_API extern Dtmethod_t _Dthash;
185-
CDT_API extern Dtmethod_t _Dtlist;
186159
CDT_API extern Dtmethod_t _Dtqueue;
187-
CDT_API extern Dtmethod_t _Dtstack;
188160

189161
CDT_API Dt_t* dtopen(Dtdisc_t*, Dtmethod_t*);
190162
CDT_API int dtclose(Dt_t*);
191163
CDT_API Dt_t* dtview(Dt_t*, Dt_t*);
192-
CDT_API Dtdisc_t* dtdisc(Dt_t* dt, Dtdisc_t*, int);
164+
CDT_API Dtdisc_t* dtdisc(Dt_t *dt, Dtdisc_t*);
193165
CDT_API Dtmethod_t* dtmethod(Dt_t*, Dtmethod_t*);
194166

195167
CDT_API Dtlink_t* dtflatten(Dt_t*);
196168
CDT_API Dtlink_t* dtextract(Dt_t*);
197169
CDT_API int dtrestore(Dt_t*, Dtlink_t*);
198170

199-
CDT_API int dtwalk(Dt_t*, int(*)(Dt_t*,void*,void*), void*);
171+
CDT_API int dtwalk(Dt_t*, int(*)(void*,void*), void*);
200172

201173
CDT_API void* dtrenew(Dt_t*, void*);
202174

203175
CDT_API int dtsize(Dt_t*);
204176
CDT_API int dtstat(Dt_t*, Dtstat_t*, int);
205-
CDT_API unsigned int dtstrhash(unsigned int, void*, int);
177+
CDT_API unsigned int dtstrhash(void*, int);
206178

207179
/* internal functions for translating among holder, object and key */
208180
#define _DT(dt) ((Dt_t*)(dt))
@@ -215,41 +187,6 @@ CDT_API unsigned int dtstrhash(unsigned int, void*, int);
215187
#define _DTCMP(dt,k1,k2,dc,cmpf,sz) \
216188
(cmpf ? (*cmpf)(dt,k1,k2,dc) : \
217189
(sz <= 0 ? strcmp(k1,k2) : memcmp(k1,k2,(size_t)sz)) )
218-
#define _DTHSH(dt,ky,dc,sz) (dc->hashf ? (*dc->hashf)(dt,ky,dc) : dtstrhash(0,ky,sz) )
219-
220-
/* special search function for tree structure only */
221-
#define _DTMTCH(dt,key,action) \
222-
do { Dtlink_t* _e; void *_o, *_k, *_key; Dtdisc_t* _dc; \
223-
int _ky, _sz, _lk, _cmp; Dtcompar_f _cmpf; \
224-
_dc = (dt)->disc; _DTDSC(_dc, _ky, _sz, _lk, _cmpf); \
225-
_key = (key); \
226-
for(_e = (dt)->data->here; _e; _e = _cmp < 0 ? _e->hl._left : _e->right) \
227-
{ _o = _DTOBJ(_e, _lk); _k = _DTKEY(_o, _ky, _sz); \
228-
if((_cmp = _DTCMP((dt), _key, _k, _dc, _cmpf, _sz)) == 0) \
229-
break; \
230-
} \
231-
action (_e ? _o : (void*)0); \
232-
} while(0)
233-
234-
#define _DTSRCH(dt,obj,action) \
235-
do { Dtlink_t* _e; void *_o, *_k, *_key; Dtdisc_t* _dc; \
236-
int _ky, _sz, _lk, _cmp; Dtcompar_f _cmpf; \
237-
_dc = (dt)->disc; _DTDSC(_dc, _ky, _sz, _lk, _cmpf); \
238-
_key = _DTKEY(obj, _ky, _sz); \
239-
for(_e = (dt)->data->here; _e; _e = _cmp < 0 ? _e->hl._left : _e->right) \
240-
{ _o = _DTOBJ(_e, _lk); _k = _DTKEY(_o, _ky, _sz); \
241-
if((_cmp = _DTCMP((dt), _key, _k, _dc, _cmpf, _sz)) == 0) \
242-
break; \
243-
} \
244-
action (_e ? _o : (void*)0); \
245-
} while(0)
246-
247-
#define DTTREEMATCH(dt,key,action) _DTMTCH(_DT(dt),(void*)(key),action)
248-
#define DTTREESEARCH(dt,obj,action) _DTSRCH(_DT(dt),(void*)(obj),action)
249-
250-
#define dtvnext(d) (_DT(d)->view)
251-
#define dtvcount(d) (_DT(d)->nview)
252-
#define dtvhere(d) (_DT(d)->walk)
253190

254191
#define dtlink(d,e) (((Dtlink_t*)(e))->right)
255192
#define dtobj(d,e) _DTOBJ((e), _DT(d)->disc->link)
@@ -264,19 +201,19 @@ CDT_API unsigned int dtstrhash(unsigned int, void*, int);
264201
#define dtsearch(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_SEARCH)
265202
#define dtmatch(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_MATCH)
266203
#define dtinsert(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_INSERT)
267-
#define dtappend(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_INSERT|DT_APPEND)
268204
#define dtdelete(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_DELETE)
269-
#define dtattach(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_ATTACH)
270205
#define dtdetach(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_DETACH)
271206
#define dtclear(d) (*(_DT(d)->searchf))((d),(void*)(0),DT_CLEAR)
272207
#define dtfound(d) (_DT(d)->type & DT_FOUND)
273208

274209
#define DT_PRIME 17109811 /* 2#00000001 00000101 00010011 00110011 */
275-
#define dtcharhash(h,c) (((unsigned int)(h) + (unsigned int)(c)) * DT_PRIME )
276210

277211
/**
278212
* @dir lib/cdt
279213
* @brief container data types, API cdt.h
214+
*
215+
* [man 3 cdt](https://graphviz.org/pdf/cdt.3.pdf)
216+
*
280217
*/
281218

282219
#ifdef __cplusplus

0 commit comments

Comments
 (0)