1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
/* { dg-do compile } */
/* { dg-options "-O3" } */
typedef long unsigned int size_t;
typedef struct
{
}
box;
typedef struct
{
}
textpara_t;
typedef struct _dtlink_s Dtlink_t;
typedef struct _dtdisc_s Dtdisc_t;
typedef struct _dtmethod_s Dtmethod_t;
typedef struct _dt_s Dt_t;
typedef void *(*Dtmemory_f) (Dt_t *, void *, size_t, Dtdisc_t *);
typedef void *(*Dtsearch_f) (Dt_t *, void *, int);
typedef void *(*Dtmake_f) (Dt_t *, void *, Dtdisc_t *);
typedef void (*Dtfree_f) (Dt_t *, void *, Dtdisc_t *);
typedef int (*Dtcompar_f) (Dt_t *, void *, void *, Dtdisc_t *);
typedef unsigned int (*Dthash_f) (Dt_t *, void *, Dtdisc_t *);
typedef int (*Dtevent_f) (Dt_t *, int, void *, Dtdisc_t *);
struct _dtlink_s
{
Dtlink_t *right;
};
struct _dtdisc_s
{
int key;
int size;
int link;
Dtmake_f makef;
Dtfree_f freef;
Dtcompar_f comparf;
Dthash_f hashf;
Dtmemory_f memoryf;
Dtevent_f eventf;
};
struct _dt_s
{
Dtsearch_f searchf;
};
extern Dtmethod_t *Dtobag;
extern Dt_t *dtopen (Dtdisc_t *, Dtmethod_t *);
extern Dtlink_t *dtflatten (Dt_t *);
typedef struct Agobj_s Agobj_t;
typedef struct Agraph_s Agraph_t;
typedef struct Agnode_s Agnode_t;
typedef struct Agedge_s Agedge_t;
typedef struct Agdesc_s Agdesc_t;
typedef struct Agdisc_s Agdisc_t;
typedef struct Agrec_s Agrec_t;
struct Agobj_s
{
Agrec_t *data;
};
struct Agdesc_s
{
};
extern Agraph_t *agopen (char *name, Agdesc_t desc, Agdisc_t * disc);
extern Agnode_t *agfstnode (Agraph_t * g);
extern Agnode_t *agnxtnode (Agraph_t * g, Agnode_t * n);
extern Agedge_t *agedge (Agraph_t * g, Agnode_t * t, Agnode_t * h, char *name,
int createflag);
extern Agedge_t *agfstout (Agraph_t * g, Agnode_t * n);
extern Agedge_t *agnxtout (Agraph_t * g, Agedge_t * e);
extern Agdesc_t Agdirected, Agstrictdirected, Agundirected,
Agstrictundirected;
typedef struct Agraph_s graph_t;
typedef struct Agnode_s node_t;
typedef struct Agedge_s edge_t;
typedef union inside_t
{
unsigned short minlen;
}
Agedgeinfo_t;
extern void *gmalloc (size_t);
typedef enum
{ AM_NONE, AM_VOR, AM_SCALE, AM_NSCALE, AM_SCALEXY, AM_PUSH, AM_PUSHPULL,
AM_ORTHO, AM_ORTHO_YX, AM_ORTHOXY, AM_ORTHOYX, AM_PORTHO, AM_PORTHO_YX,
AM_PORTHOXY, AM_PORTHOYX, AM_COMPRESS, AM_VPSC, AM_IPSEP, AM_PRISM }
adjust_mode;
typedef struct nitem
{
Dtlink_t link;
int val;
node_t *cnode;
box bb;
}
nitem;
typedef int (*distfn) (box *, box *);
typedef int (*intersectfn) (nitem *, nitem *);
static int
cmpitem (Dt_t * d, int *p1, int *p2, Dtdisc_t * disc)
{
}
static Dtdisc_t constr =
{ __builtin_offsetof (nitem, val), sizeof (int), __builtin_offsetof (nitem,
link),
((Dtmake_f) 0), ((Dtfree_f) 0), (Dtcompar_f) cmpitem, ((Dthash_f) 0), ((Dtmemory_f) 0),
((Dtevent_f) 0) };
static int
distX (box * b1, box * b2)
{
}
static int
intersectY0 (nitem * p, nitem * q)
{
}
static int
intersectY (nitem * p, nitem * q)
{
}
static void
mapGraphs (graph_t * g, graph_t * cg, distfn dist)
{
node_t *n;
edge_t *e;
edge_t *ce;
node_t *t;
node_t *h;
nitem *tp;
nitem *hp;
int delta;
for (n = agfstnode (g); n; n = agnxtnode (g, n))
{
for (e = agfstout (g, n); e; e = agnxtout (g, e))
{
delta = dist (&tp->bb, &hp->bb);
ce = agedge (cg, t, h, ((void *) 0), 1);
if ((((Agedgeinfo_t *) (((Agobj_t *) (ce))->data))->minlen) < delta)
{
if ((((Agedgeinfo_t *) (((Agobj_t *) (ce))->data))->minlen) ==
0.0)
{
}
}
}
}
}
static graph_t *
mkNConstraintG (graph_t * g, Dt_t * list, intersectfn intersect, distfn dist)
{
nitem *p;
nitem *nxp;
edge_t *e;
graph_t *cg = agopen ("cg", Agstrictdirected, ((Agdisc_t *) 0));
for (p = (nitem *) dtflatten (list); p;
p = (nitem *) (((Dtlink_t *) ((Dtlink_t *) p))->right))
{
for (nxp = (nitem *) (((Dtlink_t *) ((Dtlink_t *) p))->right); nxp;
nxp = (nitem *) (((Dtlink_t *) ((Dtlink_t *) nxp))->right))
{
if (intersect (p, nxp))
{
e = agedge (cg, p->cnode, nxp->cnode, ((void *) 0), 1);
}
}} for (p = (nitem *) dtflatten (list); p;
p = (nitem *) (((Dtlink_t *) ((Dtlink_t *) p))->right))
{
}
}
static graph_t *
mkConstraintG (graph_t * g, Dt_t * list, intersectfn intersect, distfn dist)
{
graph_t *vg;
graph_t *cg = agopen ("cg", Agstrictdirected, ((Agdisc_t *) 0));
mapGraphs (vg, cg, dist);
}
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++)
{
(*(((Dt_t *) (list))->searchf)) ((list), (void *) (p), 0000001);
p++;
} if (ortho)
cg = mkConstraintG (g, list, ifn, distX);
else
cg = mkNConstraintG (g, list, ifn, distX);
}
int
cAdjust (graph_t * g, int mode)
{
int ret, i, nnodes = agnnodes (g);
nitem *nlist = (nitem *) gmalloc ((nnodes) * sizeof (nitem));
node_t *n;
for (n = agfstnode (g); n; n = agnxtnode (g, n))
{
}
if (overlaps (nlist, nnodes))
{
switch ((adjust_mode) mode)
{
case AM_ORTHOXY:
constrainX (g, nlist, nnodes, intersectY, 1);
case AM_ORTHO:
constrainX (g, nlist, nnodes, intersectY0, 1);
constrainX (g, nlist, nnodes, intersectY, 1);
case AM_PORTHO:
default:
constrainX (g, nlist, nnodes, intersectY0, 0);
}
}
}
|