Exemplo n.º 1
0
/* processClusterEdges:
 * Look for cluster edges. Replace cluster edge endpoints
 * corresponding to a cluster with special cluster nodes.
 * Delete original nodes.
 * Return 0 if no cluster edges; 1 otherwise.
 */
int processClusterEdges(graph_t * g)
{
    int rv;
    node_t *n;
    node_t *nxt;
    edge_t *e;
    graph_t *clg;
    agxbuf xb;
    Dt_t *map;
    Dt_t *cmap = mkClustMap (g);
    unsigned char buf[SMALLBUF];

    map = dtopen(&mapDisc, Dtoset);
    clg = agsubg(g, "__clusternodes",1);
    agbindrec(clg, "Agraphinfo_t", sizeof(Agraphinfo_t), TRUE);
    agxbinit(&xb, SMALLBUF, buf);
    for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
	if (IS_CLUST_NODE(n)) continue;
	for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
	    checkCompound(e, clg, &xb, map, cmap);
	}
    }
    agxbfree(&xb);
    dtclose(map);
    rv = agnnodes(clg);
    for (n = agfstnode(clg); n; n = nxt) {
	nxt = agnxtnode(clg, n);
	agdelete(g, n);
    }
    agclose(clg);
    if (rv)
	SET_CLUST_EDGE(g);
    dtclose(cmap);
    return rv;
}
Exemplo n.º 2
0
static void
free_mcGroup (mcGroup* g)
{
    dtclose (g->nodes);
#if 0
    dtclose (g->children);
#endif
    free (g);
}
Exemplo n.º 3
0
static void free_printdict_t(printdict_t * dict)
{
    dtclose(dict->nodesleft);
    dtclose(dict->n_insubg);
    dtclose(dict->edgesleft);
    dtclose(dict->e_insubg);
    dtclose(dict->subgleft);
    free(dict);
}
Exemplo n.º 4
0
void freeMaze (maze* mp)
{
    free (mp->cells[0].sides);
    free (mp->gcells[0].sides);
    free (mp->cells);
    free (mp->gcells);
    freeSGraph (mp->sg);
    dtclose (mp->hchans);
    dtclose (mp->vchans);
    free (mp);
}
Exemplo n.º 5
0
/* delGrid:
 * Close and free all grid resources.
 */
void delGrid(Grid * g)
{
    dtclose(g->data);
    freeBlock(g->cellMem);
    free(g->listMem);
    free(g);
}
Exemplo n.º 6
0
/* processClusterEdges:
 * Look for cluster edges. Replace cluster edge endpoints
 * corresponding to a cluster with special cluster nodes.
 * Delete original nodes.
 * Return 0 if no cluster edges; 1 otherwise.
 */
int processClusterEdges(graph_t * g)
{
    int rv;
    node_t *n;
    edge_t *e;
    graph_t *clg;
    agxbuf xb;
    Dt_t *map;
    unsigned char buf[SMALLBUF];

    map = dtopen(&mapDisc, Dtoset);
    clg = agsubg(g, "__clusternodes");
    agxbinit(&xb, SMALLBUF, buf);
    for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
	for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
	    checkCompound(e, clg, &xb, map);
	}
    }
    agxbfree(&xb);
    dtclose(map);
    rv = agnnodes(clg);
    for (n = agfstnode(clg); n; n = agnxtnode(clg, n)) {
	agdelete(g, n);
    }
    agclose(clg);
    if (rv)
	SET_CLUST_EDGE(g);
    return rv;
}
Exemplo n.º 7
0
/* constrainX:
 * Create the X constrains and solve. We use a linear objective function
 * (absolute values rather than squares), so we can reuse network simplex.
 * The constraints are encoded as a dag with edges having a minimum length.
 */
