free(ud);
}
-static void addToMap(Dt_t * map, char *name, char *uniqueName)
-{
- namev_t obj;
- namev_t *objp;
-
- obj.name = name;
- objp = dtinsert(map, &obj);
- assert(objp->unique_name == 0);
- objp->unique_name = gv_strdup(uniqueName);
-}
-
static char *mapLookup(Dt_t *nm, const char *name) {
namev_t *objp = dtmatch(nm, name);
if (objp)
return -1;
}
-static void setName(Dt_t * names, Agobj_t * n, char *value)
-{
- Agsym_t *ap;
- char *oldName;
-
- ap = agattr(root, AGTYPE(n), GRAPHML_ID, "");
- agxset(n, ap, agnameof(n));
- oldName = agxget(n, ap); /* set/get gives us new copy */
- addToMap(names, oldName, value);
- agrename(n, value);
-}
-
static char *defval = "";
-static void
-setNodeAttr(Agnode_t * np, char *name, char *value, userdata_t * ud)
-{
- Agsym_t *ap;
-
- if (strcmp(name, "name") == 0) {
- setName(ud->nameMap, (Agobj_t *) np, value);
- } else {
- ap = agattr(root, AGNODE, name, 0);
- if (!ap)
- ap = agattr(root, AGNODE, name, defval);
- agxset(np, ap, value);
- }
-}
-
static void
setEdgeAttr(Agedge_t * ep, char *name, char *value, userdata_t * ud)
{
}
}
-static void
-setGraphAttr(Agraph_t * g, char *name, char *value, userdata_t * ud)
-{
- Agsym_t *ap;
-
- if ((g == root) && !strcmp(name, "strict") && !strcmp(value, "true")) {
- g->desc.strict = 1;
- } else if (strcmp(name, "name") == 0)
- setName(ud->nameMap, (Agobj_t *) g, value);
- else {
- ap = agattr(root, AGRAPH, name, 0);
- if (ap)
- agxset(g, ap, value);
- else if (g == root)
- agattr(root, AGRAPH, name, value);
- else {
- ap = agattr(root, AGRAPH, name, defval);
- agxset(g, ap, value);
- }
- }
-}
-
-static void setAttr(char *name, char *value, userdata_t * ud)
-{
- switch (Current_class) {
- case TAG_GRAPH:
- setGraphAttr(G, name, value, ud);
- break;
- case TAG_NODE:
- setNodeAttr(N, name, value, ud);
- break;
- case TAG_EDGE:
- setEdgeAttr(E, name, value, ud);
- break;
- }
-}
-
/*------------- expat handlers ----------------------------------*/
static void
E = 0;
ud->closedElementType = TAG_EDGE;
ud->edgeinverted = FALSE;
- } else if (strcmp(name, "attr") == 0) {
- char *name = "";
- char *value = "";
-
- ud->closedElementType = TAG_NONE;
-
- setAttr(name, value, ud);
- }
+ }
}
static Agraph_t *graphml_to_gv(char* gname, FILE * graphmlFile, int* rv)