~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to agraph/flatten.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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.
 
9
*/
 
10
#pragma prototyped
 
11
 
 
12
#include <aghdr.h>
 
13
 
 
14
#ifdef DMALLOC
 
15
#include "dmalloc.h"
 
16
#endif
 
17
 
 
18
void agflatten_elist(Dict_t *d, Dtlink_t **lptr)
 
19
{
 
20
        dtrestore(d,*lptr);
 
21
        (void) dtflatten(d);
 
22
        *lptr = dtextract(d);
 
23
}
 
24
 
 
25
void agflatten_edges(Agraph_t *g, Agnode_t *n)
 
26
{
 
27
        agflatten_elist(g->e_seq,(Dtlink_t**)&(n->out));
 
28
        agflatten_elist(g->e_seq,(Dtlink_t**)&(n->in));
 
29
}
 
30
 
 
31
void agflatten(Agraph_t *g, int flag)
 
32
{
 
33
        Agnode_t        *n;
 
34
 
 
35
        if (flag) {
 
36
                if (g->desc.flatlock == FALSE) {
 
37
                        dtflatten(g->n_seq);
 
38
                        g->desc.flatlock = TRUE;
 
39
                        for (n = agfstnode(g); n; n = agnxtnode(n))
 
40
                                agflatten_edges(g,n);
 
41
                }
 
42
        }
 
43
        else {
 
44
                if (g->desc.flatlock) {
 
45
                        g->desc.flatlock = FALSE;
 
46
                }
 
47
        }
 
48
}
 
49
 
 
50
void agnotflat(Agraph_t *g)
 
51
{
 
52
        if(g->desc.flatlock) agerror(AGERROR_FLAT,"");
 
53
}