static void constrainX(graph_t* g, nitem* nlist, int nnodes, intersectfn ifn,
                       int ortho)
{
    Dt_t *list = dtopen(&constr, Dtobag);
    nitem *p = nlist;
    graph_t *cg;
    int i;

    for (i = 0; i < nnodes; i++) {
	p->val = p->pos.x;
	dtinsert(list, p);
	p++;
    }
    if (ortho)
	cg = mkConstraintG(g, list, ifn, distX);
    else
	cg = mkNConstraintG(g, list, ifn, distX);
    rank(cg, 2, INT_MAX);

    p = nlist;
    for (i = 0; i < nnodes; i++) {
	int newpos, oldpos, delta;
	oldpos = p->pos.x;
	newpos = ND_rank(p->cnode);
	delta = newpos - oldpos;
	p->pos.x = newpos;
	p->bb.LL.x += delta;
	p->bb.UR.x += delta;
	p++;
    }

    closeGraph(cg);
    dtclose(list);
}
Exemplo n.º 8
0
static void gd_end_graph_to_file(void)
{
/*
 * Windows will do \n -> \r\n  translations on stdout unless told otherwise.
 */
#ifdef HAVE_SETMODE
#ifdef O_BINARY
	setmode(fileno(Output_file), O_BINARY);
#endif
#endif

/*
 * Write IM to OUTFILE as a JFIF-formatted JPEG image, using quality
 * JPEG_QUALITY.  If JPEG_QUALITY is in the range 0-100, increasing values
 * represent higher quality but also larger image size.  If JPEG_QUALITY is
 * negative, the IJG JPEG library's default quality is used (which
 * should be near optimal for many applications).  See the IJG JPEG
 * library documentation for more details.  */

#define JPEG_QUALITY -1

	if (Output_lang == GD) {
		gdImageGd(im, Output_file);
#ifdef HAVE_LIBZ
	} else if (Output_lang == GD2) {
#define GD2_CHUNKSIZE 128
#define GD2_RAW 1
#define GD2_COMPRESSED 2
		gdImageGd2(im, Output_file, GD2_CHUNKSIZE, GD2_COMPRESSED);
#endif
#ifdef WITH_GIF
	} else if (Output_lang == GIF) {
		gdImageGif(im, Output_file);
#endif
#ifdef HAVE_LIBPNG
#ifdef HAVE_LIBZ
	} else if (Output_lang == PNG) {
		gdImagePng(im, Output_file);
#endif
#endif
#ifdef HAVE_LIBJPEG
	} else if (Output_lang == JPEG) {
		gdImageJpeg(im, Output_file, JPEG_QUALITY);
#endif
	} else if (Output_lang == WBMP) {
        	/* Use black for the foreground color for the B&W wbmp image. */
		gdImageWBMP(im, black, Output_file);
#ifdef HAVE_LIBXPM
	} else if (Output_lang == XBM) {
		gdImageXbm(im, Output_file);
#endif
	}
	if (ImageDict) {
		dtclose(ImageDict); ImageDict = 0;
	}
	gdImageDestroy(im);
#ifdef MYTRACE
fprintf(stderr,"gd_end_graph_to_file\n");
#endif
}
Exemplo n.º 9
0
void freeRouter(router_t * rtr)
{
    free(rtr->ps);
    free(rtr->obs);
    free(rtr->tris);
    dtclose(rtr->trimap);
    freeTriGraph(rtr->tg);
    free(rtr);
}
Exemplo n.º 10
0
int
ptclose(Pt_t* a)
{
	if (!a)
		return -1;
	dtclose(a->dict);
	free(a);
	return 0;
}
Exemplo n.º 11
0
static int
initialize(void)
{
	register int		i;
	register Ucs_map_t*	a;
	register Ucs_map_t*	w;

	if (local.fatal)
		return -1;
	local.dtdisc.link = offsetof(Ucs_map_t, link);
	local.dtdisc.key = offsetof(Ucs_map_t, name);
	local.dtdisc.size = -1;
	if (!(w = (Ucs_map_t*)malloc(sizeof(Ucs_map_t) * (elementsof(ucs_attrs) + elementsof(ucs_names)))))
	{
		local.fatal = 1;
		return -1;
	}
	if (!(local.attrs = dtopen(&local.dtdisc, Dttree)))
	{
		free(w);
		local.fatal = 1;
		return -1;
	}
	if (!(local.names = dtopen(&local.dtdisc, Dttree)))
	{
		free(w);
		dtclose(local.attrs);
		local.fatal = 1;
		return -1;
	}
	for (i = 0; i < elementsof(ucs_attrs); i++, w++)
	{
		memcpy(w, &ucs_attrs[i], offsetof(Ucs_dat_t, table));
		w->name = ucs_strings[ucs_attrs[i].table] + ucs_attrs[i].index;
		w->next = 0;
		dtinsert(local.attrs, w);
	}
	for (i = 0; i < elementsof(ucs_names); i++, w++)
	{
		memcpy(w, &ucs_names[i], offsetof(Ucs_dat_t, table));
		w->name = ucs_strings[ucs_names[i].table] + ucs_names[i].index;
		w->next = 0;
		if (a = (Ucs_map_t*)dtsearch(local.names, w))
		{
			while (a->next)
				a = a->next;
			a->next = w;
		}
		else
			dtinsert(local.names, w);
	}
#if CC_NATIVE != CC_ASCII
	local.a2n = ccmap(CC_ASCII, CC_NATIVE);
#endif
	return 0;
}
Exemplo n.º 12
0
/* processTbl:
 * Convert parser representation of cells into final form.
 * Find column and row positions of cells.
 * Recursively size cells.
 * Return 1 if problem sizing a cell.
 */
