Graphviz 14.0.3~dev.20251104.0241
Loading...
Searching...
No Matches
position.c
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11
12/*
13 * position(g): set ND_coord(n) (x and y) for all nodes n of g, using GD_rank(g).
14 * (the graph may be modified by merging certain edges with a common endpoint.)
15 * the coordinates are computed by constructing and ranking an auxiliary graph.
16 * then leaf nodes are inserted in the fast graph. cluster boundary nodes are
17 * created and correctly separated.
18 */
19
20#include <common/geomprocs.h>
21#include <dotgen/dot.h>
22#include <dotgen/aspect.h>
23#include <math.h>
24#include <stdbool.h>
25#include <stdlib.h>
26#include <util/alloc.h>
27#include <util/gv_math.h>
28
29static int nsiter2(graph_t * g);
30static void create_aux_edges(graph_t * g);
31static void remove_aux_edges(graph_t * g);
32static void set_xcoords(graph_t * g);
33static void set_ycoords(graph_t * g);
34static void set_aspect(graph_t *g);
35static void expand_leaves(graph_t * g);
36static void make_lrvn(graph_t * g);
37static void contain_nodes(graph_t * g);
38static bool idealsize(graph_t * g, double);
39
40#if defined(DEBUG) && DEBUG > 1
41static void
42dumpNS (graph_t * g)
43{
44 node_t* n = GD_nlist(g);
45 elist el;
46 edge_t* e;
47
48 while (n) {
49 el = ND_out(n);
50 for (size_t i = 0; i < el.size; i++) {
51 e = el.list[i];
52 fprintf (stderr, "%s(%x) -> ", agnameof(agtail(e)),agtail(e));
53 fprintf (stderr, "%s(%x) : %d\n", agnameof(aghead(e)), aghead(e),
54 ED_minlen(e));
55 }
56 n = ND_next(n);
57 }
58}
59#endif
60
61static double
62largeMinlen (double l)
63{
65 "Edge length %f larger than maximum %d allowed.\nCheck for overwide "
66 "node(s).\n",
67 l, INT_MAX);
68 return INT_MAX;
69}
70
71/* When source and/or sink nodes are defined, it is possible that
72 * after the auxiliary edges are added, the graph may still have 2 or
73 * 3 components. To fix this, we put trivial constraints connecting the
74 * first items of each rank.
75 */
76static void
78{
79 int i, j, r;
80 bool found;
81 node_t* tp;
82 node_t* hp;
83 node_t* sn;
84 edge_t* e;
85 rank_t* rp;
86
87 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
88 rp = GD_rank(g)+r;
89 found = false;
90 tp = NULL;
91 for (i = 0; i < rp->n; i++) {
92 tp = rp->v[i];
93 if (ND_save_out(tp).list) {
94 for (j = 0; (e = ND_save_out(tp).list[j]); j++) {
95 if (ND_rank(aghead(e)) > r || ND_rank(agtail(e)) > r) {
96 found = true;
97 break;
98 }
99 }
100 if (found) break;
101 }
102 if (ND_save_in(tp).list) {
103 for (j = 0; (e = ND_save_in(tp).list[j]); j++) {
104 if (ND_rank(agtail(e)) > r || ND_rank(aghead(e)) > r) {
105 found = true;
106 break;
107 }
108 }
109 if (found) break;
110 }
111 }
112 if (found || !tp) continue;
113 tp = rp->v[0];
114 if (r < GD_maxrank(g)) hp = (rp+1)->v[0];
115 else hp = (rp-1)->v[0];
116 assert (hp);
117 sn = virtual_node(g);
119 make_aux_edge(sn, tp, 0, 0);
120 make_aux_edge(sn, hp, 0, 0);
121 ND_rank(sn) = MIN(ND_rank(tp), ND_rank(hp));
122 }
123}
124
126 if (GD_nlist(g) == NULL)
127 return; /* ignore empty graph */
128 mark_lowclusters(g); /* we could remove from splines.c now */
129 set_ycoords(g);
130 if (Concentrate)
132 expand_leaves(g);
133 if (flat_edges(g))
134 set_ycoords(g);
136 if (rank(g, 2, nsiter2(g))) { /* LR balance == 2 */
137 connectGraph (g);
138 const int rank_result = rank(g, 2, nsiter2(g));
139 assert(rank_result == 0);
140 (void)rank_result;
141 }
142 set_xcoords(g);
143 set_aspect(g);
144 remove_aux_edges(g); /* must come after set_aspect since we now
145 * use GD_ln and GD_rn for bbox width.
146 */
147}
148
149static int nsiter2(graph_t * g)
150{
151 int maxiter = INT_MAX;
152 char *s;
153
154 if ((s = agget(g, "nslimit")))
155 maxiter = scale_clamp(agnnodes(g), atof(s));
156 return maxiter;
157}
158
159static bool go(node_t *u, node_t *v) {
160 int i;
161 edge_t *e;
162
163 if (u == v)
164 return true;
165 for (i = 0; (e = ND_out(u).list[i]); i++) {
166 if (go(aghead(e), v))
167 return true;
168 }
169 return false;
170}
171
172static bool canreach(node_t *u, node_t *v) {
173 return go(u, v);
174}
175
176edge_t *make_aux_edge(node_t * u, node_t * v, double len, int wt)
177{
178 Agedgepair_t* e2 = gv_alloc(sizeof(Agedgepair_t));
179 AGTYPE(&e2->in) = AGINEDGE;
180 AGTYPE(&e2->out) = AGOUTEDGE;
181 e2->out.base.data = gv_alloc(sizeof(Agedgeinfo_t));
182 edge_t *const e = &e2->out;
183
184 agtail(e) = u;
185 aghead(e) = v;
186 if (len > INT_MAX)
187 len = largeMinlen (len);
188 ED_minlen(e) = ROUND(len);
189 ED_weight(e) = wt;
190 fast_edge(e);
191 return e;
192}
193
195{
196 int i, j, n_in;
197 node_t *n;
198
199 /* allocate space for aux edge lists */
200 for (n = GD_nlist(g); n; n = ND_next(n)) {
201 ND_save_in(n) = ND_in(n);
202 ND_save_out(n) = ND_out(n);
203 for (i = 0; ND_out(n).list[i]; i++);
204 for (j = 0; ND_in(n).list[j]; j++);
205 n_in = i + j;
206 alloc_elist(n_in + 3, ND_in(n));
207 alloc_elist(3, ND_out(n));
208 }
209}
210
211static void
213{
214 int i, j;
215 int m0;
216 double width;
217 int sep[2];
218 int nodesep; /* separation between nodes on same rank */
219 edge_t *e, *e0, *e1;
220 node_t *u, *v, *t0, *h0;
221 rank_t *rank = GD_rank(g);
222
223 /* Use smaller separation on odd ranks if g has edge labels */
224 if (GD_has_labels(g->root) & EDGE_LABEL) {
225 sep[0] = GD_nodesep(g);
226 sep[1] = 5;
227 }
228 else {
229 sep[1] = sep[0] = GD_nodesep(g);
230 }
231 /* make edges to constrain left-to-right ordering */
232 for (i = GD_minrank(g); i <= GD_maxrank(g); i++) {
233 double last = ND_rank(rank[i].v[0]) = 0;
234 nodesep = sep[i & 1];
235 for (j = 0; j < rank[i].n; j++) {
236 u = rank[i].v[j];
237 ND_mval(u) = ND_rw(u); /* keep it somewhere safe */
238 if (ND_other(u).size > 0) { /* compute self size */
239 /* FIX: dot assumes all self-edges go to the right. This
240 * is no longer true, though makeSelfEdge still attempts to
241 * put as many as reasonable on the right. The dot code
242 * should be modified to allow a box reflecting the placement
243 * of all self-edges, and use that to reposition the nodes.
244 * Note that this would not only affect left and right
245 * positioning but may also affect interrank spacing.
246 */
247 double sw = 0; // self width
248 for (size_t k = 0; (e = ND_other(u).list[k]); k++) {
249 if (agtail(e) == aghead(e)) {
250 sw += selfRightSpace (e);
251 }
252 }
253 ND_rw(u) += sw; /* increment to include self edges */
254 }
255 v = rank[i].v[j + 1];
256 if (v) {
257 width = ND_rw(u) + ND_lw(v) + nodesep;
258 e0 = make_aux_edge(u, v, width, 0);
259 last = (ND_rank(v) = last + width);
260 }
261
262 /* constraints from labels of flat edges on previous rank */
263 if ((e = ND_alg(u))) {
264 e0 = ND_save_out(u).list[0];
265 e1 = ND_save_out(u).list[1];
266 if (ND_order(aghead(e0)) > ND_order(aghead(e1))) {
267 SWAP(&e0, &e1);
268 }
269 m0 = ED_minlen(e) * GD_nodesep(g) / 2;
270 double m1 = m0 + ND_rw(aghead(e0)) + ND_lw(agtail(e0));
271 /* these guards are needed because the flat edges
272 * work very poorly with cluster layout */
273 if (!canreach(agtail(e0), aghead(e0)))
274 make_aux_edge(aghead(e0), agtail(e0), m1,
275 ED_weight(e));
276 m1 = m0 + ND_rw(agtail(e1)) + ND_lw(aghead(e1));
277 if (!canreach(aghead(e1), agtail(e1)))
278 make_aux_edge(agtail(e1), aghead(e1), m1,
279 ED_weight(e));
280 }
281
282 /* position flat edge endpoints */
283 for (size_t k = 0; k < ND_flat_out(u).size; k++) {
284 e = ND_flat_out(u).list[k];
285 if (ND_order(agtail(e)) < ND_order(aghead(e))) {
286 t0 = agtail(e);
287 h0 = aghead(e);
288 } else {
289 t0 = aghead(e);
290 h0 = agtail(e);
291 }
292
293 width = ND_rw(t0) + ND_lw(h0);
294 m0 = ED_minlen(e) * GD_nodesep(g) + width;
295
296 if ((e0 = find_fast_edge(t0, h0))) {
297 /* flat edge between adjacent neighbors
298 * ED_dist contains the largest label width.
299 */
300 m0 = MAX(m0, width + GD_nodesep(g) + ROUND(ED_dist(e)));
301 ED_minlen(e0) = MAX(ED_minlen(e0), m0);
302 ED_weight(e0) = MAX(ED_weight(e0), ED_weight(e));
303 }
304 else if (!ED_label(e)) {
305 /* unlabeled flat edge between non-neighbors
306 * ED_minlen(e) is max of ED_minlen of all equivalent
307 * edges.
308 */
309 make_aux_edge(t0, h0, m0, ED_weight(e));
310 }
311 /* labeled flat edges between non-neighbors have already
312 * been constrained by the label above.
313 */
314 }
315 }
316 }
317}
318
320static void make_edge_pairs(graph_t * g)
321{
322 int i, m0, m1;
323 node_t *n, *sn;
324 edge_t *e;
325
326 for (n = GD_nlist(g); n; n = ND_next(n)) {
327 if (ND_save_out(n).list)
328 for (i = 0; (e = ND_save_out(n).list[i]); i++) {
329 sn = virtual_node(g);
331 m0 = (ED_head_port(e).p.x - ED_tail_port(e).p.x);
332 if (m0 > 0)
333 m1 = 0;
334 else {
335 m1 = -m0;
336 m0 = 0;
337 }
338 make_aux_edge(sn, agtail(e), m0 + 1, ED_weight(e));
339 make_aux_edge(sn, aghead(e), m1 + 1, ED_weight(e));
340 ND_rank(sn) =
341 MIN(ND_rank(agtail(e)) - m0 - 1,
342 ND_rank(aghead(e)) - m1 - 1);
343 }
344 }
345}
346
348{
349 int c;
350 edge_t *e;
351
352 if (g != dot_root(g)) {
353 contain_nodes(g);
354 if ((e = find_fast_edge(GD_ln(g),GD_rn(g)))) /* maybe from lrvn()?*/
355 ED_weight(e) += 128;
356 else
357 make_aux_edge(GD_ln(g), GD_rn(g), 1, 128); /* clust compaction edge */
358 }
359 for (c = 1; c <= GD_n_cluster(g); c++)
361}
362
364 edge_t *e;
365
366 if (ND_node_type(v) != VIRTUAL)
367 return false;
368 for (e = ND_save_out(v).list[0]; ED_to_orig(e); e = ED_to_orig(e));
369 if (agcontains(g, agtail(e)))
370 return false;
371 if (agcontains(g, aghead(e)))
372 return false;
373 return true;
374}
375
376/* Guarantee nodes outside the cluster g are placed outside of it.
377 * This is done by adding constraints to make sure such nodes have
378 * a gap of margin from the left or right bounding box node ln or rn.
379 *
380 * We could probably reduce some of these constraints by checking if
381 * the node is in a cluster, since elsewhere we make constrain a
382 * separate between clusters. Also, we should be able to skip the
383 * first loop if g is the root graph.
384 */
386{
387 int i, c, r, margin;
388 node_t *u, *v;
389
390 margin = late_int (g, G_margin, CL_OFFSET, 0);
391 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
392 if (GD_rank(g)[r].n == 0)
393 continue;
394 v = GD_rank(g)[r].v[0];
395 if (v == NULL)
396 continue;
397 for (i = ND_order(v) - 1; i >= 0; i--) {
398 u = GD_rank(dot_root(g))[r].v[i];
399 /* can't use "is_a_vnode_of" because elists are swapped */
400 if (ND_node_type(u) == NORMAL || vnode_not_related_to(g, u)) {
401 make_aux_edge(u, GD_ln(g), margin + ND_rw(u), 0);
402 break;
403 }
404 }
405 for (i = ND_order(v) + GD_rank(g)[r].n; i < GD_rank(dot_root(g))[r].n;
406 i++) {
407 u = GD_rank(dot_root(g))[r].v[i];
408 if (ND_node_type(u) == NORMAL || vnode_not_related_to(g, u)) {
409 make_aux_edge(GD_rn(g), u, margin + ND_lw(u), 0);
410 break;
411 }
412 }
413 }
414
415 for (c = 1; c <= GD_n_cluster(g); c++)
417}
418
419/* Make sure boxes of subclusters of g are offset from the
420 * box of g. This is done by a constraint between the left and
421 * right bounding box nodes ln and rn of g and a subcluster.
422 * The gap needs to include any left or right labels.
423 */
424static void contain_subclust(graph_t * g)
425{
426 int margin, c;
427 graph_t *subg;
428
429 margin = late_int (g, G_margin, CL_OFFSET, 0);
430 make_lrvn(g);
431 for (c = 1; c <= GD_n_cluster(g); c++) {
432 subg = GD_clust(g)[c];
433 make_lrvn(subg);
434 make_aux_edge(GD_ln(g), GD_ln(subg),
435 margin + GD_border(g)[LEFT_IX].x, 0);
436 make_aux_edge(GD_rn(subg), GD_rn(g),
437 margin + GD_border(g)[RIGHT_IX].x, 0);
438 contain_subclust(subg);
439 }
440}
441
442/* Guarantee space between subcluster of g.
443 * This is done by adding a constraint between the right bbox node rn
444 * of the left cluster and the left bbox node ln of the right cluster.
445 * This is only done if the two clusters overlap in some rank.
446 */
448{
449 int i, j, margin;
450 graph_t *low, *high;
451 graph_t *left, *right;
452
453 margin = late_int (g, G_margin, CL_OFFSET, 0);
454 for (i = 1; i <= GD_n_cluster(g); i++)
455 make_lrvn(GD_clust(g)[i]);
456 for (i = 1; i <= GD_n_cluster(g); i++) {
457 for (j = i + 1; j <= GD_n_cluster(g); j++) {
458 low = GD_clust(g)[i];
459 high = GD_clust(g)[j];
460 if (GD_minrank(low) > GD_minrank(high)) {
461 SWAP(&low, &high);
462 }
463 if (GD_maxrank(low) < GD_minrank(high))
464 continue;
465 if (ND_order(GD_rank(low)[GD_minrank(high)].v[0])
466 < ND_order(GD_rank(high)[GD_minrank(high)].v[0])) {
467 left = low;
468 right = high;
469 } else {
470 left = high;
471 right = low;
472 }
473 make_aux_edge(GD_rn(left), GD_ln(right), margin, 0);
474 }
476 }
477}
478
479/* create constraints for:
480 * node containment in clusters,
481 * cluster containment in clusters,
482 * separation of sibling clusters.
483 */
484static void pos_clusters(graph_t * g)
485{
486 if (GD_n_cluster(g) > 0) {
491 }
492}
493
494static void compress_graph(graph_t * g)
495{
496 double x;
497 pointf p;
498
499 if (GD_drawing(g)->ratio_kind != R_COMPRESS)
500 return;
501 p = GD_drawing(g)->size;
502 if (p.x * p.y <= 1)
503 return;
504 contain_nodes(g);
505 if (!GD_flip(g))
506 x = p.x;
507 else
508 x = p.y;
509
510 /* Guard against huge size attribute since max. edge length is USHRT_MAX
511 * A warning might be called for. Also, one could check that the graph
512 * already fits GD_drawing(g)->size and return immediately.
513 */
514 x = MIN(x,USHRT_MAX);
515 make_aux_edge(GD_ln(g), GD_rn(g), x, 1000);
516}
517
518static void create_aux_edges(graph_t * g)
519{
523 pos_clusters(g);
525}
526
527static void remove_aux_edges(graph_t * g)
528{
529 int i;
530 node_t *n, *nnext, *nprev;
531 edge_t *e;
532
533 for (n = GD_nlist(g); n; n = ND_next(n)) {
534 for (i = 0; (e = ND_out(n).list[i]); i++) {
535 free(e->base.data);
536 free(e);
537 }
538 free_list(ND_out(n));
539 free_list(ND_in(n));
540 ND_out(n) = ND_save_out(n);
541 ND_in(n) = ND_save_in(n);
542 }
543 /* cannot be merged with previous loop */
544 nprev = NULL;
545 for (n = GD_nlist(g); n; n = nnext) {
546 nnext = ND_next(n);
547 if (ND_node_type(n) == SLACKNODE) {
548 if (nprev)
549 ND_next(nprev) = nnext;
550 else
551 GD_nlist(g) = nnext;
552 if (nnext != NULL) {
553 ND_prev(nnext) = nprev;
554 }
555 free(n->base.data);
556 free(n);
557 } else
558 nprev = n;
559 }
560}
561
563static void
565{
566 int i, j;
567 node_t *v;
568 rank_t *rank = GD_rank(g);
569
570 for (i = GD_minrank(g); i <= GD_maxrank(g); i++) {
571 for (j = 0; j < rank[i].n; j++) {
572 v = rank[i].v[j];
573 ND_coord(v).x = ND_rank(v);
574 ND_rank(v) = i;
575 }
576 }
577}
578
579/* Expand cluster height by delta, adding half to top
580 * and half to bottom. If the bottom expansion exceeds the
581 * ht1 of the rank, shift the ranks in the cluster up.
582 * If the top expansion, including any shift from the bottom
583 * expansion, exceeds to ht2 of the rank, shift the ranks above
584 * the cluster up.
585 *
586 * FIX: There can be excess space between ranks. Not sure where this is
587 * coming from but it could be cleaned up.
588 */
589static void adjustSimple(graph_t *g, double delta, int margin_total) {
590 int r;
591 double deltop;
592 graph_t *root = dot_root(g);
593 rank_t *rank = GD_rank(root);
594 int maxr = GD_maxrank(g);
595 int minr = GD_minrank(g);
596
597 const double bottom = (delta + 1) / 2;
598 const double delbottom = GD_ht1(g) + bottom - (rank[maxr].ht1 - margin_total);
599 if (delbottom > 0) {
600 for (r = maxr; r >= minr; r--) {
601 if (rank[r].n > 0)
602 ND_coord(rank[r].v[0]).y += delbottom;
603 }
604 deltop = GD_ht2(g) + (delta-bottom) + delbottom - (rank[minr].ht2 - margin_total);
605 }
606 else
607 deltop = GD_ht2(g) + (delta-bottom) - (rank[minr].ht2 - margin_total);
608 if (deltop > 0) {
609 for (r = minr-1; r >= GD_minrank(root); r--) {
610 if (rank[r].n > 0)
611 ND_coord(rank[r].v[0]).y += deltop;
612 }
613 }
614 GD_ht2(g) += delta - bottom;
615 GD_ht1(g) += bottom;
616}
617
618/* Recursively adjust ranks to take into account
619 * wide cluster labels when rankdir=LR.
620 * We divide the extra space between the top and bottom.
621 * Adjust the ht1 and ht2 values in the process.
622 */
623static void adjustRanks(graph_t * g, int margin_total)
624{
625 double lht; /* label height */
626 double rht; /* height between top and bottom ranks */
627 int maxr, minr, margin;
628 int c;
629 double delta, ht1, ht2;
630
632 if (g == dot_root(g))
633 margin = 0;
634 else
635 margin = late_int (g, G_margin, CL_OFFSET, 0);
636
637 ht1 = GD_ht1(g);
638 ht2 = GD_ht2(g);
639
640 for (c = 1; c <= GD_n_cluster(g); c++) {
641 graph_t *subg = GD_clust(g)[c];
642 adjustRanks(subg, margin+margin_total);
643 if (GD_maxrank(subg) == GD_maxrank(g))
644 ht1 = fmax(ht1, GD_ht1(subg) + margin);
645 if (GD_minrank(subg) == GD_minrank(g))
646 ht2 = fmax(ht2, GD_ht2(subg) + margin);
647 }
648
649 GD_ht1(g) = ht1;
650 GD_ht2(g) = ht2;
651
652 if (g != dot_root(g) && GD_label(g)) {
653 lht = MAX(GD_border(g)[LEFT_IX].y, GD_border(g)[RIGHT_IX].y);
654 maxr = GD_maxrank(g);
655 minr = GD_minrank(g);
656 rht = ND_coord(rank[minr].v[0]).y - ND_coord(rank[maxr].v[0]).y;
657 delta = lht - (rht + ht1 + ht2);
658 if (delta > 0) {
659 adjustSimple(g, delta, margin_total);
660 }
661 }
662
663 /* update the global ranks */
664 if (g != dot_root(g)) {
665 rank[GD_minrank(g)].ht2 = fmax(rank[GD_minrank(g)].ht2, GD_ht2(g));
666 rank[GD_maxrank(g)].ht1 = fmax(rank[GD_maxrank(g)].ht1, GD_ht1(g));
667 }
668}
669
670/* recursively compute cluster ht requirements. assumes GD_ht1(subg) and ht2
671 * are computed from primitive nodes only. updates ht1 and ht2 to reflect
672 * cluster nesting and labels. also maintains global rank ht1 and ht2.
673 * Return true if some cluster has a label.
674 */
675static int clust_ht(Agraph_t * g)
676{
677 int c;
678 double ht1, ht2;
679 graph_t *subg;
681 int margin, haveClustLabel = 0;
682
683 if (g == dot_root(g))
684 margin = CL_OFFSET;
685 else
686 margin = late_int (g, G_margin, CL_OFFSET, 0);
687
688 ht1 = GD_ht1(g);
689 ht2 = GD_ht2(g);
690
691 /* account for sub-clusters */
692 for (c = 1; c <= GD_n_cluster(g); c++) {
693 subg = GD_clust(g)[c];
694 haveClustLabel |= clust_ht(subg);
695 if (GD_maxrank(subg) == GD_maxrank(g))
696 ht1 = MAX(ht1, GD_ht1(subg) + margin);
697 if (GD_minrank(subg) == GD_minrank(g))
698 ht2 = MAX(ht2, GD_ht2(subg) + margin);
699 }
700
701 /* account for a possible cluster label in clusters */
702 /* room for root graph label is handled in dotneato_postprocess */
703 if (g != dot_root(g) && GD_label(g)) {
704 haveClustLabel = 1;
705 if (!GD_flip(agroot(g))) {
706 ht1 += GD_border(g)[BOTTOM_IX].y;
707 ht2 += GD_border(g)[TOP_IX].y;
708 }
709 }
710 GD_ht1(g) = ht1;
711 GD_ht2(g) = ht2;
712
713 /* update the global ranks */
714 if (g != dot_root(g)) {
715 rank[GD_minrank(g)].ht2 = MAX(rank[GD_minrank(g)].ht2, ht2);
716 rank[GD_maxrank(g)].ht1 = MAX(rank[GD_maxrank(g)].ht1, ht1);
717 }
718
719 return haveClustLabel;
720}
721
722/* set y coordinates of nodes, a rank at a time */
723static void set_ycoords(graph_t * g)
724{
725 edge_t *e;
726 rank_t *rank = GD_rank(g);
727 graph_t *clust;
728
729 /* scan ranks for tallest nodes. */
730 for (int r = GD_minrank(g); r <= GD_maxrank(g); r++) {
731 for (int i = 0; i < rank[r].n; i++) {
732 node_t *const n = rank[r].v[i];
733
734 /* assumes symmetry, ht1 = ht2 */
735 double ht2 = ND_ht(n) / 2;
736
737
738 /* have to look for high self-edge labels, too */
739 if (ND_other(n).list)
740 for (int j = 0; (e = ND_other(n).list[j]); j++) {
741 if (agtail(e) == aghead(e)) {
742 if (ED_label(e))
743 ht2 = fmax(ht2, ED_label(e)->dimen.y / 2);
744 }
745 }
746
747 /* update global rank ht */
748 if (rank[r].pht2 < ht2)
749 rank[r].pht2 = rank[r].ht2 = ht2;
750 if (rank[r].pht1 < ht2)
751 rank[r].pht1 = rank[r].ht1 = ht2;
752
753 /* update nearest enclosing cluster rank ht */
754 if ((clust = ND_clust(n))) {
755 int yoff = clust == g ? 0 : late_int (clust, G_margin, CL_OFFSET, 0);
756 if (ND_rank(n) == GD_minrank(clust))
757 GD_ht2(clust) = fmax(GD_ht2(clust), ht2 + yoff);
758 if (ND_rank(n) == GD_maxrank(clust))
759 GD_ht1(clust) = fmax(GD_ht1(clust), ht2 + yoff);
760 }
761 }
762 }
763
764 /* scan sub-clusters */
765 const int lbl = clust_ht(g);
766
767 /* make the initial assignment of ycoords to leftmost nodes by ranks */
768 double maxht = 0;
769 int r = GD_maxrank(g);
770 ND_coord(rank[r].v[0]).y = rank[r].ht1;
771 while (--r >= GD_minrank(g)) {
772 const double d0 = rank[r + 1].pht2 + rank[r].pht1 + GD_ranksep(g); // prim node sep
773 const double d1 = rank[r + 1].ht2 + rank[r].ht1 + CL_OFFSET; // cluster sep
774 const double delta = fmax(d0, d1);
775 if (rank[r].n > 0) /* this may reflect some problem */
776 ND_coord(rank[r].v[0]).y = ND_coord(rank[r + 1].v[0]).y + delta;
777#ifdef DEBUG
778 else
779 fprintf(stderr, "dot set_ycoords: rank %d is empty\n",
780 rank[r].n);
781#endif
782 maxht = fmax(maxht, delta);
783 }
784
785 /* If there are cluster labels and the drawing is rotated, we need special processing to
786 * allocate enough room. We use adjustRanks for this, and then recompute the maxht if
787 * the ranks are to be equally spaced. This seems simpler and appears to work better than
788 * handling equal spacing as a special case.
789 */
790 if (lbl && GD_flip(g)) {
791 adjustRanks(g, 0);
792 if (GD_exact_ranksep(g)) { /* recompute maxht */
793 maxht = 0;
794 r = GD_maxrank(g);
795 double d0 = ND_coord(rank[r].v[0]).y;
796 while (--r >= GD_minrank(g)) {
797 const double d1 = ND_coord(rank[r].v[0]).y;
798 const double delta = d1 - d0;
799 maxht = fmax(maxht, delta);
800 d0 = d1;
801 }
802 }
803 }
804
805 /* re-assign if ranks are equally spaced */
806 if (GD_exact_ranksep(g)) {
807 for (r = GD_maxrank(g) - 1; r >= GD_minrank(g); r--)
808 if (rank[r].n > 0) /* this may reflect the same problem :-() */
809 ND_coord(rank[r].v[0]).y = ND_coord(rank[r + 1].v[0]).y + maxht;
810 }
811
812 /* copy ycoord assignment from leftmost nodes to others */
813 for (node_t *n = GD_nlist(g); n; n = ND_next(n))
814 ND_coord(n).y = ND_coord(rank[ND_rank(n)].v[0]).y;
815}
816
817/* Compute bounding box of g.
818 * The x limits of clusters are given by the x positions of ln and rn.
819 * This information is stored in the rank field, since it was calculated
820 * using network simplex.
821 * For the root graph, we don't enforce all the constraints on lr and
822 * rn, so we traverse the nodes and subclusters.
823 */
824static void dot_compute_bb(graph_t * g, graph_t * root)
825{
826 int r, c;
827 double x, offset;
828 node_t *v;
829 pointf LL, UR;
830
831 if (g == dot_root(g)) {
832 LL.x = INT_MAX;
833 UR.x = -INT_MAX;
834 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
835 int rnkn = GD_rank(g)[r].n;
836 if (rnkn == 0)
837 continue;
838 if ((v = GD_rank(g)[r].v[0]) == NULL)
839 continue;
840 for (c = 1; ND_node_type(v) != NORMAL && c < rnkn; c++)
841 v = GD_rank(g)[r].v[c];
842 if (ND_node_type(v) == NORMAL) {
843 x = ND_coord(v).x - ND_lw(v);
844 LL.x = MIN(LL.x, x);
845 }
846 else continue;
847 /* At this point, we know the rank contains a NORMAL node */
848 v = GD_rank(g)[r].v[rnkn - 1];
849 for (c = rnkn-2; ND_node_type(v) != NORMAL; c--)
850 v = GD_rank(g)[r].v[c];
851 x = ND_coord(v).x + ND_rw(v);
852 UR.x = MAX(UR.x, x);
853 }
854 offset = CL_OFFSET;
855 for (c = 1; c <= GD_n_cluster(g); c++) {
856 x = (double)(GD_bb(GD_clust(g)[c]).LL.x - offset);
857 LL.x = MIN(LL.x, x);
858 x = (double)(GD_bb(GD_clust(g)[c]).UR.x + offset);
859 UR.x = MAX(UR.x, x);
860 }
861 } else {
862 LL.x = ND_rank(GD_ln(g));
863 UR.x = ND_rank(GD_rn(g));
864 }
865 LL.y = ND_coord(GD_rank(root)[GD_maxrank(g)].v[0]).y - GD_ht1(g);
866 UR.y = ND_coord(GD_rank(root)[GD_minrank(g)].v[0]).y + GD_ht2(g);
867 GD_bb(g).LL = LL;
868 GD_bb(g).UR = UR;
869}
870
871static void rec_bb(graph_t * g, graph_t * root)
872{
873 int c;
874 for (c = 1; c <= GD_n_cluster(g); c++)
875 rec_bb(GD_clust(g)[c], root);
876 dot_compute_bb(g, root);
877}
878
879/* Recursively rescale all bounding boxes using scale factors
880 * xf and yf. We assume all the bboxes have been computed.
881 */
882static void scale_bb(graph_t *g, double xf, double yf) {
883 int c;
884
885 for (c = 1; c <= GD_n_cluster(g); c++)
886 scale_bb(GD_clust(g)[c], xf, yf);
887 GD_bb(g).LL.x *= xf;
888 GD_bb(g).LL.y *= yf;
889 GD_bb(g).UR.x *= xf;
890 GD_bb(g).UR.y *= yf;
891}
892
893/* Set bounding boxes and, if ratio is set, rescale graph.
894 * Note that if some dimension shrinks, there may be problems
895 * with labels.
896 */
897static void set_aspect(graph_t *g) {
898 double xf = 0.0, yf = 0.0, actual, desired;
899 node_t *n;
900 bool filled;
901
902 rec_bb(g, g);
903 if (GD_maxrank(g) > 0 && GD_drawing(g)->ratio_kind) {
904 pointf sz = sub_pointf(GD_bb(g).UR, GD_bb(g).LL); // normalize
905 if (GD_flip(g)) {
906 sz = exch_xyf(sz);
907 }
908 bool scale_it = true;
909 if (GD_drawing(g)->ratio_kind == R_AUTO)
910 filled = idealsize(g, .5);
911 else
912 filled = GD_drawing(g)->ratio_kind == R_FILL;
913 if (filled) {
914 /* fill is weird because both X and Y can stretch */
915 if (GD_drawing(g)->size.x <= 0)
916 scale_it = false;
917 else {
918 xf = GD_drawing(g)->size.x / sz.x;
919 yf = GD_drawing(g)->size.y / sz.y;
920 if (xf < 1.0 || yf < 1.0) {
921 if (xf < yf) {
922 yf /= xf;
923 xf = 1.0;
924 } else {
925 xf /= yf;
926 yf = 1.0;
927 }
928 }
929 }
930 } else if (GD_drawing(g)->ratio_kind == R_EXPAND) {
931 if (GD_drawing(g)->size.x <= 0)
932 scale_it = false;
933 else {
934 xf = GD_drawing(g)->size.x / GD_bb(g).UR.x;
935 yf = GD_drawing(g)->size.y / GD_bb(g).UR.y;
936 if (xf > 1.0 && yf > 1.0) {
937 const double scale = fmin(xf, yf);
938 xf = yf = scale;
939 } else
940 scale_it = false;
941 }
942 } else if (GD_drawing(g)->ratio_kind == R_VALUE) {
943 desired = GD_drawing(g)->ratio;
944 actual = sz.y / sz.x;
945 if (actual < desired) {
946 yf = desired / actual;
947 xf = 1.0;
948 } else {
949 xf = actual / desired;
950 yf = 1.0;
951 }
952 } else
953 scale_it = false;
954 if (scale_it) {
955 if (GD_flip(g)) {
956 SWAP(&xf, &yf);
957 }
958 for (n = GD_nlist(g); n; n = ND_next(n)) {
959 ND_coord(n).x = round(ND_coord(n).x * xf);
960 ND_coord(n).y = round(ND_coord(n).y * yf);
961 }
962 scale_bb(g, xf, yf);
963 }
964 }
965}
966
967/* make space for the leaf nodes of each rank */
968static void make_leafslots(graph_t * g)
969{
970 int i, j, r;
971 node_t *v;
972
973 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
974 j = 0;
975 for (i = 0; i < GD_rank(g)[r].n; i++) {
976 v = GD_rank(g)[r].v[i];
977 ND_order(v) = j;
978 if (ND_ranktype(v) == LEAFSET)
979 j = j + ND_UF_size(v);
980 else
981 j++;
982 }
983 if (j <= GD_rank(g)[r].n)
984 continue;
985 node_t **new_v = gv_calloc(j + 1, sizeof(node_t*));
986 for (i = GD_rank(g)[r].n - 1; i >= 0; i--) {
987 v = GD_rank(g)[r].v[i];
988 new_v[ND_order(v)] = v;
989 }
990 GD_rank(g)[r].n = j;
991 new_v[j] = NULL;
992 free(GD_rank(g)[r].v);
993 GD_rank(g)[r].v = new_v;
994 }
995}
996
997int ports_eq(edge_t * e, edge_t * f)
998{
999 return ED_head_port(e).defined == ED_head_port(f).defined
1000 && ((ED_head_port(e).p.x == ED_head_port(f).p.x &&
1001 ED_head_port(e).p.y == ED_head_port(f).p.y)
1002 || !ED_head_port(e).defined)
1003 && ((ED_tail_port(e).p.x == ED_tail_port(f).p.x &&
1004 ED_tail_port(e).p.y == ED_tail_port(f).p.y)
1005 || !ED_tail_port(e).defined);
1006}
1007
1008static void expand_leaves(graph_t * g)
1009{
1010 int i, d;
1011 node_t *n;
1012 edge_t *e, *f;
1013
1014 make_leafslots(g);
1015 for (n = GD_nlist(g); n; n = ND_next(n)) {
1016 if (ND_other(n).list)
1017 for (i = 0; (e = ND_other(n).list[i]); i++) {
1018 if ((d = ND_rank(aghead(e)) - ND_rank(aghead(e))) == 0)
1019 continue;
1020 f = ED_to_orig(e);
1021 if (!ports_eq(e, f)) {
1022 zapinlist(&(ND_other(n)), e);
1023 if (d == 1)
1024 fast_edge(e);
1025 /*else unitize(e); ### */
1026 i--;
1027 }
1028 }
1029 }
1030}
1031
1032/* Add left and right slacknodes to a cluster which
1033 * are used in the LP to constrain nodes not in g but
1034 * sharing its ranks to be to the left or right of g
1035 * by a specified amount.
1036 * The slacknodes ln and rn give the x position of the
1037 * left and right side of the cluster's bounding box. In
1038 * particular, any cluster labels on the left or right side
1039 * are inside.
1040 * If a cluster has a label, and we have rankdir!=LR, we make
1041 * sure the cluster is wide enough for the label. Note that
1042 * if the label is wider than the cluster, the nodes in the
1043 * cluster may not be centered.
1044 */
1045static void make_lrvn(graph_t * g)
1046{
1047 node_t *ln, *rn;
1048
1049 if (GD_ln(g))
1050 return;
1051 ln = virtual_node(dot_root(g));
1052 ND_node_type(ln) = SLACKNODE;
1053 rn = virtual_node(dot_root(g));
1054 ND_node_type(rn) = SLACKNODE;
1055
1056 if (GD_label(g) && g != dot_root(g) && !GD_flip(agroot(g))) {
1057 const double w = fmax(GD_border(g)[BOTTOM_IX].x, GD_border(g)[TOP_IX].x);
1058 make_aux_edge(ln, rn, w, 0);
1059 }
1060
1061 GD_ln(g) = ln;
1062 GD_rn(g) = rn;
1063}
1064
1065/* make left and right bounding box virtual nodes ln and rn
1066 * constrain interior nodes
1067 */
1068static void contain_nodes(graph_t * g)
1069{
1070 int margin, r;
1071 node_t *ln, *rn, *v;
1072
1073 margin = late_int (g, G_margin, CL_OFFSET, 0);
1074 make_lrvn(g);
1075 ln = GD_ln(g);
1076 rn = GD_rn(g);
1077 for (r = GD_minrank(g); r <= GD_maxrank(g); r++) {
1078 if (GD_rank(g)[r].n == 0)
1079 continue;
1080 v = GD_rank(g)[r].v[0];
1081 if (v == NULL) {
1082 agerrorf("contain_nodes clust %s rank %d missing node\n",
1083 agnameof(g), r);
1084 continue;
1085 }
1086 make_aux_edge(ln, v,
1087 ND_lw(v) + margin + GD_border(g)[LEFT_IX].x, 0);
1088 v = GD_rank(g)[r].v[GD_rank(g)[r].n - 1];
1089 make_aux_edge(v, rn,
1090 ND_rw(v) + margin + GD_border(g)[RIGHT_IX].x, 0);
1091 }
1092}
1093
1094/* set g->drawing->size to a reasonable default.
1095 * returns a boolean to indicate if drawing is to
1096 * be scaled and filled */
1097static bool idealsize(graph_t * g, double minallowed)
1098{
1099 double xf, yf, f, R;
1100 pointf b, relpage, margin;
1101
1102 /* try for one page */
1103 relpage = GD_drawing(g)->page;
1104 if (relpage.x < 0.001 || relpage.y < 0.001)
1105 return false; /* no page was specified */
1106 margin = GD_drawing(g)->margin;
1107 relpage = sub_pointf(relpage, margin);
1108 relpage = sub_pointf(relpage, margin);
1109 b.x = GD_bb(g).UR.x;
1110 b.y = GD_bb(g).UR.y;
1111 xf = relpage.x / b.x;
1112 yf = relpage.y / b.y;
1113 if (xf >= 1.0 && yf >= 1.0)
1114 return false; /* fits on one page */
1115
1116 f = MIN(xf, yf);
1117 xf = yf = MAX(f, minallowed);
1118
1119 R = ceil(xf * b.x / relpage.x);
1120 xf = R * relpage.x / b.x;
1121 R = ceil(yf * b.y / relpage.y);
1122 yf = R * relpage.y / b.y;
1123 GD_drawing(g)->size.x = b.x * xf;
1124 GD_drawing(g)->size.y = b.y * yf;
1125 return true;
1126}
static agxbuf last
last message
Definition agerror.c:29
Memory allocation wrappers that exit on failure.
static void * gv_calloc(size_t nmemb, size_t size)
Definition alloc.h:26
static void * gv_alloc(size_t size)
Definition alloc.h:47
#define MIN(a, b)
Definition arith.h:28
#define ROUND(f)
Definition arith.h:48
#define right(i)
Definition closest.c:72
int late_int(void *obj, attrsym_t *attr, int defaultValue, int minimum)
Definition utils.c:36
void dot_concentrate(graph_t *g)
Definition conc.c:200
#define BOTTOM_IX
Definition const.h:111
#define TOP_IX
Definition const.h:113
#define NORMAL
Definition const.h:24
#define CL_OFFSET
Definition const.h:142
#define EDGE_LABEL
Definition const.h:167
#define LEFT_IX
Definition const.h:114
#define SLACKNODE
Definition const.h:26
#define VIRTUAL
Definition const.h:25
#define LEAFSET
Definition const.h:39
#define RIGHT_IX
Definition const.h:112
Agraph_t * dot_root(void *p)
Definition dotinit.c:520
int flat_edges(Agraph_t *)
Definition flat.c:257
void zapinlist(elist *, Agedge_t *)
remove e from list and fill hole with last member of list
Definition fastgr.c:94
Agedge_t * fast_edge(Agedge_t *)
Definition fastgr.c:69
Agedge_t * find_fast_edge(Agnode_t *, Agnode_t *)
Definition fastgr.c:41
Agnode_t * virtual_node(Agraph_t *)
Definition fastgr.c:198
#define left
Definition dthdr.h:12
geometric functions (e.g. on points and boxes)
static WUR pointf sub_pointf(pointf p, pointf q)
Definition geomprocs.h:96
static WUR pointf exch_xyf(pointf p)
Definition geomprocs.h:128
static WUR pointf scale(double c, pointf p)
Definition geomprocs.h:148
bool Concentrate
Definition globals.h:59
Agsym_t * G_margin
Definition globals.h:72
static double len(glCompPoint p)
Definition glutils.c:136
void free(void *)
node NULL
Definition grammar.y:181
int agnnodes(Agraph_t *g)
Definition graph.c:155
char * agget(void *obj, char *name)
Definition attr.c:448
#define ED_to_orig(e)
Definition types.h:598
#define ED_dist(e)
Definition types.h:602
#define ED_minlen(e)
Definition types.h:592
#define agtail(e)
Definition cgraph.h:977
#define ED_weight(e)
Definition types.h:603
#define aghead(e)
Definition cgraph.h:978
#define ED_head_port(e)
Definition types.h:588
#define ED_label(e)
Definition types.h:589
#define ED_tail_port(e)
Definition types.h:597
void agerrorf(const char *fmt,...)
Definition agerror.c:165
#define GD_minrank(g)
Definition types.h:384
#define GD_maxrank(g)
Definition types.h:382
#define GD_drawing(g)
Definition types.h:353
#define GD_border(g)
Definition types.h:359
#define GD_has_labels(g)
Definition types.h:368
#define GD_clust(g)
Definition types.h:360
#define GD_rn(g)
Definition types.h:398
#define GD_rank(g)
Definition types.h:395
#define GD_bb(g)
Definition types.h:354
#define GD_nlist(g)
Definition types.h:393
#define GD_n_cluster(g)
Definition types.h:389
#define GD_ht2(g)
Definition types.h:372
#define GD_label(g)
Definition types.h:374
#define GD_nodesep(g)
Definition types.h:394
#define GD_ln(g)
Definition types.h:381
#define GD_ht1(g)
Definition types.h:371
#define GD_flip(g)
Definition types.h:378
#define GD_exact_ranksep(g)
Definition types.h:363
#define GD_ranksep(g)
Definition types.h:397
#define ND_rank(n)
Definition types.h:523
#define ND_prev(n)
Definition types.h:521
#define ND_ht(n)
Definition types.h:500
#define ND_next(n)
Definition types.h:510
#define ND_clust(n)
Definition types.h:489
#define ND_other(n)
Definition types.h:514
#define ND_save_in(n)
Definition types.h:526
#define ND_alg(n)
Definition types.h:484
#define ND_flat_out(n)
Definition types.h:493
#define ND_rw(n)
Definition types.h:525
#define ND_node_type(n)
Definition types.h:511
#define ND_lw(n)
Definition types.h:506
#define ND_save_out(n)
Definition types.h:527
#define ND_mval(n)
Definition types.h:508
#define ND_order(n)
Definition types.h:513
#define ND_UF_size(n)
Definition types.h:487
#define ND_ranktype(n)
Definition types.h:524
#define ND_coord(n)
Definition types.h:490
#define ND_in(n)
Definition types.h:501
#define ND_out(n)
Definition types.h:515
char * agnameof(void *)
returns a string descriptor for the object.
Definition id.c:143
#define AGTYPE(obj)
returns AGRAPH, AGNODE, or AGEDGE depending on the type of the object
Definition cgraph.h:216
int agcontains(Agraph_t *, void *obj)
returns non-zero if obj is a member of (sub)graph
Definition obj.c:233
Agraph_t * agroot(void *obj)
Definition obj.c:168
@ AGOUTEDGE
Definition cgraph.h:207
@ AGINEDGE
Definition cgraph.h:207
Arithmetic helper functions.
static int scale_clamp(int original, double scale)
scale up or down a non-negative integer, clamping to [0, INT_MAX]
Definition gv_math.h:76
#define SWAP(a, b)
Definition gv_math.h:134
void mark_lowclusters(Agraph_t *root)
Definition cluster.c:398
#define delta
Definition maze.c:136
int rank(graph_t *g, int balance, int maxiter)
Definition ns.c:986
static void set_ycoords(graph_t *g)
Definition position.c:723
static bool vnode_not_related_to(graph_t *g, node_t *v)
Definition position.c:363
static void separate_subclust(graph_t *g)
Definition position.c:447
static void scale_bb(graph_t *g, double xf, double yf)
Definition position.c:882
static void contain_subclust(graph_t *g)
Definition position.c:424
static void set_aspect(graph_t *g)
Definition position.c:897
static void rec_bb(graph_t *g, graph_t *root)
Definition position.c:871
static void expand_leaves(graph_t *g)
Definition position.c:1008
void dot_position(graph_t *g)
Definition position.c:125
static void connectGraph(graph_t *g)
Definition position.c:77
static void compress_graph(graph_t *g)
Definition position.c:494
static bool idealsize(graph_t *g, double)
Definition position.c:1097
static void contain_clustnodes(graph_t *g)
Definition position.c:347
static void dot_compute_bb(graph_t *g, graph_t *root)
Definition position.c:824
static void make_lrvn(graph_t *g)
Definition position.c:1045
static void make_leafslots(graph_t *g)
Definition position.c:968
static bool canreach(node_t *u, node_t *v)
Definition position.c:172
static void set_xcoords(graph_t *g)
Set x coords of nodes.
Definition position.c:564
static bool go(node_t *u, node_t *v)
Definition position.c:159
static void adjustSimple(graph_t *g, double delta, int margin_total)
Definition position.c:589
static int nsiter2(graph_t *g)
Definition position.c:149
static double largeMinlen(double l)
Definition position.c:62
static int clust_ht(Agraph_t *g)
Definition position.c:675
static void remove_aux_edges(graph_t *g)
Definition position.c:527
static void contain_nodes(graph_t *g)
Definition position.c:1068
static void make_LR_constraints(graph_t *g)
Definition position.c:212
edge_t * make_aux_edge(node_t *u, node_t *v, double len, int wt)
Definition position.c:176
static void make_edge_pairs(graph_t *g)
make virtual edge pairs corresponding to input edges
Definition position.c:320
static void adjustRanks(graph_t *g, int margin_total)
Definition position.c:623
static void pos_clusters(graph_t *g)
Definition position.c:484
static void create_aux_edges(graph_t *g)
Definition position.c:518
static void allocate_aux_edges(graph_t *g)
Definition position.c:194
int ports_eq(edge_t *e, edge_t *f)
Definition position.c:997
static void keepout_othernodes(graph_t *g)
Definition position.c:385
double selfRightSpace(edge_t *e)
Definition splines.c:1137
Agobj_t base
Definition cgraph.h:269
Agedge_t in
Definition cgraph.h:276
Agedge_t out
Definition cgraph.h:276
Agobj_t base
Definition cgraph.h:260
Agrec_t * data
stores programmer-defined data, access with AGDATA
Definition cgraph.h:212
graph or subgraph
Definition cgraph.h:424
Agraph_t * root
subgraphs - ancestors
Definition cgraph.h:433
Definition types.h:251
edge_t ** list
Definition types.h:252
size_t size
Definition types.h:253
double x
Definition geom.h:29
double y
Definition geom.h:29
node_t ** v
Definition types.h:202
int n
Definition types.h:201
#define free_list(L)
Definition types.h:272
#define alloc_elist(n, L)
Definition types.h:267
@ R_AUTO
Definition types.h:216
@ R_COMPRESS
Definition types.h:216
@ R_VALUE
Definition types.h:216
@ R_FILL
Definition types.h:216
@ R_EXPAND
Definition types.h:216
Definition grammar.c:90
#define MAX(a, b)
Definition write.c:32