Graphviz  2.41.20171026.1811
cgraph.h
Go to the documentation of this file.
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 ATT_GRAPH_H
15 #define ATT_GRAPH_H
16 
17 #include <inttypes.h>
18 #include "cdt.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #ifdef _WIN32
25 # ifdef EXPORT_CGRAPH
26 # define CGRAPH_API __declspec(dllexport)
27 # else
28 # define CGRAPH_API __declspec(dllimport)
29 # endif
30 #else
31 # define CGRAPH_API extern
32 #endif
33 
34 #ifndef FALSE
35 #define FALSE (0)
36 #endif
37 #ifndef TRUE
38 #define TRUE (!FALSE)
39 #endif
40 #ifndef NOT
41 #define NOT(x) (!(x))
42 #endif
43 #ifndef NIL
44 #define NIL(type) ((type)0)
45 #endif
46 #define NILgraph NIL(Agraph_t*)
47 #define NILnode NIL(Agnode_t*)
48 #define NILedge NIL(Agedge_t*)
49 #define NILsym NIL(Agsym_t*)
50 
51 typedef uint64_t IDTYPE;
52 
53 /* forward struct type declarations */
54 typedef struct Agtag_s Agtag_t;
55 typedef struct Agobj_s Agobj_t; /* generic object header */
56 typedef struct Agraph_s Agraph_t; /* graph, subgraph (or hyperedge) */
57 typedef struct Agnode_s Agnode_t; /* node (atom) */
58 typedef struct Agedge_s Agedge_t; /* node pair */
59 typedef struct Agdesc_s Agdesc_t; /* graph descriptor */
60 typedef struct Agmemdisc_s Agmemdisc_t; /* memory allocator */
61 typedef struct Agiddisc_s Agiddisc_t; /* object ID allocator */
62 typedef struct Agiodisc_s Agiodisc_t; /* IO services */
63 typedef struct Agdisc_s Agdisc_t; /* union of client discipline methods */
64 typedef struct Agdstate_s Agdstate_t; /* client state (closures) */
65 typedef struct Agsym_s Agsym_t; /* string attribute descriptors */
66 typedef struct Agattr_s Agattr_t; /* string attribute container */
67 typedef struct Agcbdisc_s Agcbdisc_t; /* client event callbacks */
68 typedef struct Agcbstack_s Agcbstack_t; /* enclosing state for cbdisc */
69 typedef struct Agclos_s Agclos_t; /* common fields for graph/subgs */
70 typedef struct Agrec_s Agrec_t; /* generic runtime record */
71 typedef struct Agdatadict_s Agdatadict_t; /* set of dictionaries per graph */
72 typedef struct Agedgepair_s Agedgepair_t; /* the edge object */
73 typedef struct Agsubnode_s Agsubnode_t;
74 
75 /* Header of a user record. These records are attached by client programs
76 dynamically at runtime. A unique string ID must be given to each record
77 attached to the same object. Cgraph has functions to create, search for,
78 and delete these records. The records are maintained in a circular list,
79 with obj->data pointing somewhere in the list. The search function has
80 an option to lock this pointer on a given record. The application must
81 be written so only one such lock is outstanding at a time. */
82 
83 struct Agrec_s {
84  char *name;
86  /* following this would be any programmer-defined data */
87 };
88 
89 /* Object tag for graphs, nodes, and edges. While there may be several structs
90 for a given node or edges, there is only one unique ID (per main graph). */
91 struct Agtag_s {
92  unsigned objtype:2; /* see literal tags below */
93  unsigned mtflock:1; /* move-to-front lock, see above */
94  unsigned attrwf:1; /* attrs written (parity, write.c) */
95  unsigned seq:(sizeof(unsigned) * 8 - 4); /* sequence no. */
96  IDTYPE id; /* client ID */
97 };
98 
99  /* object tags */
100 #define AGRAPH 0 /* can't exceed 2 bits. see Agtag_t. */
101 #define AGNODE 1
102 #define AGOUTEDGE 2
103 #define AGINEDGE 3 /* (1 << 1) indicates an edge tag. */
104 #define AGEDGE AGOUTEDGE /* synonym in object kind args */
105 
106  /* a generic graph/node/edge header */
107 struct Agobj_s {
110 };
111 
112 #define AGTAG(obj) (((Agobj_t*)(obj))->tag)
113 #define AGTYPE(obj) (AGTAG(obj).objtype)
114 #define AGID(obj) (AGTAG(obj).id)
115 #define AGSEQ(obj) (AGTAG(obj).seq)
116 #define AGATTRWF(obj) (AGTAG(obj).attrwf)
117 #define AGDATA(obj) (((Agobj_t*)(obj))->data)
118 
119 /* This is the node struct allocated per graph (or subgraph). It resides
120 in the n_dict of the graph. The node set is maintained by libdict, but
121 transparently to libgraph callers. Every node may be given an optional
122 string name at its time of creation, or it is permissible to pass NIL(char*)
123 for the name. */
124 
125 struct Agsubnode_s { /* the node-per-graph-or-subgraph record */
126  Dtlink_t seq_link; /* must be first */
128  Agnode_t *node; /* the object */
129  Dtlink_t *in_id, *out_id; /* by node/ID for random access */
130  Dtlink_t *in_seq, *out_seq; /* by node/sequence for serial access */
131 };
132 
133 struct Agnode_s {
136  Agsubnode_t mainsub; /* embedded for main graph */
137 };
138 
139 struct Agedge_s {
141  Dtlink_t id_link; /* main graph only */
143  Agnode_t *node; /* the endpoint node */
144 };
145 
146 struct Agedgepair_s {
148 };
149 
150 struct Agdesc_s { /* graph descriptor */
151  unsigned directed:1; /* if edges are asymmetric */
152  unsigned strict:1; /* if multi-edges forbidden */
153  unsigned no_loop:1; /* if no loops */
154  unsigned maingraph:1; /* if this is the top level graph */
155  unsigned flatlock:1; /* if sets are flattened into lists in cdt */
156  unsigned no_write:1; /* if a temporary subgraph */
157  unsigned has_attrs:1; /* if string attr tables should be initialized */
158  unsigned has_cmpnd:1; /* if may contain collapsed nodes */
159 };
160 
161 /* disciplines for external resources needed by libgraph */
162 
163 struct Agmemdisc_s { /* memory allocator */
164  void *(*open) (Agdisc_t*); /* independent of other resources */
165  void *(*alloc) (void *state, size_t req);
166  void *(*resize) (void *state, void *ptr, size_t old, size_t req);
167  void (*free) (void *state, void *ptr);
168  void (*close) (void *state);
169 };
170 
171 struct Agiddisc_s { /* object ID allocator */
172  void *(*open) (Agraph_t * g, Agdisc_t*); /* associated with a graph */
173  long (*map) (void *state, int objtype, char *str, IDTYPE *id,
174  int createflag);
175  long (*alloc) (void *state, int objtype, IDTYPE id);
176  void (*free) (void *state, int objtype, IDTYPE id);
177  char *(*print) (void *state, int objtype, IDTYPE id);
178  void (*close) (void *state);
179  void (*idregister) (void *state, int objtype, void *obj);
180 };
181 
182 struct Agiodisc_s {
183  int (*afread) (void *chan, char *buf, int bufsize);
184  int (*putstr) (void *chan, const char *str);
185  int (*flush) (void *chan); /* sync */
186  /* error messages? */
187 };
188 
189 struct Agdisc_s { /* user's discipline */
193 };
194 
195  /* default resource disciplines */
196 
200 
202 
203 struct Agdstate_s {
204  void *mem;
205  void *id;
206  /* IO must be initialized and finalized outside Cgraph,
207  * and channels (FILES) are passed as void* arguments. */
208 };
209 
210 typedef void (*agobjfn_t) (Agraph_t * g, Agobj_t * obj, void *arg);
211 typedef void (*agobjupdfn_t) (Agraph_t * g, Agobj_t * obj, void *arg,
212  Agsym_t * sym);
213 
214 struct Agcbdisc_s {
215  struct {
219  } graph, node, edge;
220 };
221 
222 struct Agcbstack_s { /* object event callbacks */
223  Agcbdisc_t *f; /* methods */
224  void *state; /* closure */
225  Agcbstack_t *prev; /* kept in a stack, unlike other disciplines */
226 };
227 
228 struct Agclos_s {
229  Agdisc_t disc; /* resource discipline functions */
230  Agdstate_t state; /* resource closures */
231  Dict_t *strdict; /* shared string dict */
232  uint64_t seq[3]; /* local object sequence number counter */
233  Agcbstack_t *cb; /* user and system callback function stacks */
234  unsigned char callbacks_enabled; /* issue user callbacks or hold them? */
237 };
238 
239 struct Agraph_s {
243  Dict_t *n_seq; /* the node set in sequence */
244  Dict_t *n_id; /* the node set indexed by ID */
245  Dict_t *e_seq, *e_id; /* holders for edge sets */
246  Dict_t *g_dict; /* subgraphs - descendants */
247  Agraph_t *parent, *root; /* subgraphs - ancestors */
248  Agclos_t *clos; /* shared resources */
249 };
250 
251 CGRAPH_API void agpushdisc(Agraph_t * g, Agcbdisc_t * disc, void *state);
252 CGRAPH_API int agpopdisc(Agraph_t * g, Agcbdisc_t * disc);
253 CGRAPH_API int agcallbacks(Agraph_t * g, int flag); /* return prev value */
254 
255 /* graphs */
256 CGRAPH_API Agraph_t *agopen(char *name, Agdesc_t desc, Agdisc_t * disc);
257 CGRAPH_API int agclose(Agraph_t * g);
258 CGRAPH_API Agraph_t *agread(void *chan, Agdisc_t * disc);
259 CGRAPH_API Agraph_t *agmemread(const char *cp);
260 CGRAPH_API void agreadline(int);
261 CGRAPH_API void agsetfile(char *);
262 CGRAPH_API Agraph_t *agconcat(Agraph_t * g, void *chan, Agdisc_t * disc);
263 CGRAPH_API int agwrite(Agraph_t * g, void *chan);
268 
269 /* nodes */
270 CGRAPH_API Agnode_t *agnode(Agraph_t * g, char *name, int createflag);
271 CGRAPH_API Agnode_t *agidnode(Agraph_t * g, IDTYPE id, int createflag);
272 CGRAPH_API Agnode_t *agsubnode(Agraph_t * g, Agnode_t * n, int createflag);
277 
279 CGRAPH_API int agnodebefore(Agnode_t *u, Agnode_t *v); /* we have no shame */
280 
281 /* edges */
283  char *name, int createflag);
285  IDTYPE id, int createflag);
286 CGRAPH_API Agedge_t *agsubedge(Agraph_t * g, Agedge_t * e, int createflag);
293 
294 /* generic */
295 CGRAPH_API Agraph_t *agraphof(void* obj);
296 CGRAPH_API Agraph_t *agroot(void* obj);
297 CGRAPH_API int agcontains(Agraph_t *, void *);
298 CGRAPH_API char *agnameof(void *);
299 CGRAPH_API int agrelabel(void *obj, char *name); /* scary */
300 CGRAPH_API int agrelabel_node(Agnode_t * n, char *newname);
301 CGRAPH_API int agdelete(Agraph_t * g, void *obj);
302 CGRAPH_API long agdelsubg(Agraph_t * g, Agraph_t * sub); /* could be agclose */
303 CGRAPH_API int agdelnode(Agraph_t * g, Agnode_t * arg_n);
304 CGRAPH_API int agdeledge(Agraph_t * g, Agedge_t * arg_e);
305 CGRAPH_API int agobjkind(void *);
306 
307 /* strings */
308 CGRAPH_API char *agstrdup(Agraph_t *, char *);
309 CGRAPH_API char *agstrdup_html(Agraph_t *, char *);
310 CGRAPH_API int aghtmlstr(char *);
311 CGRAPH_API char *agstrbind(Agraph_t * g, char *);
312 CGRAPH_API int agstrfree(Agraph_t *, char *);
313 CGRAPH_API char *agcanon(char *, int);
314 CGRAPH_API char *agstrcanon(char *, char *);
315 CGRAPH_API char *agcanonStr(char *str); /* manages its own buf */
316 
317 /* definitions for dynamic string attributes */
318 struct Agattr_s { /* dynamic string attributes */
319  Agrec_t h; /* common data header */
320  Dict_t *dict; /* shared dict to interpret attr field */
321  char **str; /* the attribute string values */
322 };
323 
324 struct Agsym_s { /* symbol in one of the above dictionaries */
326  char *name; /* attribute's name */
327  char *defval; /* its default value for initialization */
328  int id; /* its index in attr[] */
329  unsigned char kind; /* referent object type */
330  unsigned char fixed; /* immutable value */
331  unsigned char print; /* always print */
332 };
333 
334 struct Agdatadict_s { /* set of dictionaries per graph */
335  Agrec_t h; /* installed in list of graph recs */
336  struct {
337  Dict_t *n, *e, *g;
338  } dict;
339 };
340 
341 CGRAPH_API Agsym_t *agattr(Agraph_t * g, int kind, char *name, char *value);
342 CGRAPH_API Agsym_t *agattrsym(void *obj, char *name);
343 CGRAPH_API Agsym_t *agnxtattr(Agraph_t * g, int kind, Agsym_t * attr);
344 CGRAPH_API int agcopyattr(void *oldobj, void *newobj);
345 
346 CGRAPH_API void *agbindrec(void *obj, char *name, unsigned int size,
347  int move_to_front);
348 CGRAPH_API Agrec_t *aggetrec(void *obj, char *name, int move_to_front);
349 CGRAPH_API int agdelrec(void *obj, char *name);
350 CGRAPH_API void aginit(Agraph_t * g, int kind, char *rec_name, int rec_size,
351  int move_to_front);
352 CGRAPH_API void agclean(Agraph_t * g, int kind, char *rec_name);
353 
354 CGRAPH_API char *agget(void *obj, char *name);
355 CGRAPH_API char *agxget(void *obj, Agsym_t * sym);
356 CGRAPH_API int agset(void *obj, char *name, char *value);
357 CGRAPH_API int agxset(void *obj, Agsym_t * sym, char *value);
358 CGRAPH_API int agsafeset(void* obj, char* name, char* value, char* def);
359 
360 /* defintions for subgraphs */
361 CGRAPH_API Agraph_t *agsubg(Agraph_t * g, char *name, int cflag); /* constructor */
362 CGRAPH_API Agraph_t *agidsubg(Agraph_t * g, IDTYPE id, int cflag); /* constructor */
366 
367 /* set cardinality */
368 CGRAPH_API int agnnodes(Agraph_t * g);
369 CGRAPH_API int agnedges(Agraph_t * g);
370 CGRAPH_API int agnsubg(Agraph_t * g);
371 CGRAPH_API int agdegree(Agraph_t * g, Agnode_t * n, int in, int out);
372 CGRAPH_API int agcountuniqedges(Agraph_t * g, Agnode_t * n, int in, int out);
373 
374 /* memory */
375 CGRAPH_API void *agalloc(Agraph_t * g, size_t size);
376 CGRAPH_API void *agrealloc(Agraph_t * g, void *ptr, size_t oldsize,
377  size_t size);
378 CGRAPH_API void agfree(Agraph_t * g, void *ptr);
379 CGRAPH_API struct _vmalloc_s *agheap(Agraph_t * g);
380 
381 /* an engineering compromise is a joy forever */
383 
384 #define agnew(g,t) ((t*)agalloc(g,sizeof(t)))
385 #define agnnew(g,n,t) ((t*)agalloc(g,(n)*sizeof(t)))
386 
387 /* error handling */
388 typedef enum { AGWARN, AGERR, AGMAX, AGPREV } agerrlevel_t;
389 typedef int (*agusererrf) (char*);
391 CGRAPH_API char *aglasterr(void);
392 CGRAPH_API int agerr(agerrlevel_t level, const char *fmt, ...);
393 CGRAPH_API void agerrorf(const char *fmt, ...);
394 CGRAPH_API void agwarningf(const char *fmt, ...);
395 CGRAPH_API int agerrors(void);
396 CGRAPH_API int agreseterrors(void);
398 
399 /* data access macros */
400 /* this assumes that e[0] is out and e[1] is inedge, see edgepair in edge.c */
401 #define AGIN2OUT(e) ((e)-1)
402 #define AGOUT2IN(e) ((e)+1)
403 #define AGOPP(e) ((AGTYPE(e)==AGINEDGE)?AGIN2OUT(e):AGOUT2IN(e))
404 #define AGMKOUT(e) (AGTYPE(e) == AGOUTEDGE? (e): AGIN2OUT(e))
405 #define AGMKIN(e) (AGTYPE(e) == AGINEDGE? (e): AGOUT2IN(e))
406 #define AGTAIL(e) (AGMKIN(e)->node)
407 #define AGHEAD(e) (AGMKOUT(e)->node)
408 #define AGEQEDGE(e,f) (AGMKOUT(e) == AGMKOUT(f))
409 /* These macros are also exposed as functions, so they can be linked against. */
410 #define agtail(e) AGTAIL(e)
411 #define aghead(e) AGHEAD(e)
412 #define agopp(e) AGOPP(e)
413 #define ageqedge(e,f) AGEQEDGE(e,f)
414 
415 #define TAILPORT_ID "tailport"
416 #define HEADPORT_ID "headport"
417 
422 
423 /* fast graphs */
424 void agflatten(Agraph_t * g, int flag);
427 
428 #define AGHEADPOINTER(g) ((Agnoderef_t*)(g->n_seq->data->hh._head))
429 #define AGRIGHTPOINTER(rep) ((Agnoderef_t*)((rep)->seq_link.right?((void*)((rep)->seq_link.right) - offsetof(Agsubnode_t,seq_link)):0))
430 #define AGLEFTPOINTER(rep) ((Agnoderef_t*)((rep)->seq_link.hl._left?((void*)((rep)->seq_link.hl._left) - offsetof(Agsubnode_t,seq_link)):0))
431 
432 #define FIRSTNREF(g) (agflatten(g,1), AGHEADPOINTER(g))
433 
434 #define NEXTNREF(g,rep) (AGRIGHTPOINTER(rep) == AGHEADPOINTER(g)?0:AGRIGHTPOINTER(rep))
435 
436 #define PREVNREF(g,rep) (((rep)==AGHEADPOINTER(g))?0:(AGLEFTPOINTER(rep)))
437 
438 #define LASTNREF(g) (agflatten(g,1), AGHEADPOINTER(g)?AGLEFTPOINTER(AGHEADPOINTER(g)):0)
439 #define NODEOF(rep) ((rep)->node)
440 
441 #define FIRSTOUTREF(g,sn) (agflatten(g,1), (sn)->out_seq)
442 #define LASTOUTREF(g,sn) (agflatten(g,1), (Agedgeref_t*)dtlast(sn->out_seq))
443 #define FIRSTINREF(g,sn) (agflatten(g,1), (sn)->in_seq)
444 #define NEXTEREF(g,rep) ((rep)->right)
445 #define PREVEREF(g,rep) ((rep)->hl._left)
446 /* this is expedient but a bit slimey because it "knows" that dict entries of both nodes
447 and edges are embedded in main graph objects but allocated separately in subgraphs */
448 #define AGSNMAIN(sn) ((sn)==(&((sn)->node->mainsub)))
449 #define EDGEOF(sn,rep) (AGSNMAIN(sn)?((Agedge_t*)((unsigned char*)(rep) - offsetof(Agedge_t,seq_link))) : ((Dthold_t*)(rep))->obj)
450 
451 #ifdef __cplusplus
452 }
453 #endif
454 #endif
CGRAPH_API int agdeledge(Agraph_t *g, Agedge_t *arg_e)
Definition: edge.c:357
void(* agobjupdfn_t)(Agraph_t *g, Agobj_t *obj, void *arg, Agsym_t *sym)
Definition: cgraph.h:211
#define CGRAPH_API
Definition: cgraph.h:31
CGRAPH_API void agclean(Agraph_t *g, int kind, char *rec_name)
Definition: rec.c:238
CGRAPH_API int agobjkind(void *)
Definition: obj.c:264
CGRAPH_API Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
Definition: node.c:142
Definition: cgraph.h:388
CGRAPH_API Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
Definition: graph.c:44
Agiddisc_t * id
Definition: cgraph.h:191
long(* alloc)(void *state, int objtype, IDTYPE id)
Definition: cgraph.h:175
Agsym_t * agattr(Agraph_t *g, int kind, char *name, char *value)
Definition: attr.c:324
struct Agdatadict_s::@3 dict
CGRAPH_API int agdegree(Agraph_t *g, Agnode_t *n, int in, int out)
Definition: graph.c:229
CGRAPH_API int aghtmlstr(char *)
Definition: refstr.c:178
CGRAPH_API Agmemdisc_t AgMemDisc
Definition: cgraph.h:197
char * defval
Definition: cgraph.h:327
CGRAPH_API Agiodisc_t AgIoDisc
Definition: cgraph.h:199
CGRAPH_API int agdelnode(Agraph_t *g, Agnode_t *arg_n)
Definition: node.c:192
void(* idregister)(void *state, int objtype, void *obj)
Definition: cgraph.h:179
Agdesc_t desc
Definition: cgraph.h:241
Agsym_t * agnxtattr(Agraph_t *g, int kind, Agsym_t *attr)
Definition: attr.c:340
void * id
Definition: cgraph.h:205
void * state
Definition: cgraph.h:224
CGRAPH_API char * agcanonStr(char *str)
Definition: write.c:207
unsigned flatlock
Definition: cgraph.h:155
struct Agcbdisc_s::@2 edge
int agreseterrors()
Definition: agerror.c:172
Agrec_t h
Definition: cgraph.h:319
CGRAPH_API void agsetfile(char *)
Definition: scan.c:573
void agflatten(Agraph_t *g, int flag)
Definition: flatten.c:35
Dict_t * lookup_by_id[3]
Definition: cgraph.h:236
CGRAPH_API Agdesc_t Agstrictundirected
Definition: cgraph.h:421
CGRAPH_API Agedge_t * agfstin(Agraph_t *g, Agnode_t *n)
Definition: edge.c:56
int agxset(void *obj, Agsym_t *sym, char *value)
Definition: attr.c:468
char * name
Definition: cgraph.h:326
Dict_t * n_seq
Definition: cgraph.h:243
agobjfn_t del
Definition: cgraph.h:218
Definition: cgraph.h:388
CGRAPH_API Agraph_t * agidsubg(Agraph_t *g, IDTYPE id, int cflag)
Definition: subg.c:43
agerrlevel_t agseterr(agerrlevel_t lvl)
Definition: agerror.c:34
unsigned mtflock
Definition: cgraph.h:93
Dtlink_t Agedgeref_t
Definition: cgraph.h:426
Agedge_t in
Definition: cgraph.h:147
CGRAPH_API Agnode_t * agprvnode(Agraph_t *g, Agnode_t *n)
Definition: node.c:60
CGRAPH_API int agisdirected(Agraph_t *g)
Definition: graph.c:182
CGRAPH_API long agdelsubg(Agraph_t *g, Agraph_t *sub)
Definition: subg.c:93
CGRAPH_API int agrelabel(void *obj, char *name)
CGRAPH_API int agisundirected(Agraph_t *g)
Definition: graph.c:187
CGRAPH_API void agpushdisc(Agraph_t *g, Agcbdisc_t *disc, void *state)
Definition: obj.c:202
Agtag_t tag
Definition: cgraph.h:108
CGRAPH_API Agraph_t * agread(void *chan, Agdisc_t *disc)
Definition: grammar.c:2349
CGRAPH_API Agedge_t * agfstedge(Agraph_t *g, Agnode_t *n)
Definition: edge.c:86
CGRAPH_API int agdelete(Agraph_t *g, void *obj)
Definition: obj.c:16
Agobj_t base
Definition: cgraph.h:134
CGRAPH_API Agraph_t * agconcat(Agraph_t *g, void *chan, Agdisc_t *disc)
Definition: grammar.c:2337
CGRAPH_API int agwrite(Agraph_t *g, void *chan)
Definition: write.c:678
Dtlink_t * in_id
Definition: cgraph.h:129
int agerr(agerrlevel_t level, const char *fmt,...)
Definition: agerror.c:141
Dtlink_t id_link
Definition: cgraph.h:141
unsigned char callbacks_enabled
Definition: cgraph.h:234
CGRAPH_API int agcallbacks(Agraph_t *g, int flag)
Definition: pend.c:286
CGRAPH_API Agraph_t * agfstsubg(Agraph_t *g)
Definition: subg.c:72
CGRAPH_API int agcontains(Agraph_t *, void *)
Definition: obj.c:245
CGRAPH_API Agraph_t * agroot(void *obj)
Definition: obj.c:169
CGRAPH_API Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Definition: edge.c:25
IDTYPE id
Definition: cgraph.h:96
CGRAPH_API void agreadline(int)
Definition: scan.c:569
Dtlink_t * out_seq
Definition: cgraph.h:130
CGRAPH_API Agdesc_t Agundirected
Definition: cgraph.h:420
char * name
Definition: cgraph.h:84
unsigned char kind
Definition: cgraph.h:329
CGRAPH_API Agiddisc_t AgIdDisc
Definition: cgraph.h:198
CGRAPH_API void agfree(Agraph_t *g, void *ptr)
Definition: mem.c:89
Agcbdisc_t * f
Definition: cgraph.h:223
CGRAPH_API char * agstrdup_html(Agraph_t *, char *)
Definition: refstr.c:123
Agmemdisc_t * mem
Definition: cgraph.h:190
Definition: cgraph.h:388
agobjfn_t ins
Definition: cgraph.h:216
CGRAPH_API char * agcanon(char *, int)
Definition: write.c:217
char * agget(void *obj, char *name)
Definition: attr.c:428
CGRAPH_API Agraph_t * agraphof(void *obj)
Definition: obj.c:185
CGRAPH_API Agraph_t * agnxtsubg(Agraph_t *subg)
Definition: subg.c:77
CGRAPH_API Agdesc_t Agstrictdirected
Definition: cgraph.h:419
CGRAPH_API Agdesc_t Agdirected
Definition: cgraph.h:418
Agdisc_t disc
Definition: cgraph.h:229
CGRAPH_API void * agrealloc(Agraph_t *g, void *ptr, size_t oldsize, size_t size)
Definition: mem.c:72
uint64_t IDTYPE
Definition: cgraph.h:51
CGRAPH_API Agraph_t * agsubg(Agraph_t *g, char *name, int cflag)
Definition: subg.c:52
unsigned char fixed
Definition: cgraph.h:330
Dict_t * n_id
Definition: cgraph.h:244
int agset(void *obj, char *name, char *value)
Definition: attr.c:455
char ** str
Definition: cgraph.h:321
void * mem
Definition: cgraph.h:204
CGRAPH_API int agcountuniqedges(Agraph_t *g, Agnode_t *n, int in, int out)
Definition: graph.c:211
CGRAPH_API Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Definition: node.c:45
unsigned has_attrs
Definition: cgraph.h:157
int
Definition: grammar.c:1264
Agnode_t * node
Definition: cgraph.h:143
CGRAPH_API int agisstrict(Agraph_t *g)
Definition: graph.c:192
Agsym_t * agattrsym(void *obj, char *name)
Definition: attr.c:153
Dict_t * e
Definition: cgraph.h:337
CGRAPH_API Agraph_t * agmemread(const char *cp)
Definition: io.c:131
unsigned objtype
Definition: cgraph.h:92
Dict_t * lookup_by_name[3]
Definition: cgraph.h:235
void(* free)(void *state, int objtype, IDTYPE id)
Definition: cgraph.h:176
Agedge_t out
Definition: cgraph.h:147
int(* flush)(void *chan)
Definition: cgraph.h:185
uint64_t seq[3]
Definition: cgraph.h:232
CGRAPH_API int agclose(Agraph_t *g)
Definition: graph.c:93
CGRAPH_API char * agnameof(void *)
Definition: id.c:143
int(* afread)(void *chan, char *buf, int bufsize)
Definition: cgraph.h:183
CGRAPH_API Agraph_t * agparent(Agraph_t *g)
Definition: subg.c:85
Agobj_t base
Definition: cgraph.h:240
void(* close)(void *state)
Definition: cgraph.h:178
CGRAPH_API int agrelabel_node(Agnode_t *n, char *newname)
Definition: node.c:231
Dict_t * g
Definition: cgraph.h:337
int(* agusererrf)(char *)
Definition: cgraph.h:389
Agcbstack_t * prev
Definition: cgraph.h:225
void(* free)(void *state, void *ptr)
Definition: cgraph.h:167
CGRAPH_API struct _vmalloc_s * agheap(Agraph_t *g)
Definition: mem.c:100
unsigned attrwf
Definition: cgraph.h:94
CGRAPH_API int agstrfree(Agraph_t *, char *)
Definition: refstr.c:149
CGRAPH_API char * agstrdup(Agraph_t *, char *)
Definition: refstr.c:97
long(* map)(void *state, int objtype, char *str, IDTYPE *id, int createflag)
Definition: cgraph.h:173
CGRAPH_API Agedge_t * agsubedge(Agraph_t *g, Agedge_t *e, int createflag)
Definition: edge.c:378
CGRAPH_API Agnode_t * aglstnode(Agraph_t *g)
Definition: node.c:53
CGRAPH_API char * agstrcanon(char *, char *)
Definition: write.c:177
CGRAPH_API Agnode_t * agfstnode(Agraph_t *g)
Definition: node.c:38
Dtlink_t seq_link
Definition: cgraph.h:142
CGRAPH_API void aginit(Agraph_t *g, int kind, char *rec_name, int rec_size, int move_to_front)
Definition: rec.c:198
CGRAPH_API Agrec_t * aggetrec(void *obj, char *name, int move_to_front)
Definition: rec.c:34
int agsafeset(void *obj, char *name, char *value, char *def)
Definition: attr.c:497
unsigned seq
Definition: cgraph.h:95
Definition: cgraph.h:83
Agraph_t * parent
Definition: cgraph.h:247
Dtlink_t * out_id
Definition: cgraph.h:129
Agobj_t base
Definition: cgraph.h:140
CGRAPH_API Agsubnode_t * agsubrep(Agraph_t *g, Agnode_t *n)
Definition: edge.c:157
int id
Definition: cgraph.h:328
#define sub(h, i)
Definition: closest.c:75
agusererrf agseterrf(agusererrf newf)
Definition: agerror.c:27
int agcopyattr(void *oldobj, void *newobj)
Definition: attr.c:535
unsigned no_loop
Definition: cgraph.h:153
struct Agcbdisc_s::@2 graph
agobjupdfn_t mod
Definition: cgraph.h:217
CGRAPH_API Agedge_t * agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n)
Definition: edge.c:95
CGRAPH_API int agdelrec(void *obj, char *name)
Definition: rec.c:145
agerrlevel_t
Definition: cgraph.h:388
CGRAPH_API int agpopdisc(Agraph_t *g, Agcbdisc_t *disc)
Definition: obj.c:213
CGRAPH_API int agnsubg(Agraph_t *g)
Definition: graph.c:177
Agnode_t * node
Definition: cgraph.h:128
CGRAPH_API int agnodebefore(Agnode_t *u, Agnode_t *v)
Definition: node.c:353
unsigned maingraph
Definition: cgraph.h:154
struct Agcbdisc_s::@2 node
unsigned char print
Definition: cgraph.h:331
CGRAPH_API void aginternalmapclearlocalnames(Agraph_t *g)
Definition: imap.c:181
Dict_t * g_dict
Definition: cgraph.h:246
CGRAPH_API int agnnodes(Agraph_t *g)
Definition: graph.c:162
CGRAPH_API void * agalloc(Agraph_t *g, size_t size)
Definition: mem.c:62
Agrec_t * data
Definition: cgraph.h:109
Dtlink_t * in_seq
Definition: cgraph.h:130
Dict_t * e_id
Definition: cgraph.h:245
void agwarningf(const char *fmt,...)
Definition: agerror.c:161
CGRAPH_API Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
Definition: edge.c:281
Agiodisc_t * io
Definition: cgraph.h:192
unsigned strict
Definition: cgraph.h:152
Agcbstack_t * cb
Definition: cgraph.h:233
CGRAPH_API int agissimple(Agraph_t *g)
Definition: graph.c:197
Dtlink_t link
Definition: cgraph.h:325
CGRAPH_API void * agbindrec(void *obj, char *name, unsigned int size, int move_to_front)
Definition: rec.c:86
Agrec_t h
Definition: cgraph.h:335
Dtlink_t seq_link
Definition: cgraph.h:126
unsigned no_write
Definition: cgraph.h:156
CGRAPH_API Agedge_t * agnxtin(Agraph_t *g, Agedge_t *e)
Definition: edge.c:70
Definition: cdt.h:99
Dtlink_t link
Definition: cgraph.h:242
Dict_t * e_seq
Definition: cgraph.h:245
Dtlink_t id_link
Definition: cgraph.h:127
CGRAPH_API int agnedges(Agraph_t *g)
Definition: graph.c:167
Agdstate_t state
Definition: cgraph.h:230
agxbuf * str
Definition: htmlparse.c:85
int(* putstr)(void *chan, const char *str)
Definition: cgraph.h:184
CGRAPH_API Agdisc_t AgDefaultDisc
Definition: cgraph.h:201
int agerrors()
Definition: agerror.c:170
Agraph_t * root
Definition: cgraph.h:247
Agraph_t * root
Definition: cgraph.h:135
char * agxget(void *obj, Agsym_t *sym)
Definition: attr.c:444
Dict_t * strdict
Definition: cgraph.h:231
CGRAPH_API Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
Definition: edge.c:40
Agsubnode_t Agnoderef_t
Definition: cgraph.h:425
Agclos_t * clos
Definition: cgraph.h:248
unsigned directed
Definition: cgraph.h:151
CGRAPH_API char * agstrbind(Agraph_t *g, char *)
Definition: refstr.c:92
Definition: cgraph.h:91
CGRAPH_API Agnode_t * agidnode(Agraph_t *g, IDTYPE id, int createflag)
Definition: node.c:119
Definition: cgraph.h:388
Agsubnode_t mainsub
Definition: cgraph.h:136
Definition: mem.c:96
CGRAPH_API Agnode_t * agsubnode(Agraph_t *g, Agnode_t *n, int createflag)
Definition: node.c:254
char * aglasterr()
Definition: agerror.c:41
void(* close)(void *state)
Definition: cgraph.h:168
void(* agobjfn_t)(Agraph_t *g, Agobj_t *obj, void *arg)
Definition: cgraph.h:210
Agrec_t * next
Definition: cgraph.h:85
void agerrorf(const char *fmt,...)
Definition: agerror.c:152
unsigned has_cmpnd
Definition: cgraph.h:158
Dict_t * dict
Definition: cgraph.h:320
CGRAPH_API Agedge_t * agidedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, IDTYPE id, int createflag)
Definition: edge.c:259
Dict_t * n
Definition: cgraph.h:337