static int processTbl(graph_t *g, htmltbl_t * tbl, htmlenv_t * env)
{
    pitem *rp;
    pitem *cp;
    Dt_t *cdict;
    int r, c, cnt;
    htmlcell_t *cellp;
    htmlcell_t **cells;
    Dt_t *rows = tbl->u.p.rows;
    int rv = 0;
    int n_rows = 0;
    int n_cols = 0;
    PointSet *ps = newPS();

    rp = (pitem *) dtflatten(rows);
    cnt = 0;
    while (rp) {
	cdict = rp->u.rp;
	cp = (pitem *) dtflatten(cdict);
	while (cp) {
	    cellp = cp->u.cp;
	    cnt++;
	    cp = (pitem *) dtlink(cdict, (Dtlink_t *) cp);
	}
	rp = (pitem *) dtlink(rows, (Dtlink_t *) rp);
    }

    cells = tbl->u.n.cells = N_NEW(cnt + 1, htmlcell_t *);
    rp = (pitem *) dtflatten(rows);
    r = 0;
    while (rp) {
	cdict = rp->u.rp;
	cp = (pitem *) dtflatten(cdict);
	c = 0;
	while (cp) {
	    cellp = cp->u.cp;
	    *cells++ = cellp;
	    rv |= size_html_cell(g, cellp, tbl, env);
	    c = findCol(ps, r, c, cellp);
	    cellp->row = r;
	    cellp->col = c;
	    c += cellp->cspan;
	    n_cols = MAX(c, n_cols);
	    n_rows = MAX(r + cellp->rspan, n_rows);
	    cp = (pitem *) dtlink(cdict, (Dtlink_t *) cp);
	}
	rp = (pitem *) dtlink(rows, (Dtlink_t *) rp);
	r++;
    }
    tbl->rc = n_rows;
    tbl->cc = n_cols;
    dtclose(rows);
    freePS(ps);
    return rv;
}
Exemplo n.º 13
0
static void write_graph(Agraph_t * g, GVJ_t * job, int top, state_t* sp)
{
    Agnode_t* np; 
    Agedge_t* ep; 
    int ncnt = 0;
    int ecnt = 0;
    int sgcnt = 0;
    int has_subgs;
    Dt_t* map;

    if (top) {
	map = dtopen (&intDisc, Dtoset);
	aginit(g, AGNODE, ID, sizeof(gvid_t), FALSE);
	aginit(g, AGEDGE, ID, sizeof(gvid_t), FALSE);
	aginit(g, AGRAPH, ID, -((int)sizeof(gvid_t)), FALSE);
	sgcnt = label_subgs(g, sgcnt, map);
	for (np = agfstnode(g); np; np = agnxtnode(g,np)) {
	    if (IS_CLUSTER(np)) {
		ND_gid(np) = lookup(map, agnameof(np));
	    }
	    else {
		ND_gid(np) = sgcnt + ncnt++;
	    }
	    for (ep = agfstout(g, np); ep; ep = agnxtout(g,ep)) {
		ED_gid(ep) = ecnt++;
	    }
	}
	dtclose(map);
    }

    indent(job, sp->Level++);
    gvputs(job, "{\n");
    write_hdr(g, job, top, sp);
    write_attrs((Agobj_t*)g, job, sp);
    if (top) {
	gvputs(job, ",\n");
	indent(job, sp->Level);
	gvprintf(job, "\"_subgraph_cnt\": %d", sgcnt);
    } else {
	gvputs(job, ",\n");
	indent(job, sp->Level);
	gvprintf(job, "\"_gvid\": %d", GD_gid(g));
    }
    has_subgs = write_subgs(g, job, top, sp);
    write_nodes (g, job, top, has_subgs, sp);
    write_edges (g, job, top, sp);
    gvputs(job, "\n");
    sp->Level--;
    indent(job, sp->Level);
    if (top)
	gvputs(job, "}\n");
    else
	gvputs(job, "}");
}
Exemplo n.º 14
0
tmain()
{
	Dt_t*	dt;
	Obj_t	*o, proto;
	long	i, k, count, n;

	for(i = 0; i < N_OBJ; i = k)
	{	for(k = i; k < i+R_OBJ && k < N_OBJ; ++k)
		{	Obj[k].key = i;
			Obj[k].ord = k;
		}
	}

	for(k = 0; k < 2; ++k)
	{	if(!(dt = dtopen(&Disc, k == 0 ? Dtrhbag : Dtobag)) )
			terror("Opening dictionary");
		dtcustomize(dt, DT_SHARE, 1); /* turn on sharing */

		for(i = 0; i < N_OBJ; ++i)
		{	if(dtinsert(dt, Obj+i) != Obj+i)
				terror("Insert %d,%d", Obj[i].key, Obj[i].ord);

			if(i > 0 && (i%N_CHK) == 0)
				if((count = dtsize(dt)) != i+1)
					terror("Bad size %d (need %d)", count, i+1);
		}

		count = n = 0; /* count the group of elements with key == 0 */
		for(o = (Obj_t*)dtflatten(dt); o; o = (Obj_t*)dtlink(dt,o), count += 1)
			if(o->key == 0)
				n += 1;
		if(count != N_OBJ || n != R_OBJ)
			terror("flatten %s: count=%d(need=%d) n=%d(need=%d)",
				k == 0 ? "bag" : "obag", count, N_OBJ, n, R_OBJ);

		/* delete a bunch of objects */
		for(n = 0, i = 0; i < N_OBJ; i += R_OBJ, n += 1)
			if(!dtdelete(dt, Obj+i))
				terror("delete %s: i=%d",
					k == 0 ? "bag" : "obag", i);

		count = 0; /* count the left over */
		for(o = (Obj_t*)dtflatten(dt); o; o = (Obj_t*)dtlink(dt,o))
			count += 1;
		if(count != N_OBJ-n)
			terror("%s wrong count %d",
				k == 0 ? "bag" : "obag", count);

		dtclose(dt);
	}

	texit(0);
}
Exemplo n.º 15
0
void freePM(PointMap * ps)
{
    MPairDisc *dp = (MPairDisc *) (ps->disc);
    mpair *p;
    mpair *next;

    dtclose(ps);
    for (p = dp->flist; p; p = next) {
	next = (mpair *) (p->link.right);
	free(p);
    }
    free(dp);
}
Exemplo n.º 16
0
/* constrainY:
 * See constrainX.
 */
