Graphviz 13.0.0~dev.20250121.0651
Loading...
Searching...
No Matches
gxl2gv.c
Go to the documentation of this file.
1
6/*************************************************************************
7 * Copyright (c) 2011 AT&T Intellectual Property
8 * All rights reserved. This program and the accompanying materials
9 * are made available under the terms of the Eclipse Public License v1.0
10 * which accompanies this distribution, and is available at
11 * https://www.eclipse.org/legal/epl-v10.html
12 *
13 * Contributors: Details at https://graphviz.org
14 *************************************************************************/
15
16#include <assert.h>
17#include "convert.h"
18#include <stdbool.h>
19#include <stdio.h>
20#include <util/agxbuf.h>
21#include <util/alloc.h>
22#include <util/exit.h>
23#include <util/gv_ctype.h>
24#include <util/list.h>
25#include <util/startswith.h>
26#include <util/unreachable.h>
27#ifdef HAVE_EXPAT
28#include <expat.h>
29#include <limits.h>
30#include <stdlib.h>
31
32#ifndef XML_STATUS_ERROR
33#define XML_STATUS_ERROR 0
34#endif
35
36#define NAMEBUF 100
37
38#define GXL_ATTR "_gxl_"
39#define GXL_ID "_gxl_id"
40#define GXL_ROLE "_gxl_role"
41#define GXL_HYPER "_gxl_hypergraph"
42#define GXL_FROM "_gxl_fromorder"
43#define GXL_TO "_gxl_toorder"
44#define GXL_TYPE "_gxl_type"
45#define GXL_COMP "_gxl_composite_"
46#define GXL_LOC "_gxl_locator_"
47
48typedef enum {
49 TAG_NONE,
50 TAG_GRAPH,
51 TAG_NODE,
52 TAG_EDGE,
53 TAG_HTML_LIKE_STRING,
54} attr_t;
55
56typedef struct {
57 agxbuf xml_attr_name;
58 agxbuf xml_attr_value;
59 agxbuf composite_buffer;
60 bool listen;
61 attr_t closedElementType;
62 attr_t globalAttrType;
63 bool compositeReadState;
64 bool edgeinverted;
65 Dt_t *nameMap;
66} userdata_t;
67
68static Agraph_t *root; /* root graph */
69static attr_t Current_class; /* Current element type */
70static Agraph_t *G; /* Current graph */
71static Agnode_t *N; /* Set if Current_class == TAG_NODE */
72static Agedge_t *E; /* Set if Current_class == TAG_EDGE */
73
74DEFINE_LIST(graph_stack, Agraph_t *)
75static graph_stack_t Gstack;
76
77typedef struct {
78 Dtlink_t link;
79 char *name;
80 char *unique_name;
81} namev_t;
82
83static void *make_nitem(void *p, Dtdisc_t *disc){
84 (void)disc;
85 namev_t *objp = p;
86
87 namev_t *np = malloc(sizeof(namev_t));
88 if (np == NULL)
89 return NULL;
90 np->name = objp->name;
91 np->unique_name = 0;
92 return np;
93}
94
95static void free_nitem(void *name) {
96 namev_t *np = name;
97 free(np->unique_name);
98 free(np);
99}
100
101static Dtdisc_t nameDisc = {
102 .key = offsetof(namev_t, name),
103 .size = -1,
104 .link = offsetof(namev_t, link),
105 .makef = make_nitem,
106 .freef = free_nitem,
107};
108
109static userdata_t genUserdata(void) {
110 userdata_t user = {0};
111 user.listen = false;
112 user.closedElementType = TAG_NONE;
113 user.globalAttrType = TAG_NONE;
114 user.compositeReadState = false;
115 user.edgeinverted = false;
116 user.nameMap = dtopen(&nameDisc, Dtoset);
117 return user;
118}
119
120static void freeUserdata(userdata_t ud) {
121 dtclose(ud.nameMap);
122 agxbfree(&ud.xml_attr_name);
123 agxbfree(&ud.xml_attr_value);
124 agxbfree(&ud.composite_buffer);
125}
126
127static void addToMap(Dt_t * map, char *name, char *uniqueName)
128{
129 namev_t obj;
130 namev_t *objp;
131
132 obj.name = name;
133 objp = dtinsert(map, &obj);
134 assert(objp->unique_name == 0);
135 objp->unique_name = gv_strdup(uniqueName);
136}
137
138static char *mapLookup(Dt_t *nm, const char *name) {
139 namev_t *objp = dtmatch(nm, name);
140 if (objp)
141 return objp->unique_name;
142 else
143 return 0;
144}
145
146static int isAnonGraph(const char *name)
147{
148 if (*name++ != '%')
149 return 0;
150 while (gv_isdigit(*name))
151 name++; /* skip over digits */
152 return (*name == '\0');
153}
154
155static void push_subg(Agraph_t * g)
156{
157 // insert the new graph
158 graph_stack_push_back(&Gstack, g);
159
160 // save the root if this is the first graph
161 if (graph_stack_size(&Gstack) == 1) {
162 root = g;
163 }
164
165 // update the top graph
166 G = g;
167}
168
169static Agraph_t *pop_subg(void)
170{
171 // is the stack empty?
172 if (graph_stack_is_empty(&Gstack)) {
173 fprintf(stderr, "gxl2gv: Gstack underflow in graph parser\n");
174 graphviz_exit(EXIT_FAILURE);
175 }
176
177 // pop the top graph
178 Agraph_t *g = graph_stack_pop_back(&Gstack);
179
180 // update the top graph
181 if (!graph_stack_is_empty(&Gstack))
182 G = *graph_stack_back(&Gstack);
183
184 return g;
185}
186
187static Agnode_t *bind_node(const char *name)
188{
189 N = agnode(G, (char *) name, 1);
190 return N;
191}
192
193static Agedge_t *bind_edge(const char *tail, const char *head)
194{
195 Agnode_t *tailNode, *headNode;
196 char *key = 0;
197
198 tailNode = agnode(G, (char *) tail, 1);
199 headNode = agnode(G, (char *) head, 1);
200 E = agedge(G, tailNode, headNode, key, 1);
201 return E;
202}
203
204static int get_xml_attr(char *attrname, const char **atts)
205{
206 int count = 0;
207 while (atts[count] != NULL) {
208 if (strcmp(attrname, atts[count]) == 0) {
209 return count + 1;
210 }
211 count += 2;
212 }
213 return -1;
214}
215
216static void setName(Dt_t * names, Agobj_t * n, char *value)
217{
218 Agsym_t *ap;
219 char *oldName;
220
221 ap = agattr(root, AGTYPE(n), GXL_ID, "");
222 agxset(n, ap, agnameof(n));
223 oldName = agxget(n, ap); /* set/get gives us new copy */
224 addToMap(names, oldName, value);
225 agrename(n, value);
226}
227
228static char *defval = "";
229
230static void
231setNodeAttr(Agnode_t * np, char *name, char *value, userdata_t * ud,
232 bool is_html)
233{
234 Agsym_t *ap;
235
236 if (strcmp(name, "name") == 0) {
237 setName(ud->nameMap, (Agobj_t *) np, value);
238 } else {
239 ap = agattr(root, AGNODE, name, 0);
240 if (!ap)
241 ap = agattr(root, AGNODE, name, defval);
242 if (is_html) {
243 agxset_html(np, ap, value);
244 } else {
245 agxset(np, ap, value);
246 }
247 }
248}
249
250#define NODELBL "node:"
251#define NLBLLEN (sizeof(NODELBL)-1)
252#define EDGELBL "edge:"
253#define ELBLLEN (sizeof(EDGELBL)-1)
254
255/* setGlobalNodeAttr:
256 * Set global node attribute.
257 * The names must always begin with "node:".
258 */
259static void
260setGlobalNodeAttr(Agraph_t * g, char *name, char *value)
261{
262 if (!startswith(name, NODELBL))
263 fprintf(stderr,
264 "Warning: global node attribute %s in graph %s does not begin with the prefix %s\n",
265 name, agnameof(g), NODELBL);
266 else
267 name += NLBLLEN;
268 if ((g != root) && !agattr(root, AGNODE, name, 0))
269 agattr(root, AGNODE, name, defval);
270 agattr(G, AGNODE, name, value);
271}
272
273static void
274setEdgeAttr(Agedge_t * ep, char *name, char *value, userdata_t * ud,
275 bool is_html)
276{
277 Agsym_t *ap;
278 char *attrname;
279
280 if (strcmp(name, "headport") == 0) {
281 if (ud->edgeinverted)
282 attrname = "tailport";
283 else
284 attrname = "headport";
285 ap = agattr(root, AGEDGE, attrname, 0);
286 if (!ap)
287 ap = agattr(root, AGEDGE, attrname, defval);
288 } else if (strcmp(name, "tailport") == 0) {
289 if (ud->edgeinverted)
290 attrname = "headport";
291 else
292 attrname = "tailport";
293 ap = agattr(root, AGEDGE, attrname, 0);
294 if (!ap)
295 ap = agattr(root, AGEDGE, attrname, defval);
296 } else {
297 ap = agattr(root, AGEDGE, name, 0);
298 if (!ap)
299 ap = agattr(root, AGEDGE, name, defval);
300 }
301
302 if (is_html) {
303 agxset_html(ep, ap, value);
304 } else {
305 agxset(ep, ap, value);
306 }
307}
308
309/* setGlobalEdgeAttr:
310 * Set global edge attribute.
311 * The names always begin with "edge:".
312 */
313static void
314setGlobalEdgeAttr(Agraph_t * g, char *name, char *value)
315{
316 if (!startswith(name, EDGELBL))
317 fprintf(stderr,
318 "Warning: global edge attribute %s in graph %s does not begin with the prefix %s\n",
319 name, agnameof(g), EDGELBL);
320 else
321 name += ELBLLEN;
322 if ((g != root) && !agattr(root, AGEDGE, name, 0))
323 agattr(root, AGEDGE, name, defval);
324 agattr(g, AGEDGE, name, value);
325}
326
327static void
328setGraphAttr(Agraph_t * g, char *name, char *value, userdata_t * ud)
329{
330 Agsym_t *ap;
331
332 if ((g == root) && !strcmp(name, "strict") && !strcmp(value, "true")) {
333 g->desc.strict = true;
334 } else if (strcmp(name, "name") == 0)
335 setName(ud->nameMap, (Agobj_t *) g, value);
336 else {
337 ap = agattr(root, AGRAPH, name, 0);
338 if (ap)
339 agxset(g, ap, value);
340 else if (g == root)
341 agattr(root, AGRAPH, name, value);
342 else {
343 ap = agattr(root, AGRAPH, name, defval);
344 agxset(g, ap, value);
345 }
346 }
347}
348
349static void setAttr(char *name, char *value, userdata_t * ud, bool is_html)
350{
351 switch (Current_class) {
352 case TAG_GRAPH:
353 setGraphAttr(G, name, value, ud);
354 break;
355 case TAG_NODE:
356 setNodeAttr(N, name, value, ud, is_html);
357 break;
358 case TAG_EDGE:
359 setEdgeAttr(E, name, value, ud, is_html);
360 break;
361 default:
362 break;
363 }
364}
365
366/*------------- expat handlers ----------------------------------*/
367
368static void
369startElementHandler(void *userData, const char *name, const char **atts)
370{
371 int pos;
372 userdata_t *ud = userData;
373 Agraph_t *g = NULL;
374
375 if (strcmp(name, "gxl") == 0) {
376 /* do nothing */
377 } else if (strcmp(name, "graph") == 0) {
378 const char *edgeMode = "";
379 char buf[NAMEBUF]; /* holds % + number */
380
381 Current_class = TAG_GRAPH;
382 if (ud->closedElementType == TAG_GRAPH) {
383 fprintf(stderr,
384 "Warning: Node contains more than one graph.\n");
385 }
386 pos = get_xml_attr("id", atts);
387 if (pos <= 0) {
388 fprintf(stderr, "Error: Graph has no ID attribute.\n");
389 graphviz_exit(EXIT_FAILURE);
390 }
391 const char *id = atts[pos];
392 pos = get_xml_attr("edgemode", atts);
393 if (pos > 0) {
394 edgeMode = atts[pos];
395 }
396
397 if (graph_stack_is_empty(&Gstack)) {
398 if (strcmp(edgeMode, "directed") == 0) {
399 g = agopen((char *) id, Agdirected, &AgDefaultDisc);
400 } else if (strcmp(edgeMode, "undirected") == 0) {
401 g = agopen((char *) id, Agundirected, &AgDefaultDisc);
402 } else {
403 fprintf(stderr,
404 "Warning: graph has no edgemode attribute");
405 fprintf(stderr, " - assume directed\n");
406 g = agopen((char *) id, Agdirected, &AgDefaultDisc);
407 }
408 push_subg(g);
409 } else {
410 Agraph_t *subg;
411 if (isAnonGraph(id)) {
412 static int anon_id = 1;
413 snprintf(buf, sizeof(buf), "%%%d", anon_id++);
414 id = buf;
415 }
416 subg = agsubg(G, (char *) id, 1);
417 push_subg(subg);
418 }
419
420 pos = get_xml_attr("role", atts);
421 if (pos > 0) {
422 setGraphAttr(G, GXL_ROLE, (char *) atts[pos], ud);
423 }
424
425 pos = get_xml_attr("hypergraph", atts);
426 if (pos > 0) {
427 setGraphAttr(G, GXL_HYPER, (char *) atts[pos], ud);
428 }
429
430 } else if (strcmp(name, "node") == 0) {
431 Current_class = TAG_NODE;
432 pos = get_xml_attr("id", atts);
433 if (pos > 0) {
434 const char *attrname;
435 attrname = atts[pos];
436
437 if (attrname != NULL && strcmp(attrname, "") != 0) {
438 bind_node(attrname);
439 }
440 }
441
442 } else if (strcmp(name, "edge") == 0) {
443 const char *head = "", *tail = "";
444 char *tname;
445 Agnode_t *t;
446
447 Current_class = TAG_EDGE;
448 pos = get_xml_attr("from", atts);
449 if (pos > 0)
450 tail = atts[pos];
451 pos = get_xml_attr("to", atts);
452 if (pos > 0)
453 head = atts[pos];
454
455 tname = mapLookup(ud->nameMap, tail);
456 if (tname)
457 tail = tname;
458
459 tname = mapLookup(ud->nameMap, head);
460 if (tname)
461 head = tname;
462
463 bind_edge(tail, head);
464
465 t = AGTAIL(E);
466 tname = agnameof(t);
467
468 if (strcmp(tname, tail) == 0) {
469 ud->edgeinverted = false;
470 } else if (strcmp(tname, head) == 0) {
471 ud->edgeinverted = true;
472 }
473
474 pos = get_xml_attr("fromorder", atts);
475 if (pos > 0) {
476 setEdgeAttr(E, GXL_FROM, (char *) atts[pos], ud, false);
477 }
478
479 pos = get_xml_attr("toorder", atts);
480 if (pos > 0) {
481 setEdgeAttr(E, GXL_TO, (char *) atts[pos], ud, false);
482 }
483
484 pos = get_xml_attr("id", atts);
485 if (pos > 0) {
486 setEdgeAttr(E, GXL_ID, (char *) atts[pos], ud, false);
487 }
488 } else if (strcmp(name, "attr") == 0) {
489 const char *attrname = atts[get_xml_attr("name", atts)];
490
491 agxbput(&ud->xml_attr_name, attrname);
492 pos = get_xml_attr("kind", atts);
493
494 if (pos > 0) {
495 if (strcmp("node", atts[pos]) == 0)
496 ud->globalAttrType = TAG_NODE;
497 else if (strcmp("edge", atts[pos]) == 0)
498 ud->globalAttrType = TAG_EDGE;
499 else if (strcmp("graph", atts[pos]) == 0)
500 ud->globalAttrType = TAG_GRAPH;
501 else if (strcmp("HTML-like string", atts[pos]) == 0)
502 ud->globalAttrType = TAG_HTML_LIKE_STRING;
503 } else {
504 ud->globalAttrType = TAG_NONE;
505 }
506
507 } else if (strcmp(name, "string") == 0
508 || strcmp(name, "bool") == 0
509 || strcmp(name, "int") == 0 || strcmp(name, "float") == 0) {
510
511 ud->listen = true;
512 if (ud->compositeReadState) {
513 agxbprint(&ud->composite_buffer, "<%s>", name);
514 }
515 } else if (strcmp(name, "rel") == 0 || strcmp(name, "relend") == 0) {
516 fprintf(stderr, "%s element is ignored by DOT\n", name);
517 } else if (strcmp(name, "type") == 0) {
518 pos = get_xml_attr("xlink:href", atts);
519 if (pos > 0) {
520 setAttr(GXL_TYPE, (char *) atts[pos], ud, false);
521 }
522 } else if (strcmp(name, "locator") == 0) {
523 pos = get_xml_attr("xlink:href", atts);
524 if (pos > 0) {
525 const char *href = atts[pos];
526 agxbprint(&ud->xml_attr_value, "%s%s", GXL_LOC, href);
527 }
528 } else if (strcmp(name, "seq") == 0
529 || strcmp(name, "set") == 0
530 || strcmp(name, "bag") == 0
531 || strcmp(name, "tup") == 0 || strcmp(name, "enum") == 0) {
532
533 ud->compositeReadState = true;
534 agxbprint(&ud->composite_buffer, "<%s>", name);
535 } else {
536 /* must be some extension */
537 fprintf(stderr,
538 "Unknown node %s; DOT does not support extensions.\n",
539 name);
540 }
541}
542
543static void endElementHandler(void *userData, const char *name)
544{
545 userdata_t *ud = userData;
546
547 if (strcmp(name, "graph") == 0) {
548 pop_subg();
549 ud->closedElementType = TAG_GRAPH;
550 } else if (strcmp(name, "node") == 0) {
551 Current_class = TAG_GRAPH;
552 N = 0;
553 ud->closedElementType = TAG_NODE;
554 } else if (strcmp(name, "edge") == 0) {
555 Current_class = TAG_GRAPH;
556 E = 0;
557 ud->closedElementType = TAG_EDGE;
558 ud->edgeinverted = false;
559 } else if (strcmp(name, "attr") == 0) {
560 agxbuf new_name = {0};
561 char *value;
562
563 ud->closedElementType = TAG_NONE;
564 if (ud->compositeReadState) {
565 agxbprint(&new_name, "%s%s", GXL_COMP, agxbuse(&ud->xml_attr_name));
566 value = agxbuse(&ud->composite_buffer);
567 agxbclear(&ud->xml_attr_value);
568 ud->compositeReadState = false;
569 } else {
570 agxbput(&new_name, agxbuse(&ud->xml_attr_name));
571 value = agxbuse(&ud->xml_attr_value);
572 }
573
574 switch (ud->globalAttrType) {
575 case TAG_NONE:
576 setAttr(agxbuse(&new_name), value, ud, false);
577 break;
578 case TAG_NODE:
579 setGlobalNodeAttr(G, agxbuse(&new_name), value);
580 break;
581 case TAG_EDGE:
582 setGlobalEdgeAttr(G, agxbuse(&new_name), value);
583 break;
584 case TAG_GRAPH:
585 setGraphAttr(G, agxbuse(&new_name), value, ud);
586 break;
587 case TAG_HTML_LIKE_STRING:
588 setAttr(agxbuse(&new_name), value, ud, true);
589 break;
590 default:
591 UNREACHABLE();
592 }
593 agxbfree(&new_name);
594 ud->globalAttrType = TAG_NONE;
595 } else if (strcmp(name, "string") == 0
596 || strcmp(name, "bool") == 0
597 || strcmp(name, "int") == 0 || strcmp(name, "float") == 0) {
598 ud->listen = false;
599 if (ud->compositeReadState) {
600 agxbprint(&ud->composite_buffer, "</%s>", name);
601 }
602 } else if (strcmp(name, "seq") == 0
603 || strcmp(name, "set") == 0
604 || strcmp(name, "bag") == 0
605 || strcmp(name, "tup") == 0 || strcmp(name, "enum") == 0) {
606 agxbprint(&ud->composite_buffer, "</%s>", name);
607 }
608}
609
610static void characterDataHandler(void *userData, const char *s, int length)
611{
612 userdata_t *ud = userData;
613
614 assert(length >= 0 && "Expat returned negative length data");
615 size_t len = (size_t)length;
616
617 if (!ud->listen)
618 return;
619
620 if (ud->compositeReadState) {
621 agxbput_n(&ud->composite_buffer, s, len);
622 return;
623 }
624
625 agxbput_n(&ud->xml_attr_value, s, len);
626}
627
628Agraph_t *gxl_to_gv(FILE * gxlFile)
629{
630 char buf[BUFSIZ];
631 int done;
632 userdata_t udata = genUserdata();
633 XML_Parser parser = XML_ParserCreate(NULL);
634
635 XML_SetUserData(parser, &udata);
636 XML_SetElementHandler(parser, startElementHandler, endElementHandler);
637 XML_SetCharacterDataHandler(parser, characterDataHandler);
638
639 Current_class = TAG_GRAPH;
640 root = 0;
641 do {
642 size_t len = fread(buf, 1, sizeof(buf), gxlFile);
643 if (len == 0)
644 break;
645 done = len < sizeof(buf);
646 assert(len <= INT_MAX && "too large data for Expat API");
647 if (XML_Parse(parser, buf, (int)len, done) == XML_STATUS_ERROR) {
648 fprintf(stderr,
649 "%s at line %lu\n",
650 XML_ErrorString(XML_GetErrorCode(parser)),
651 XML_GetCurrentLineNumber(parser));
652 graphviz_exit(1);
653 }
654 } while (!done);
655 XML_ParserFree(parser);
656 freeUserdata(udata);
657 graph_stack_free(&Gstack);
658
659 return root;
660}
661
662#endif
static void agxbfree(agxbuf *xb)
free any malloced resources
Definition agxbuf.h:78
static size_t agxbput_n(agxbuf *xb, const char *s, size_t ssz)
append string s of length ssz into xb
Definition agxbuf.h:250
static int agxbprint(agxbuf *xb, const char *fmt,...)
Printf-style output to an agxbuf.
Definition agxbuf.h:234
static void agxbclear(agxbuf *xb)
resets pointer to data
Definition agxbuf.h:294
static WUR char * agxbuse(agxbuf *xb)
Definition agxbuf.h:307
Memory allocation wrappers that exit on failure.
static char * gv_strdup(const char *original)
Definition alloc.h:101
#define N(n)
Definition bcomps.c:58
#define dtmatch(d, o)
Definition cdt.h:184
#define dtinsert(d, o)
Definition cdt.h:185
CDT_API int dtclose(Dt_t *)
Definition dtclose.c:8
CDT_API Dtmethod_t * Dtoset
ordered set (self-adjusting tree)
Definition dttree.c:304
CDT_API Dt_t * dtopen(Dtdisc_t *, Dtmethod_t *)
Definition dtopen.c:9
int agrename(Agobj_t *obj, char *newname)
Definition obj.c:41
Agsym_t * setAttr(graph_t *g, void *obj, char *name, char *value, Agsym_t *ap)
Definition utils.c:701
DOT-GXL converter API for gxl2gv.c and gv2gxl.c.
#define head
Definition dthdr.h:15
static NORETURN void graphviz_exit(int status)
Definition exit.h:23
static Dtdisc_t disc
Definition exparse.y:209
#define E
Definition gdefs.h:6
#define G
Definition gdefs.h:7
static double len(glCompPoint p)
Definition glutils.c:150
void * malloc(YYSIZE_T)
void free(void *)
node NULL
Definition grammar.y:163
Agsym_t * agattr(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up attributes of a graph
Definition attr.c:371
int agxset(void *obj, Agsym_t *sym, const char *value)
Definition attr.c:532
int agxset_html(void *obj, Agsym_t *sym, const char *value)
Definition attr.c:536
char * agxget(void *obj, Agsym_t *sym)
Definition attr.c:481
Agdisc_t AgDefaultDisc
Definition graph.c:285
Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
Definition edge.c:256
#define AGTAIL(e)
Definition cgraph.h:884
Agdesc_t Agundirected
undirected
Definition graph.c:282
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
Agdesc_t Agdirected
directed
Definition graph.c:280
Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
Definition node.c:140
char * agnameof(void *)
returns a string descriptor for the object.
Definition id.c:143
#define AGTYPE(obj)
returns AGRAPH, AGNODE, or AGEDGE depending on the type of the object
Definition cgraph.h:216
@ AGEDGE
Definition cgraph.h:207
@ AGNODE
Definition cgraph.h:207
@ AGRAPH
Definition cgraph.h:207
Agraph_t * agsubg(Agraph_t *g, char *name, int cflag)
Definition subg.c:55
#define GXL_FROM
Definition gv2gxl.c:34
static Dtdisc_t nameDisc
Definition gv2gxl.c:66
static char * mapLookup(Dt_t *nm, char *name)
Definition gv2gxl.c:202
static void * make_nitem(void *p, Dtdisc_t *disc)
Definition gv2gxl.c:56
#define GXL_COMP
Definition gv2gxl.c:37
#define GXL_LOC
Definition gv2gxl.c:38
#define GXL_ID
Definition gv2gxl.c:33
#define GXL_TYPE
Definition gv2gxl.c:36
static void addToMap(Dt_t *map, char *name, char *uniqueName)
Definition gv2gxl.c:243
#define GXL_TO
Definition gv2gxl.c:35
#define GXL_HYPER
Definition gv2gxl.c:32
#define GXL_ROLE
Definition gv2gxl.c:31
replacements for ctype.h functions
static bool gv_isdigit(int c)
Definition gv_ctype.h:41
agxbput(xb, staging)
#define XML_STATUS_ERROR
Definition htmllex.c:41
#define DEFINE_LIST(name, type)
Definition list.h:21
static bool startswith(const char *s, const char *prefix)
does the string s begin with the string prefix?
Definition startswith.h:11
unsigned strict
Definition cgraph.h:286
a generic header of Agraph_s, Agnode_s and Agedge_s
Definition cgraph.h:210
graph or subgraph
Definition cgraph.h:424
Agdesc_t desc
Definition cgraph.h:426
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:641
Definition cdt.h:100
int key
Definition cdt.h:85
char * unique_name
Definition gv2gxl.c:53
char * name
Definition gv2gxl.c:52
Definition grammar.c:93
#define UNREACHABLE()
Definition unreachable.h:30