2
This software may only be used by you under license from AT&T Corp.
3
("AT&T"). A copy of AT&T's Source Code Agreement is available at
4
AT&T's Internet website having the URL:
5
<http://www.research.att.com/sw/tools/graphviz/license/source.html>
6
If you received this software without first entering into a license
7
with AT&T, you have an infringing copy of this software and cannot use
8
it without violating AT&T's intellectual property rights.
18
static Agraph_t *agfindsubg_by_id(Agraph_t *g, unsigned long id)
22
agdtdisc(g,g->g_dict,&Ag_obj_id_disc);
24
return (Agraph_t*)dtsearch(g->g_dict,&template);
27
static Agraph_t *localsubg(Agraph_t *g, unsigned long id)
31
subg = agfindsubg_by_id(g,id);
32
if (subg) return subg;
34
subg = agalloc(g,sizeof(Agraph_t));
37
subg->desc.maingraph = FALSE;
38
subg->desc.flatlock = FALSE;
45
Agraph_t *agidsubg(Agraph_t *g, unsigned long id, int cflag)
48
subg = agfindsubg_by_id(g,id);
49
if ((subg == NILgraph) && cflag && agallocid(g,AGRAPH,id))
50
subg = localsubg(g, id);
54
Agraph_t *agsubg(Agraph_t *g, char *name, int cflag)
59
if (name && agmapnametoid(g, AGRAPH, name, &id, FALSE)) {
60
/* might already exist */
61
if ((subg = agfindsubg_by_id(g,id))) return subg;
64
if (cflag && agmapnametoid(g, AGRAPH, name, &id, TRUE)) /* reserve id */
65
return localsubg(g, id);
70
Agraph_t *agfstsubg(Agraph_t *g)
72
return (Agraph_t*) dtfirst(g->g_dict);
75
Agraph_t *agnxtsubg(Agraph_t *subg)
80
return (Agraph_t*) dtnext(g->g_dict,subg);
83
Agraph_t *agparent(Agraph_t *g)
88
Agraph_t *agroot(Agraph_t *g)
93
/* this function is only responsible for deleting the entry
94
* in the parent's subg dict. the rest is done in agclose().
96
long agdelsubg(Agraph_t* g, Agraph_t *subg)
98
return (long)dtdelete(g->g_dict,subg);