static void constrainY(graph_t* g, nitem* nlist, int nnodes, intersectfn ifn,
                       int ortho)
{
    Dt_t *list = dtopen(&constr, Dtobag);
    nitem *p = nlist;
    graph_t *cg;
    int i;

    for (i = 0; i < nnodes; i++) {
	p->val = p->pos.y;
	dtinsert(list, p);
	p++;
    }
    if (ortho)
	cg = mkConstraintG(g, list, ifn, distY);
    else
	cg = mkNConstraintG(g, list, ifn, distY);
    rank(cg, 2, INT_MAX);
#ifdef DEBUG
    {
	Agsym_t *mlsym = agedgeattr(cg, "minlen", "");
	Agsym_t *rksym = agnodeattr(cg, "rank", "");
	char buf[100];
	node_t *n;
	edge_t *e;
	for (n = agfstnode(cg); n; n = agnxtnode(cg, n)) {
	    sprintf(buf, "%d", ND_rank(n));
	    agxset(n, rksym->index, buf);
	    for (e = agfstedge(cg, n); e; e = agnxtedge(cg, e, n)) {
		sprintf(buf, "%d", ED_minlen(e));
		agxset(e, mlsym->index, buf);
	    }
	}
    }
#endif

    p = nlist;
    for (i = 0; i < nnodes; i++) {
	int newpos, oldpos, delta;
	oldpos = p->pos.y;
	newpos = ND_rank(p->cnode);
	delta = newpos - oldpos;
	p->pos.y = newpos;
	p->bb.LL.y += delta;
	p->bb.UR.y += delta;
	p++;
    }

    closeGraph(cg);
    dtclose(list);
}
Exemplo n.º 17
0
void agFREEdict(Agraph_t * g, Agdict_t * dict)
{
    int i;
    Agsym_t *a;

    g = g;
    dtclose(dict->dict);
    if (dict->list) {
	i = 0;
	while ((a = dict->list[i++]))
	    agfreesym(a);
	free(dict->list);
    }
    free(dict);
}
Exemplo n.º 18
0
/* cloneGraph:
 * Clone node, edge and subgraph structure from src to tgt.
 */
