Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
attr.c
Go to the documentation of this file.
1
7 /*************************************************************************
8 * Copyright (c) 2011 AT&T Intellectual Property
9 * All rights reserved. This program and the accompanying materials
10 * are made available under the terms of the Eclipse Public License v1.0
11 * which accompanies this distribution, and is available at
12 * https://www.eclipse.org/legal/epl-v10.html
13 *
14 * Contributors: Details at https://graphviz.org
15 *************************************************************************/
16
17#include <cgraph/cghdr.h>
18#include <stdbool.h>
19#include <stdlib.h>
20#include <util/alloc.h>
21#include <util/streq.h>
22#include <util/unreachable.h>
23
24/*
25 * dynamic attributes
26 */
27
28/* to create a graph's data dictionary */
29
30#define MINATTR 4 /* minimum allocation */
31
32static void freesym(void *obj);
33
35 (int) offsetof(Agsym_t, name), /* use symbol name as key */
36 -1,
37 (int) offsetof(Agsym_t, link),
38 NULL,
39 freesym,
40 NULL,
41};
42
43static char DataDictName[] = "_AG_datadict";
44static void init_all_attrs(Agraph_t * g);
45static Agdesc_t ProtoDesc = {.directed = true, .no_loop = true,
46 .no_write = true};
48
51 if (rv || !cflag)
52 return rv;
54 rv = (Agdatadict_t *) aggetrec(g, DataDictName, 0);
55 return rv;
56}
57
58static Dict_t *agdictof(Agraph_t * g, int kind)
59{
60 Agdatadict_t *dd;
61 Dict_t *dict;
62
63 dd = agdatadict(g, false);
64 if (dd)
65 switch (kind) {
66 case AGRAPH:
67 dict = dd->dict.g;
68 break;
69 case AGNODE:
70 dict = dd->dict.n;
71 break;
72 case AGINEDGE:
73 case AGOUTEDGE:
74 dict = dd->dict.e;
75 break;
76 default:
77 agerrorf("agdictof: unknown kind %d\n", kind);
78 dict = NULL;
79 break;
80 } else
81 dict = NULL;
82 return dict;
83}
84
85static Agsym_t *agnewsym(Agraph_t * g, const char *name, const char *value,
86 int id, int kind) {
87 Agsym_t *sym = gv_alloc(sizeof(Agsym_t));
88 sym->kind = (unsigned char) kind;
89 sym->name = agstrdup(g, name);
90 sym->defval = agstrdup(g, value);
91 sym->id = id;
92 return sym;
93}
94
95static void agcopydict(Dict_t * src, Dict_t * dest, Agraph_t * g, int kind)
96{
97 Agsym_t *sym, *newsym;
98
99 assert(dtsize(dest) == 0);
100 for (sym = dtfirst(src); sym; sym = dtnext(src, sym)) {
101 newsym = agnewsym(g, sym->name, sym->defval, sym->id, kind);
102 newsym->print = sym->print;
103 newsym->fixed = sym->fixed;
104 dtinsert(dest, newsym);
105 }
106}
107
109{
110 Agraph_t *par;
111 Agdatadict_t *parent_dd, *dd;
112
113 dd = agbindrec(g, DataDictName, sizeof(Agdatadict_t), false);
114 dd->dict.n = agdtopen(g, &AgDataDictDisc, Dttree);
115 dd->dict.e = agdtopen(g, &AgDataDictDisc, Dttree);
116 dd->dict.g = agdtopen(g, &AgDataDictDisc, Dttree);
117 if ((par = agparent(g))) {
118 parent_dd = agdatadict(par, false);
119 assert(dd != parent_dd);
120 dtview(dd->dict.n, parent_dd->dict.n);
121 dtview(dd->dict.e, parent_dd->dict.e);
122 dtview(dd->dict.g, parent_dd->dict.g);
123 } else {
124 if (ProtoGraph && g != ProtoGraph) {
125 /* it's not ok to dtview here for several reasons. the proto
126 graph could change, and the sym indices don't match */
127 parent_dd = agdatadict(ProtoGraph, false);
128 agcopydict(parent_dd->dict.n, dd->dict.n, g, AGNODE);
129 agcopydict(parent_dd->dict.e, dd->dict.e, g, AGEDGE);
130 agcopydict(parent_dd->dict.g, dd->dict.g, g, AGRAPH);
131 }
132 }
133 return dd;
134}
135
136/* look up an attribute with possible viewpathing */
137static Agsym_t *agdictsym(Dict_t * dict, char *name)
138{
139 Agsym_t key;
140 key.name = name;
141 return dtsearch(dict, &key);
142}
143
144/* look up attribute in local dictionary with no view pathing */
145static Agsym_t *aglocaldictsym(Dict_t * dict, char *name)
146{
147 Agsym_t *rv;
148 Dict_t *view;
149
150 view = dtview(dict, NULL);
151 rv = agdictsym(dict, name);
152 dtview(dict, view);
153 return rv;
154}
155
156Agsym_t *agattrsym(void *obj, char *name)
157{
158 Agattr_t *data;
159 Agsym_t *rv;
160
161 data = agattrrec(obj);
162 if (data)
163 rv = agdictsym(data->dict, name);
164 else
165 rv = NULL;
166 return rv;
167}
168
169/* to create a graph's, node's edge's string attributes */
170
171char *AgDataRecName = "_AG_strdata";
172
173static int topdictsize(Agobj_t * obj)
174{
175 Dict_t *d;
176
177 d = agdictof(agroot(agraphof(obj)), AGTYPE(obj));
178 return d ? dtsize(d) : 0;
179}
180
181/* g can be either the enclosing graph, or ProtoGraph */
182static Agrec_t *agmakeattrs(Agraph_t * context, void *obj)
183{
184 int sz;
185 Agattr_t *rec;
186 Agsym_t *sym;
187 Dict_t *datadict;
188
189 rec = agbindrec(obj, AgDataRecName, sizeof(Agattr_t), false);
190 datadict = agdictof(context, AGTYPE(obj));
191 assert(datadict);
192 if (rec->dict == NULL) {
193 rec->dict = agdictof(agroot(context), AGTYPE(obj));
194 /* don't malloc(0) */
195 sz = topdictsize(obj);
196 if (sz < MINATTR)
197 sz = MINATTR;
198 rec->str = gv_calloc((size_t)sz, sizeof(char *));
199 /* doesn't call agxset() so no obj-modified callbacks occur */
200 for (sym = dtfirst(datadict); sym; sym = dtnext(datadict, sym))
201 rec->str[sym->id] = agstrdup(agraphof(obj), sym->defval);
202 } else {
203 assert(rec->dict == datadict);
204 }
205 return (Agrec_t *) rec;
206}
207
208static void freeattr(Agobj_t * obj, Agattr_t * attr)
209{
210 int i, sz;
211 Agraph_t *g;
212
213 g = agraphof(obj);
214 sz = topdictsize(obj);
215 for (i = 0; i < sz; i++)
216 agstrfree(g, attr->str[i]);
217 free(attr->str);
218}
219
220static void freesym(void *obj) {
221 Agsym_t *sym;
222
223 sym = obj;
226 free(sym);
227}
228
230{
231 return (Agattr_t *)aggetrec(obj, AgDataRecName, 0);
232}
233
234
235static void addattr(Agraph_t * g, Agobj_t * obj, Agsym_t * sym)
236{
237 Agattr_t *attr = agattrrec(obj);
238 assert(attr != NULL);
239 if (sym->id >= MINATTR)
240 attr->str = gv_recalloc(attr->str, (size_t)sym->id, (size_t)sym->id + 1,
241 sizeof(char *));
242 attr->str[sym->id] = agstrdup(g, sym->defval);
243}
244
245static Agsym_t *getattr(Agraph_t *g, int kind, char *name) {
246 Agsym_t *rv = 0;
247 Dict_t *dict;
248 dict = agdictof(g, kind);
249 if (dict) {
250 rv = agdictsym(dict, name); // viewpath up to root
251 }
252 return rv;
253}
254
255static void unviewsubgraphsattr(Agraph_t *parent, char *name) {
256 Agraph_t *subg;
257 Agsym_t *psym, *lsym;
258 Dict_t *ldict;
259
260 psym = getattr(parent, AGRAPH, name);
261 if (!psym) {
262 return; // supposedly can't happen, see setattr()
263 }
264 for (subg = agfstsubg(parent); subg; subg = agnxtsubg(subg)) {
265 ldict = agdatadict(subg, true)->dict.g;
266 lsym = aglocaldictsym(ldict, name);
267 if (lsym) {
268 continue;
269 }
270 lsym = agnewsym(agroot(subg), name, agxget(subg, psym), psym->id, AGRAPH);
271 dtinsert(ldict, lsym);
272 }
273}
274
275static Agsym_t *setattr(Agraph_t * g, int kind, char *name, const char *value) {
276 Dict_t *ldict, *rdict;
277 Agsym_t *lsym, *psym, *rsym, *rv;
278 Agraph_t *root;
279 Agnode_t *n;
280 Agedge_t *e;
281
282 assert(value);
283 root = agroot(g);
284 agdatadict(g, true); /* force initialization of string attributes */
285 ldict = agdictof(g, kind);
286 lsym = aglocaldictsym(ldict, name);
287 if (lsym) { /* update old local definition */
288 if (g != root && streq(name, "layout"))
289 agwarningf("layout attribute is invalid except on the root graph\n");
290 if (kind == AGRAPH) {
291 unviewsubgraphsattr(g,name);
292 }
293 agstrfree(g, lsym->defval);
294 lsym->defval = agstrdup(g, value);
295 rv = lsym;
296 } else {
297 psym = agdictsym(ldict, name); /* search with viewpath up to root */
298 if (psym) { /* new local definition */
299 lsym = agnewsym(g, name, value, psym->id, kind);
300 dtinsert(ldict, lsym);
301 rv = lsym;
302 } else { /* new global definition */
303 rdict = agdictof(root, kind);
304 rsym = agnewsym(g, name, value, dtsize(rdict), kind);
305 dtinsert(rdict, rsym);
306 switch (kind) {
307 case AGRAPH:
308 agapply(root, (Agobj_t *)root, (agobjfn_t)addattr, rsym, true);
309 break;
310 case AGNODE:
311 for (n = agfstnode(root); n; n = agnxtnode(root, n))
312 addattr(g, (Agobj_t *) n, rsym);
313 break;
314 case AGINEDGE:
315 case AGOUTEDGE:
316 for (n = agfstnode(root); n; n = agnxtnode(root, n))
317 for (e = agfstout(root, n); e; e = agnxtout(root, e))
318 addattr(g, (Agobj_t *) e, rsym);
319 break;
320 default:
321 UNREACHABLE();
322 }
323 rv = rsym;
324 }
325 }
326 if (rv && kind == AGRAPH)
327 agxset(g, rv, value);
328 agmethod_upd(g, g, rv);
329 return rv;
330}
331
332/*
333 * create or update an existing attribute and return its descriptor.
334 * if the new value is NULL, this is only a search, no update.
335 * when a new attribute is created, existing graphs/nodes/edges
336 * receive its default value.
337 */
338Agsym_t *agattr(Agraph_t * g, int kind, char *name, const char *value) {
339 Agsym_t *rv;
340
341 if (g == 0) {
342 if (ProtoGraph == 0)
343 ProtoGraph = agopen(0, ProtoDesc, 0);
344 g = ProtoGraph;
345 }
346 if (value)
347 rv = setattr(g, kind, name, value);
348 else
349 rv = getattr(g, kind, name);
350 return rv;
351}
352
353Agsym_t *agnxtattr(Agraph_t * g, int kind, Agsym_t * attr)
354{
355 Dict_t *d;
356 Agsym_t *rv;
357
358 if ((d = agdictof(g, kind))) {
359 if (attr)
360 rv = dtnext(d, attr);
361 else
362 rv = dtfirst(d);
363 } else
364 rv = 0;
365 return rv;
366}
367
368/* Create or delete attributes associated with an object */
369
371{
372 Agraph_t *context;
373
374 g->desc.has_attrs = true;
376 if (!(context = agparent(g)))
377 context = g;
378 agmakeattrs(context, g);
379}
380
382{
383 Agdatadict_t *dd;
384 Agattr_t *attr;
385
386 Ag_G_global = g;
387 if ((attr = agattrrec(g))) {
388 freeattr((Agobj_t *) g, attr);
389 agdelrec(g, attr->h.name);
390 }
391
392 if ((dd = agdatadict(g, false))) {
393 if (agdtclose(g, dd->dict.n)) return 1;
394 if (agdtclose(g, dd->dict.e)) return 1;
395 if (agdtclose(g, dd->dict.g)) return 1;
396 agdelrec(g, dd->h.name);
397 }
398 return 0;
399}
400
402{
403 Agattr_t *data;
404
405 data = agattrrec(n);
406 if (!data || !data->dict)
407 (void) agmakeattrs(g, n);
408}
409
411{
412 Agattr_t *rec;
413
414 if ((rec = agattrrec(n))) {
415 freeattr((Agobj_t *) n, rec);
417 }
418}
419
421{
422 Agattr_t *data;
423
424 data = agattrrec(e);
425 if (!data || !data->dict)
426 (void) agmakeattrs(g, e);
427}
428
430{
431 Agattr_t *rec;
432
433 if ((rec = agattrrec(e))) {
434 freeattr((Agobj_t *) e, rec);
436 }
437}
438
439char *agget(void *obj, char *name)
440{
441 Agsym_t *sym;
442 Agattr_t *data;
443 char *rv;
444
445 sym = agattrsym(obj, name);
446 if (sym == NULL)
447 rv = 0; /* note was "", but this provides more info */
448 else {
449 data = agattrrec(obj);
450 rv = data->str[sym->id];
451 }
452 return rv;
453}
454
455char *agxget(void *obj, Agsym_t * sym)
456{
457 Agattr_t *data;
458 char *rv;
459
460 data = agattrrec(obj);
461 assert(sym->id >= 0 && sym->id < topdictsize(obj));
462 rv = data->str[sym->id];
463 return rv;
464}
465
466int agset(void *obj, char *name, const char *value) {
467 Agsym_t *sym;
468 int rv;
469
470 sym = agattrsym(obj, name);
471 if (sym == NULL)
472 rv = FAILURE;
473 else
474 rv = agxset(obj, sym, value);
475 return rv;
476}
477
478int agxset(void *obj, Agsym_t * sym, const char *value)
479{
480 Agraph_t *g;
481 Agobj_t *hdr;
482 Agattr_t *data;
483 Agsym_t *lsym;
484
485 g = agraphof(obj);
486 hdr = obj;
487 data = agattrrec(hdr);
488 assert(sym->id >= 0 && sym->id < topdictsize(obj));
489 agstrfree(g, data->str[sym->id]);
490 data->str[sym->id] = agstrdup(g, value);
491 if (hdr->tag.objtype == AGRAPH) {
492 /* also update dict default */
493 Dict_t *dict;
494 dict = agdatadict(g, false)->dict.g;
495 if ((lsym = aglocaldictsym(dict, sym->name))) {
496 agstrfree(g, lsym->defval);
497 lsym->defval = agstrdup(g, value);
498 } else {
499 lsym = agnewsym(g, sym->name, value, sym->id, AGTYPE(hdr));
500 dtinsert(dict, lsym);
501 }
502 }
503 agmethod_upd(g, obj, sym);
504 return SUCCESS;
505}
506
507int agsafeset(void *obj, char *name, const char *value, const char *def) {
508 Agsym_t *a;
509
510 a = agattr(agraphof(obj), AGTYPE(obj), name, 0);
511 if (!a)
512 a = agattr(agraphof(obj), AGTYPE(obj), name, def);
513 return agxset(obj, a, value);
514}
515
516static void agraphattr_init_wrapper(Agraph_t *g, Agobj_t *ignored1,
517 void *ignored2) {
518 (void)ignored1;
519 (void)ignored2;
520
522}
523
524/*
525 * attach attributes to the already created graph objs.
526 * presumably they were already initialized, so we don't invoke
527 * any of the old methods.
528 */
529static void init_all_attrs(Agraph_t * g)
530{
531 Agraph_t *root;
532 Agnode_t *n;
533 Agedge_t *e;
534
535 root = agroot(g);
536 agapply(root, (Agobj_t*)root, agraphattr_init_wrapper, NULL, true);
537 for (n = agfstnode(root); n; n = agnxtnode(root, n)) {
538 agnodeattr_init(g, n);
539 for (e = agfstout(root, n); e; e = agnxtout(root, e)) {
540 agedgeattr_init(g, e);
541 }
542 }
543}
544
545/* Assumes attributes have already been declared.
546 * Do not copy key attribute for edges, as this must be distinct.
547 * Returns non-zero on failure or if objects have different type.
548 */
549int agcopyattr(void *oldobj, void *newobj)
550{
551 Agraph_t *g;
552 Agsym_t *sym;
553 Agsym_t *newsym;
554 char* val;
555 char* nval;
556 int r = 1;
557
558 g = agraphof(oldobj);
559 if (AGTYPE(oldobj) != AGTYPE(newobj))
560 return 1;
561 sym = 0;
562 while ((sym = agnxtattr(g, AGTYPE(oldobj), sym))) {
563 newsym = agattrsym(newobj, sym->name);
564 if (!newsym)
565 return 1;
566 val = agxget(oldobj, sym);
567 r = agxset(newobj, newsym, val);
568 /* FIX(?): Each graph has its own string cache, so a whole new refstr is possibly
569 * allocated. If the original was an html string, make sure the new one is as well.
570 * If cgraph goes to single string table, this can be removed.
571 */
572 if (aghtmlstr (val)) {
573 nval = agxget (newobj, newsym);
574 agmarkhtmlstr (nval);
575 }
576 }
577 return r;
578}
Memory allocation wrappers that exit on failure.
static void * gv_recalloc(void *ptr, size_t old_nmemb, size_t new_nmemb, size_t size)
Definition alloc.h:73
static void * gv_calloc(size_t nmemb, size_t size)
Definition alloc.h:26
static void * gv_alloc(size_t size)
Definition alloc.h:47
int agapply(Agraph_t *g, Agobj_t *obj, agobjfn_t fn, void *arg, int preorder)
Definition apply.c:60
static void agraphattr_init_wrapper(Agraph_t *g, Agobj_t *ignored1, void *ignored2)
Definition attr.c:516
static Agsym_t * agdictsym(Dict_t *dict, char *name)
Definition attr.c:137
#define MINATTR
Definition attr.c:30
static void freeattr(Agobj_t *obj, Agattr_t *attr)
Definition attr.c:208
char * AgDataRecName
Definition attr.c:171
static Agdatadict_t * agmakedatadict(Agraph_t *g)
Definition attr.c:108
static Agraph_t * ProtoGraph
Definition attr.c:47
static int topdictsize(Agobj_t *obj)
Definition attr.c:173
static Agdesc_t ProtoDesc
Definition attr.c:45
static Dict_t * agdictof(Agraph_t *g, int kind)
Definition attr.c:58
static void init_all_attrs(Agraph_t *g)
Definition attr.c:529
Dtdisc_t AgDataDictDisc
Definition attr.c:34
static Agsym_t * setattr(Agraph_t *g, int kind, char *name, const char *value)
Definition attr.c:275
static void addattr(Agraph_t *g, Agobj_t *obj, Agsym_t *sym)
Definition attr.c:235
static Agrec_t * agmakeattrs(Agraph_t *context, void *obj)
Definition attr.c:182
static void unviewsubgraphsattr(Agraph_t *parent, char *name)
Definition attr.c:255
static Agsym_t * aglocaldictsym(Dict_t *dict, char *name)
Definition attr.c:145
static void agcopydict(Dict_t *src, Dict_t *dest, Agraph_t *g, int kind)
Definition attr.c:95
static void freesym(void *obj)
Definition attr.c:220
static char DataDictName[]
Definition attr.c:43
static Agsym_t * getattr(Agraph_t *g, int kind, char *name)
Definition attr.c:245
static Agsym_t * agnewsym(Agraph_t *g, const char *name, const char *value, int id, int kind)
Definition attr.c:85
#define dtsearch(d, o)
Definition cdt.h:183
CDT_API int dtsize(Dt_t *)
Definition dtsize.c:12
#define dtinsert(d, o)
Definition cdt.h:185
CDT_API Dt_t * dtview(Dt_t *, Dt_t *)
Definition dtview.c:91
CDT_API Dtmethod_t * Dttree
Definition dttree.c:308
#define dtnext(d, o)
Definition cdt.h:180
#define dtfirst(d)
Definition cdt.h:179
cgraph.h additions
Dict_t * agdtopen(Agraph_t *g, Dtdisc_t *disc, Dtmethod_t *method)
Definition utils.c:21
Agraph_t * Ag_G_global
Definition graph.c:24
#define FAILURE
Definition cghdr.h:45
void agmarkhtmlstr(char *s)
Definition refstr.c:174
#define SUCCESS
Definition cghdr.h:44
int agdtclose(Agraph_t *g, Dict_t *dict)
Definition utils.c:32
#define parent(i)
Definition closest.c:80
void free(void *)
node NULL
Definition grammar.y:163
Agattr_t * agattrrec(void *obj)
Definition attr.c:229
void agnodeattr_init(Agraph_t *g, Agnode_t *n)
Definition attr.c:401
void agnodeattr_delete(Agnode_t *n)
Definition attr.c:410
Agsym_t * agattrsym(void *obj, char *name)
looks up a string attribute for a graph object given as an argument
Definition attr.c:156
Agsym_t * agattr(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up attributes of a graph
Definition attr.c:338
int agset(void *obj, char *name, const char *value)
Definition attr.c:466
Agsym_t * agnxtattr(Agraph_t *g, int kind, Agsym_t *attr)
permits traversing the list of attributes of a given type
Definition attr.c:353
void agedgeattr_init(Agraph_t *g, Agedge_t *e)
Definition attr.c:420
int agxset(void *obj, Agsym_t *sym, const char *value)
Definition attr.c:478
void agraphattr_init(Agraph_t *g)
Definition attr.c:370
char * agget(void *obj, char *name)
Definition attr.c:439
int agsafeset(void *obj, char *name, const char *value, const char *def)
ensures the given attribute is declared before setting it locally on an object
Definition attr.c:507
void agedgeattr_delete(Agedge_t *e)
Definition attr.c:429
Agdatadict_t * agdatadict(Agraph_t *g, bool cflag)
Definition attr.c:49
char * agxget(void *obj, Agsym_t *sym)
Definition attr.c:455
int agcopyattr(void *oldobj, void *newobj)
copies all of the attributes from one object to another
Definition attr.c:549
int agraphattr_delete(Agraph_t *g)
Definition attr.c:381
void agmethod_upd(Agraph_t *g, void *obj, Agsym_t *sym)
Definition obj.c:108
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Definition edge.c:24
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
Definition edge.c:39
void agwarningf(const char *fmt,...)
Definition agerror.c:173
void agerrorf(const char *fmt,...)
Definition agerror.c:165
void(* agobjfn_t)(Agraph_t *g, Agobj_t *obj, void *arg)
Definition cgraph.h:369
Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
creates a new graph with the given name and kind
Definition graph.c:44
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Definition node.c:47
Agnode_t * agfstnode(Agraph_t *g)
Definition node.c:40
Agraph_t * agraphof(void *obj)
Definition obj.c:185
#define AGTYPE(obj)
returns AGRAPH, AGNODE, or AGEDGE depending on the type of the object
Definition cgraph.h:216
Agraph_t * agroot(void *obj)
Definition obj.c:168
@ AGOUTEDGE
Definition cgraph.h:207
@ AGEDGE
Definition cgraph.h:207
@ AGNODE
Definition cgraph.h:207
@ AGINEDGE
Definition cgraph.h:207
@ AGRAPH
Definition cgraph.h:207
Agrec_t * aggetrec(void *obj, const char *name, int move_to_front)
find record in circular list and do optional move-to-front and lock
Definition rec.c:41
void * agbindrec(void *obj, const char *name, unsigned int recsize, int move_to_front)
attaches a new record of the given size to the object
Definition rec.c:89
int agdelrec(void *obj, const char *name)
deletes a named record from one object
Definition rec.c:137
int aghtmlstr(const char *)
Definition refstr.c:164
int agstrfree(Agraph_t *, const char *)
Definition refstr.c:139
char * agstrdup(Agraph_t *, const char *)
returns a pointer to a reference-counted copy of the argument string, creating one if necessary
Definition refstr.c:131
Agraph_t * agparent(Agraph_t *g)
Definition subg.c:91
Agraph_t * agfstsubg(Agraph_t *g)
Definition subg.c:78
Agraph_t * agnxtsubg(Agraph_t *subg)
Definition subg.c:83
static uint64_t id
Definition gv2gml.c:42
ViewInfo * view
Definition viewport.c:37
static bool streq(const char *a, const char *b)
are a and b equal?
Definition streq.h:11
string attribute container
Definition cgraph.h:629
char ** str
the attribute string values indexed by Agsym_s.id
Definition cgraph.h:632
Dict_t * dict
shared dict of Agsym_s to interpret Agattr_s.str
Definition cgraph.h:631
Agrec_t h
Definition cgraph.h:630
Dict_t * n
Definition cgraph.h:650
Dict_t * e
Definition cgraph.h:650
struct Agdatadict_s::@64 dict
Dict_t * g
Definition cgraph.h:650
Agrec_t h
< set of dictionaries per graph
Definition cgraph.h:648
graph descriptor
Definition cgraph.h:284
unsigned has_attrs
Definition cgraph.h:290
unsigned directed
Definition cgraph.h:285
a generic header of Agraph_s, Agnode_s and Agedge_s
Definition cgraph.h:210
Agtag_t tag
access with AGTAG
Definition cgraph.h:211
graph or subgraph
Definition cgraph.h:425
Agdesc_t desc
Definition cgraph.h:427
implementation of Agrec_t
Definition cgraph.h:172
char * name
Definition cgraph.h:173
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:637
char * name
Definition cgraph.h:639
unsigned char kind
Definition cgraph.h:642
int id
index in Agattr_s.str
Definition cgraph.h:641
unsigned char fixed
Definition cgraph.h:643
char * defval
Definition cgraph.h:640
unsigned char print
Definition cgraph.h:644
unsigned objtype
access with AGTYPE
Definition cgraph.h:199
Definition legal.c:50
Definition cdt.h:100
#define UNREACHABLE()
Definition unreachable.h:30