static void cloneGraph(Agraph_t * tgt, Agraph_t * src)
{
    Agedge_t *e;
    Agedge_t *ne;
    Agnode_t *t;
    Agraph_t *sg;
    char* name;
    Dt_t* emap = dtopen (&edgepair, Dtoset);
    edgepair_t* data = (edgepair_t*)malloc(sizeof(edgepair_t)*agnedges(src));
    edgepair_t* ep = data;

    for (t = agfstnode(src); t; t = agnxtnode(src, t)) {
	if (!copy(tgt, OBJ(t))) {
	    exerror("error cloning node %s from graph %s",
		  agnameof(t), agnameof(src));
	}
    }
    for (t = agfstnode(src); t; t = agnxtnode(src, t)) {
	for (e = agfstout(src, t); e; e = agnxtout(src, e)) {
	    if (!(ne = (Agedge_t*)copy(tgt, OBJ(e)))) {
		name = agnameof(AGMKOUT(e));
		if (name)
		    exerror("error cloning edge (%s,%s)[%s] from graph %s",
		      agnameof(agtail(e)), agnameof(aghead(e)),
		      name, agnameof(src));
		else
		    exerror("error cloning edge (%s,%s) from graph %s",
		      agnameof(agtail(e)), agnameof(aghead(e)),
		      agnameof(src));
		return;
	    }
	    ep->key = e;
	    ep->val = ne;
	    dtinsert (emap, ep++);
	}
    }
    for (sg = agfstsubg(src); sg; sg = agnxtsubg(sg)) {
	if (!cloneSubg(tgt, sg, emap)) {
	    exerror("error cloning subgraph %s from graph %s",
		  agnameof(sg), agnameof(src));
	}
    }

    dtclose (emap);
    free (data);
}
Exemplo n.º 19
0
/* mkMCGraph:
 * Clone original graph. We only need the nodes, edges and clusters.
 * Copy
 */
Agraph_t* 
mkMCGraph (Agraph_t* g)
{
    Agnode_t* t;
    Agnode_t* newt;
    Agnode_t* newh;
    Agedge_t* e;
    Agedge_t* newe;
    Agraph_t* sg;
    edgepair_t* data;
    edgepair_t* ep;
    Agraph_t* newg = agopen (agnameof(g), g->desc, 0);
    Dt_t* emap = dtopen (&edgepair, Dtoset);;
    data = N_NEW(agnedges(g), edgepair_t);
    ep = data;

    for (t = agfstnode(g); t; t = agnxtnode(g, t)) {
	newt = mkMCNode (newg, STDNODE, agnameof(t));
	assert(newt);
        MND_orig(newt) = t;
        MND_rank(newt) = ND_rank(t);
    }

    for (t = agfstnode(g); t; t = agnxtnode(g, t)) {
        newt = agnode (newg, agnameof(t), 0);
	for (e = agfstout(g, t); e; e = agnxtout(g, e)) {
	    newh = agnode (newg, agnameof(aghead(e)), 0);
	    assert(newh);
            newe = mkMCEdge (newg, newt, newh, agnameof (e), NORMAL, e); 
	    assert(newe);
	    ep->key = e;
	    ep->val = newe;
	    dtinsert (emap, ep++);
	}
    }

    for (sg = agfstsubg(g); sg; sg = agnxtsubg(sg)) {
	cloneSubg(newg, sg, emap);
    }

    dtclose (emap);
    free (data);

    return newg;
}
Exemplo n.º 20
0
/* dot_compoundEdges:
 */
void dot_compoundEdges(graph_t * g)
{
    edge_t *e;
    node_t *n;
#ifdef WITH_CGRAPH
    Dt_t* clustMap = mkClustMap (g);
#endif
    for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
	for (e = agfstout(g, n); e; e = agnxtout(g, e)) {
#ifdef WITH_CGRAPH
	    makeCompoundEdge(g, e, clustMap);
#else
	    makeCompoundEdge(g, e);
#endif
	}
    }
#ifdef WITH_CGRAPH
    dtclose(clustMap);
#endif
}
Exemplo n.º 21
0
/* free_html_tbl:
 * If tbl->n_rows is negative, table is in initial state from
 * HTML parse, with data stored in u.p. Once run through processTable,
 * data is stored in u.n and tbl->n_rows is > 0.
 */
static void free_html_tbl(htmltbl_t * tbl)
{
    htmlcell_t **cells;

    if (tbl->rc == -1) {
	dtclose(tbl->u.p.rows);
    } else {
	cells = tbl->u.n.cells;

	free(tbl->heights);
	free(tbl->widths);
	while (*cells) {
	    free_html_cell(*cells);
	    cells++;
	}
	free(tbl->u.n.cells);
    }
    if (tbl->font)
	free_html_font(tbl->font);
    free_html_data(&tbl->data);
    free(tbl);
}
Exemplo n.º 22
0
tmain()
{
	Dt_t		*dt;
	long		k;

	chkevent(-1);
	if(!(dt = dtopen(&Disc,Dtset)) )
		terror("Opening Dtset");
	if(chkevent(DT_OPEN) != 1 )
		terror("Bad count of DT_OPEN event");
	if(chkevent(DT_ENDOPEN) != 1 )
		terror("Bad count of DT_ENDOPEN event");

	dtinsert(dt, 1);
	if(chkevent(DT_HASHSIZE) != 1 )
		terror("No hash table size event");

	chkevent(-1);
	dtmethod(dt,Dtoset);
	if(chkevent(DT_METH) < 1 )
		terror("No meth event");
	
	chkevent(-1);
	dtdisc(dt,&Disc,0);
	if(chkevent(DT_DISC) < 1 )
		terror("No disc event");

	chkevent(-1);
	dtclose(dt);
	if(chkevent(DT_CLOSE) != 1 )
		terror("Bad count of DT_CLOSE event");
	if(chkevent(DT_ENDCLOSE) != 1 )
		terror("Bad count of DT_ENDCLOSE event");

	texit(0);
}
Exemplo n.º 23
0
static Catalog_t*
init(register char* s)
{
	register Catalog_t*	cp;
	register char*		u;
	register int		n;
	register int		m;
	nl_catd			d;

	/*
	 * insert into the catalog dictionary
	 */

	if (!(cp = newof(0, Catalog_t, 1, strlen(s))))
		return 0;
	strcpy(cp->name, s);
	if (!dtinsert(state.catalogs, cp))
	{
		free(cp);
		return 0;
	}
	cp->cat = NOCAT;

	/*
	 * locate the default locale catalog
	 */

	ast.locale.set |= AST_LC_internal;
	u = setlocale(LC_MESSAGES, NiL);
	setlocale(LC_MESSAGES, "C");
	if ((d = find("C", s)) != NOCAT)
	{
		/*
		 * load the default locale messages
		 * this assumes one mesage set for ast (AST_MESSAGE_SET)
		 * different packages can share the same message catalog
		 * name by using different message set numbers
		 * see <mc.h> mcindex()
		 *
		 * this method requires a scan of each catalog, and the
		 * catalogs do not advertize the max message number, so
		 * we assume there are no messages after a gap of GAP
		 * missing messages
		 */

		if (cp->messages = dtopen(&state.message_disc, Dtset))
		{
			n = m = 0;
			for (;;)
			{
				n++;
				if ((s = catgets(d, AST_MESSAGE_SET, n, state.null)) != state.null && entry(cp->messages, AST_MESSAGE_SET, n, s))
					m = n;
				else if ((n - m) > GAP)
					break;
			}
			if (!m)
			{
				dtclose(cp->messages);
				cp->messages = 0;
			}
		}
		catclose(d);
	}
	setlocale(LC_MESSAGES, u);
	ast.locale.set &= ~AST_LC_internal;
	return cp;
}
Exemplo n.º 24
0
static void
write_subg(Agraph_t * g, FILE * fp, Agraph_t * par, int indent,
	   printdict_t * state)
{
    Agraph_t *subg, *meta;
    Agnode_t *n, *pn;
    Agedge_t *e, *pe;
    Dict_t *save_e, *save_n;

    if (indent) {
	tabover(fp, indent++);
	if (dtsearch(state->subgleft, g->meta_node)) {
	    if (strncmp(g->name, "_anonymous", 10))
		fprintf(fp, "subgraph %s {\n", agcanonical(g->name));
	    else
		fprintf(fp, "{\n");	/* no name printed for anonymous subg */
	    write_diffattr(fp, indent, g, par, g->univ->globattr);
	    /* The root node and edge environment use the dictionaries,
	     * not the proto node or edge, so the next level down must
	     * record differences with the dictionaries.
	     */
	    if (par == g->root) {
		pn = NULL;
		pe = NULL;
	    } else {
		pn = par->proto->n;
		pe = par->proto->e;
	    }
	    write_diffattr(fp, indent, g->proto->n, pn, g->univ->nodeattr);
	    write_diffattr(fp, indent, g->proto->e, pe, g->univ->edgeattr);
	    dtdelete(state->subgleft, g->meta_node);
	} else {
	    fprintf(fp, "subgraph %s;\n", agcanonical(g->name));
	    return;
	}
    } else
	write_diffattr(fp, ++indent, g, NULL, g->univ->globattr);

    save_n = state->n_insubg;
    save_e = state->e_insubg;
    meta = g->meta_node->graph;
    state->n_insubg = dtopen(&agNamedisc, Dttree);
    state->e_insubg = dtopen(&agOutdisc, Dttree);
    for (e = agfstout(meta, g->meta_node); e; e = agnxtout(meta, e)) {
	subg = agusergraph(e->head);
	write_subg(subg, fp, g, indent, state);
    }
    for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
	if (dtsearch(state->nodesleft, n)) {
	    agwrnode(g, fp, n, TRUE, indent);
	    dtdelete(state->nodesleft, n);
	} else {
	    if (dtsearch(state->n_insubg, n) == NULL) {
		agwrnode(g, fp, n, FALSE, indent);
	    }
	}
	dtinsert(save_n, n);
    }

    dtdisc(g->outedges, &agEdgedisc, 0);	/* sort by id */
    for (e = (Agedge_t *) dtfirst(g->outedges); e;
	 e = (Agedge_t *) dtnext(g->outedges, e)) {
	if (dtsearch(state->edgesleft, e)) {
	    tabover(fp, indent);
	    agwredge(g, fp, e, TRUE);
	    dtdelete(state->edgesleft, e);
	} else {
	    if (dtsearch(state->e_insubg, e) == NULL) {
		tabover(fp, indent);
		agwredge(g, fp, e, FALSE);
	    }
	}
	dtinsert(save_e, e);
    }
    dtdisc(g->outedges, &agOutdisc, 0);	/* sort by name */
    dtclose(state->n_insubg);
    state->n_insubg = save_n;
    dtclose(state->e_insubg);
    state->e_insubg = save_e;

    if (indent > 1) {
	tabover(fp, indent - 1);
	fprintf(fp, "}\n");
    }
}
Exemplo n.º 25
0
void free_edgelist(edgelist * list)
{
    dtclose(list);
}
Exemplo n.º 26
0
static void
freeChanItem (Dt_t* d, chanItem* cp, Dtdisc_t* disc)
{
    dtclose (cp->chans);
    free (cp);
}
Exemplo n.º 27
0
void freePS(PointSet * ps)
{
    dtclose(ps);
}
Exemplo n.º 28
0
/* freeDeglist:
 * Delete the node list.
 * Nodes are not deleted.
 */
void freeDeglist(deglist_t * s)
{
    dtclose(s);
}
Exemplo n.º 29
0
/* freeNodeset:
 * Deletes a node set, deleting all items as well.
 * It does not delete the nodes.
 */
void freeNodeset(nodeset_t * s)
{
    if (s != NULL)
	dtclose(s);
}
Exemplo n.º 30
0
void textfont_dict_close(GVC_t *gvc)
{
    dtclose(gvc->textfont_dt);
}