]> git.saurik.com Git - bison.git/blob - src/vcg.h
c2ccfaba731fd90092d5d57e1af004f9c5ea9e0c
[bison.git] / src / vcg.h
1 /* VCG description handler for Bison.
2 Copyright 2001 Free Software Foundation, Inc.
3
4 This file is part of Bison, the GNU Compiler Compiler.
5
6 Bison is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 Bison is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Bison; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 #ifndef VCG_H_
22 # define VCG_H_
23
24 /* VCG color map. The 32 prime predefined colors. */
25 enum color_e
26 {
27 white = 0,
28 blue,
29 red,
30 green = 3,
31 yellow,
32 magenta,
33 cyan = 6,
34 darkgrey,
35 darkblue,
36 darkred = 9,
37 darkgreen,
38 darkyellow,
39 darkmagenta = 12,
40 darkcyan,
41 gold,
42 lightgrey = 15,
43 lightblue,
44 lightred,
45 lightgreen = 18,
46 lightyellow,
47 lightmagenta,
48 lightcyan = 21,
49 lilac,
50 turquoise,
51 aquamarine = 24,
52 khaki,
53 purple,
54 yellowgreen = 27,
55 pink,
56 orange,
57 orchid,
58 black = 31
59 };
60
61 /* VCG textmode. Specify the adjustement of the text within the border of a summary node. */
62 enum textmode_e
63 {
64 centered,
65 left_justify,
66 right_justify
67 };
68
69 /* VCG shapes. Used for nodes shapes. */
70 enum shape_e
71 {
72 box,
73 rhomb,
74 ellipse,
75 triangle
76 };
77
78 /* Structure to construct lists of classnames. */
79 struct classname_s
80 {
81 int no; /* Class number */
82 char *name; /* Name associated to the class no. */
83 struct classname_s *next; /* next name class association. */
84 };
85
86 /* Layout Algorithms which can be found in VCG.
87 Details about each algoithm can be found below. */
88 enum layoutalgorithm_e
89 {
90 normal,
91 maxdepth,
92 mindepth,
93 maxdepthslow,
94 mindepthslow,
95 maxdegree,
96 mindegree,
97 maxindegree,
98 minindegree,
99 maxoutdegree,
100 minoutdegree,
101 minbackward,
102 dfs,
103 tree
104 };
105
106 /* VCG decision yes/no. */
107 enum decision_e
108 {
109 yes,
110 no
111 };
112
113 /* VCG graph orientation. */
114 enum orientation_e
115 {
116 top_to_bottom,
117 bottom_to_top,
118 left_to_right,
119 right_to_left
120 };
121
122 /* VCG alignement for node alignement. */
123 enum alignement_e
124 {
125 center,
126 top,
127 bottom
128 };
129
130 /* VCG arrow mode. */
131 enum arrow_mode_e
132 {
133 fixed,
134 free_a
135 };
136
137 /* VCG crossing weight type. */
138 enum crossing_type_e
139 {
140 bary,
141 median,
142 barymedian,
143 medianbary
144 };
145
146 /* VCG views. */
147 enum view_e
148 {
149 normal_view,
150 cfish,
151 pfish,
152 fcfish,
153 fpfish
154 };
155
156 /*------------------------------------------------------.
157 | Node attributs list. structure that describes a node. |
158 `------------------------------------------------------*/
159
160 struct node_s
161 {
162 /* Title the unique string identifying the node. This attribute is
163 mandatory. */
164 char *title;
165
166 /* Label the text displayed inside the node. If no label is specified
167 then the title of the node will be used. Note that this text may
168 contain control characters like NEWLINE that influences the size of
169 the node. */
170 char *label;
171
172 /* loc is the location as x, y position relatively to the system of
173 coordinates of the graph. Locations are specified in the form
174 loc: - x: xpos y: ypos "". The locations of nodes are only valid,
175 if the whole graph is fully specified with locations and no part is
176 folded. The layout algorithm of the tool calculates appropriate x, y
177 positions, if at least one node that must be drawn (i.e., is not
178 hidden by folding or edge classes) does not have fixed specified
179 locations.
180 Default is none. */
181 int locx;
182 int locy;
183
184 /* vertical order is the level position (rank) of the node. We can also
185 specify level: int. Level specifications are only valid, if the
186 layout is calculated, i.e. if at least one node does not have a
187 fixed location specification. The layout algorithm partitioned all
188 nodes into levels 0...maxlevel. Nodes at the level 0 are on the
189 upper corner. The algorithm is able to calculate appropriate levels
190 for the nodes automatically, if no fixed levels are given.
191 Specifications of levels are additional constraints, that may be
192 ignored, if they are in conflict with near edge specifications.
193 Default values are unspecified. */
194 int vertical_order;
195
196 /* horizontal order is the horizontal position of the node within a
197 level. The nodes which are specified with horizontal positions are
198 ordered according to these positions within the levels. The nodes
199 which do not have this attribute are inserted into this ordering by
200 the crossing reduction mechanism. Note that connected components are
201 handled separately, thus it is not possible to intermix such
202 components by specifying a horizontal order. If the algorithm for
203 downward laid out trees is used, the horizontal order influences
204 only the order of the child nodes at a node, but not the order of
205 the whole level.
206 Default is unspecified. */
207 int horizontal_order;
208
209 /* width, height is the width and height of a node including the border.
210 If no value (in pixels) is given then width and height are
211 calculated from the size of the label.
212 Default are width and height of the label. */
213 int width;
214 int height;
215
216 /* shrink, stretch gives the shrinking and stretching factor of the
217 node. The values of the attributes width, height, borderwidth and
218 the size of the label text is scaled by ((stretch=shrink) \Lambda
219 100) percent. Note that the actual scale value is determined by the
220 scale value of a node relatively to a scale value of the graph,
221 i.e. if (stretch,shrink) = (2,1) for the graph and (stretch,shrink)
222 = (2,1) for the node of the graph, then the node is scaled by the
223 factor 4 compared to the normal size. The scale value can also be
224 specified by scaling: float.
225 Default are 1,1. */
226 int shrink;
227 int stretch;
228
229 /* folding specifies the default folding of the nodes. The folding k
230 (with k ? 0) means that the graph part that is reachable via edges
231 of a class less or equal to k is folded and displayed as one node.
232 There are commands to unfold such summary nodes, see section 5. If
233 no folding is specified for a node, then the node may be folded if
234 it is in the region of another node that starts the folding. If
235 folding 0 is specified, then the node is never folded. In this case
236 the folding stops at the predecessors of this node, if it is
237 reachable from another folding node. The summary node inherits some
238 attributes from the original node which starts the folding (all
239 color attributes, textmode and label, but not the location). A
240 folded region may contain folded regions with smaller folding class
241 values (nested foldings). If there is more than one node that start
242 the folding of the same region (this implies that the folding class
243 values are equal) then the attributes are inherited by one of these
244 nodes nondeterministically. If foldnode attributes are specified,
245 then the summary node attributes are inherited from these attributes.
246 Default is none. */
247 int folding;
248
249 /* shape specifies the visual appearance of a node: box, rhomb, ellipse,
250 and triangle. The drawing of ellipses is much slower than the drawing
251 of the other shapes.
252 Default is box. */
253 enum shape_e shape;
254
255 /* textmode specifies the adjustment of the text within the border of a
256 node. The possibilities are center, left.justify and right.justify.
257 Default is center. */
258 enum textmode_e textmode;
259
260 /* borderwidth specifies the thickness of the node's border in pixels.
261 color is the background color of the node. If none is given, the
262 node is white. For the possibilities, see the attribute color for
263 graphs.
264 Default is 2. */
265 int borderwidth;
266
267 /* node color.
268 Default is white or transparent, */
269 enum color_e color;
270
271 /* textcolor is the color for the label text. bordercolor is the color
272 of the border. Default color is the textcolor. info1, info2, info3
273 combines additional text labels with a node or a folded graph. info1,
274 Default is black. */
275 enum color_e textcolor;
276
277 /* info2, info3 can be selected from the menu. The corresponding text
278 labels can be shown by mouse clicks on nodes.\f
279 Default are null strings. */
280 char *infos[3];
281
282 /* Node border color.
283 Default is textcolor. */
284 enum color_e bordercolor;
285
286 /* Next node node... */
287 struct node_s *next;
288 };
289
290 /* typedef alias. */
291 typedef struct node_s node_t;
292
293 /*-------------------------------------------------------.
294 | Edge attributs list. Structure that describes an edge. |
295 `-------------------------------------------------------*/
296
297 /* VCG Edge type. */
298 enum edge_type
299 {
300 normal_edge,
301 back_edge,
302 near_edge,
303 bent_near_edge
304 };
305
306 /* Structs enum definitions for edges. */
307 enum linestyle_e
308 {
309 continuous,
310 dashed,
311 dotted,
312 invisible
313 };
314
315 enum arrowstyle_e
316 {
317 solid,
318 line,
319 none
320 };
321
322 /* The struct edge_s itself. */
323 struct edge_s
324 {
325
326 /* Edge type.
327 Default is normal edge. */
328 enum edge_type type;
329
330 /* Sourcename is the title of the source node of the edge.
331 Default: none. */
332 char *sourcename; /* Mandatory. */
333
334 /* Targetname is the title of the target node of the edge.
335 Default: none. */
336 char *targetname; /* Mandatory. */
337
338 /* Label specifies the label of the edge. It is drawn if
339 display.edge.labels is set to yes.
340 Default: no label. */
341 char *label;
342
343 /* Linestyle specifies the style the edge is drawn. Possibilities are:
344 ffl continuous a solid line is drawn ( -- ) ffl dashed the edge
345 consists of single dashes ( - - - ) ffl dotted the edge is made of
346 single dots ( \Delta \Delta \Delta ) ffl invisible the edge is not
347 drawn. The attributes of its shape (color, thickness) are ignored.
348 To draw a dashed or dotted line needs more time than solid lines.
349 Default is continuous. */
350 enum linestyle_e linestyle;
351
352 /* Thickness is the thickness of an edge.
353 Default is 2. */
354 int thickness;
355
356 /* Class specifies the folding class of the edge. Nodes reachable by
357 edges of a class less or equal to a constant k specify folding
358 regions of k. See the node attribute folding and the folding commands.
359 Default is 1. */
360 int class;
361
362 /* color is the color of the edge.
363 Default is black. */
364 enum color_e color;
365
366 /* textcolor is the color of the label of the edge. arrowcolor,
367 backarrowcolor is the color of the arrow head and of the backarrow
368 head. priority The positions of the nodes are mainly determined by
369 the incoming and outgoing edges. One can think of rubberbands instead
370 of edges that pull a node into its position. The priority of an edges
371 corresponds to the strength of the rubberband.
372 Default is color. */
373 enum color_e textcolor;
374
375 /* Arrow color.
376 Default is color. */
377 enum color_e arrowcolor;
378
379 /* BackArrow color.
380 Default is color. */
381 enum color_e backarrowcolor;
382
383 /* arrowsize, backarrowsize The arrow head is a right-angled, isosceles
384 triangle and the cathetuses have length arrowsize.
385 Default is 10. */
386 int arrowsize;
387
388 /* Backarrow size
389 Default is 0. */
390 int backarrowsize;
391
392 /* arrowstyle, backarrowstyle Each edge has two arrow heads: the one
393 appears at the target node (the normal arrow head), the other appears
394 at the source node (the backarrow head). Normal edges only have the
395 normal solid arrow head, while the backarrow head is not drawn, i.e.
396 it is none. Arrowstyle is the style of the normal arrow head, and
397 backarrowstyle is the style of the backarrow head. Styles are none,
398 i.e. no arrow head, solid, and line.
399 Default is solid. */
400 enum arrowstyle_e arrowstyle;
401
402 /* Default is none. */
403 enum arrowstyle_e backarrowstyle;
404
405 /* Default is 1. */
406 int priority;
407
408 /* Anchor. An anchor point describes the vertical position in a node
409 where an edge goes out. This is useful, if node labels are several
410 lines long, and outgoing edges are related to label lines. (E.g.,
411 this allows a nice visualization of structs containing pointers as
412 fields.).
413 Default is none. */
414 int anchor;
415
416 /* Horizontal order is the horizontal position the edge. This is of
417 interest only if the edge crosses several levels because it specifies
418 the point where the edge crosses the level. within a level. The nodes
419 which are specified with horizontal positions are ordered according
420 to these positions within a level. The horizontal position of a long
421 edge that crosses the level specifies between which two node of that
422 level the edge has to be drawn. Other edges which do not have this
423 attribute are inserted into this ordering by the crossing reduction
424 mechanism. Note that connected components are handled separately,
425 thus it is not possible to intermix such components by specifying a
426 horizontal order.
427 Default is unspcified. */
428 int horizontal_order;
429
430 /*
431 ** Next edge node...
432 */
433 struct edge_s *next;
434
435 };
436
437 /*
438 ** typedef alias.
439 */
440 typedef struct edge_s edge_t;
441
442 /***************************************************************.
443 **
444 ****************************************************************/
445
446 /*--------------------------------------------------------.
447 | Graph attributs list. Structure that describes a graph. |
448 `--------------------------------------------------------*/
449
450 struct graph_s
451 {
452 /* Graph title or name.
453 Title specifies the name (a string) associated with the graph. The
454 default name of a subgraph is the name of the outer graph, and the
455 name of the outmost graph is the name of the specification input
456 file. The name of a graph is used to identify this graph, e.g., if
457 we want to express that an edge points to a subgraph. Such edges
458 point to the root of the graph, i.e. the first node of the graph or
459 the root of the first subgraph in the graph, if the subgraph is
460 visualized explicitly.
461 By default, it's the name of the vcg graph file description. */
462 char *title;
463
464 /* Graph label.
465 Label the text displayed inside the node, when the graph is folded
466 to a node. If no label is specified then the title of the graph will
467 be used. Note that this text may contain control characters like
468 NEWLINE that influences the size of the node.
469 By default, it takes the title value */
470 char *label;
471
472 /* Any informations.
473 Info1, info2, info3 combines additional text labels with a node or a
474 folded graph. info1, info2, info3 can be selected from the menu
475 interactively. The corresponding text labels can be shown by mouse
476 clicks on nodes.
477 Defalut values are empty strings (here NULL pointers) */
478 char *infos[3];
479
480 /* Background color and summary node colors
481 Color specifies the background color for the outermost graph, or the
482 color of the summary node for subgraphs. Colors are given in the enum
483 declared above. If more than these default colors are needed, a
484 color map with maximal 256 entries can be used. The first 32 entries
485 correspond to the colors just listed. A color of the color map can
486 selected by the color map index, an integer, for instance red has
487 index 2, green has index 3, etc.
488 Default is white for background and white or transparent for summary
489 nodes. */
490 unsigned char color;
491
492 /* Textcolor.
493 need explainations ???
494 defalut is black for summary nodes. */
495 unsigned char textcolor;
496
497 /* Bordercolor is the color of the summary node's border. Default color
498 is the textcolor. width, height are width and height of the
499 displayed part of the window of the outermost graph in pixels, or
500 width and height of the summary node of inner subgraphs.
501 Default is the defalut of the textcolor. */
502 unsigned char bordercolor;
503
504 /* Width, height are width and height of the displayed part of the
505 window of the outermost graph in pixels, or width and height of the
506 summary node of inner subgraphs.
507 Defalut value is 100. */
508 int width;
509 int height;
510
511 /* Specify the thickness if summary node's border in pixels.
512 defalut value is 2. */
513 int borderwidth;
514
515 /* x, y are the x-position and y-position of the graph's window in
516 pixels, relatively to the root screen, if it is the outermost graph.
517 The origin of the window is upper, left hand. For inner subgraphs,
518 it is the position of the folded summary node. The position can also
519 be specified in the form loc: fx:int y:intg.
520 The default value is 0. */
521 int x;
522 int y;
523
524 /* folding of a subgraph is 1, if the subgraph is fused, and 0, if the
525 subgraph is visualized explicitly. There are commands to unfold such
526 summary nodes.
527 Defalut value is 0 */
528 int folding;
529
530 /* Shrink, stretch gives the shrinking and stretching factor for the
531 graph's representation (default is 1, 1). ((stretch=shrink) \Lambda
532 100) is the scaling of the graph in percentage, e.g.,
533 (stretch,shrink) = (1,1) or (2,2) or (3,3) : : : is normal size,
534 (stretch,shrink) = (1,2) is half size, (stretch,shrink) = (2,1) is
535 double size. For subgraphs, it is also the scaling factor of the
536 summary node. The scaling factor can also be specified by scaling:
537 float (here, scaling 1.0 means normal size). */
538 int shrink;
539 int stretch;
540
541 /* textmode specifies the adjustment of the text within the border of a
542 summary node. The possibilities are center, left.justify and
543 right.justify.
544 Default value is center.*/
545 enum textmode_e textmode;
546
547 /* Shape can be specified for subgraphs only. It is the shape of the
548 subgraph summary node that appears if the subgraph is folded: box,
549 rhomb, ellipse, and triangle. vertical order is the level position
550 (rank) of the summary node of an inner subgraph, if this subgraph is
551 folded. We can also specify level: int. The level is only
552 recognized, if an automatical layout is calculated. horizontal order
553 is the horizontal position of the summary node within a level. The
554 nodes which are specified with horizontal positions are ordered
555 according to these positions within the levels. The nodes which do
556 not have this attribute are inserted into this ordering by the
557 crossing reduction mechanism. Note that connected
558 components are handled separately, thus it is not possible to
559 intermix such components by specifying a horizontal order. If the
560 algorithm for downward laid out trees is used, the horizontal order
561 influences only the order of the child nodes at a node, but not the
562 order of the whole level.
563 Defalut is box, other: rhomb, ellipse, triangle. */
564 enum shape_e shape;
565
566 /* FIXME {vertival,horizontal}_order */
567
568 /* xmax, ymax specify the maximal size of the virtual window that is
569 used to display the graph. This is usually larger than the displayed
570 part, thus the width and height of the displayed part cannot be
571 greater than xmax and ymax. Only those parts of the graph are drawn
572 that are inside the virtual window. The virtual window can be moved
573 over the potential infinite system of coordinates by special
574 positioning commands.
575 Defaults are 90 and 90. */
576 int xmax;
577 int ymax;
578
579 /* xy-base: specify the upper left corner coordonates of the graph
580 relatively to the root window.
581 Defaults are 5, 5. */
582 int xbase;
583 int ybase;
584
585 /* xspace, yspace the minimum horizontal and vertical distance between
586 nodes. xlspace is the horizontal distance between lines at the
587 points where they cross the levels. (At these points, dummy nodes
588 are used. In fact, this is the horizontal distance between dummy
589 nodes.) It is recommended to set xlspace to a larger value, if
590 splines are used to draw edges, to prevent sharp bendings.
591 Default are 20 and 70. */
592 int xspace;
593 int yspace;
594
595 /* The horizontal space between lines at the point where they cross
596 the levels.
597 defaults value is 1/2 xspace (polygone) and 4/5 xspace (splines)*/
598 int xlspace;
599
600 /* xraster, yraster specifies the raster distance for the position of
601 the nodes. The center of a node is aligned to this raster. xlraster
602 is the horizontal raster for the positions of the line control
603 points (the dummy nodes). It should be a divisor of xraster.
604 defaluts are 1,1. */
605 int xraster;
606 int yraster;
607
608 /* xlraster is the horizontal raster for the positions of the line
609 control points (the dummy nodes). It should be a divisor of xraster.
610 defaults is 1. */
611 int xlraster;
612
613 /* hidden specifies the classes of edges that are hidden.
614 Edges that are within such a class are not laid out nor drawn.
615 Nodes that are only reachable (forward or backward) by edges of an
616 hidden class are not drawn. However, nodes that are not reachable
617 at all are drawn. (But see attribute ignore.singles.) Specification
618 of classes of hidden edges allows to hide parts of a graph, e.g.,
619 annotations of a syntax tree. This attribute is only allowed at the
620 outermost level. More than one settings are possible to specify
621 exactly the set of classes that are hidden. Note the important
622 difference between hiding of edges and the edge line style invisible.
623 Hidden edges are not existent in the layout. Edges with line style
624 invisible are existent in the layout; they need space and may
625 produce crossings and influence the layout, but you cannot see
626 them.
627 No default value. */
628 int hidden;
629
630 /* Classname allows to introduce names for the edge classes. The names
631 are used in the menus. infoname allows to introduce names for the
632 additional text labels. The names are used in the menus.
633 defaults are 1,2,3...
634 By default, no class names. */
635 struct classname_s *classname;
636
637 /* FIXME : infoname. */
638 /* FIXME : colorentry. */
639
640 /* layoutalgorithm chooses different graph layout algorithms
641 Possibilities are maxdepth, mindepth, maxdepthslow, mindepthslow,
642 maxdegree, mindegree, maxindegree, minindegree, maxoutdegree,
643 minoutdegree, minbackward, dfs and tree. The default algorithm tries
644 to give all edges the same orientation and is based on the
645 calculation of strongly connected components. The algorithms that
646 are based on depth first search are faster. While the simple dfs
647 does not enforce additionally constraints, the algorithm maxdepth
648 tries to increase the depth of the layout and the algorithm mindepth
649 tries to increase the wide of the layout. These algorithms are fast
650 heuristics. If they are not appropriate, the algorithms maxdepthslow
651 or mindepthslow also increase the depth or wide, but they are very
652 slow. The algorithm maxindegree lays out the nodes by scheduling the
653 nodes with the maximum of incoming edges first, and minindegree lays
654 out the nodes by scheduling the nodes with the minimum of incoming
655 edges first. In the same manner work the algorithms maxoutdegree and
656 minoutdegree for outgoing edges, and maxdegree and mindegree for the
657 sum of incoming and outgoing edges. These algorithms may have various
658 effects, and can sometimes be used as replacements of maxdepthslow
659 or mindepthslow.
660
661 The algorithm minbackward can be used if the graph is acyclic.
662 The algorithm tree is a specialized method for downward laid out
663 trees. It is much faster on such tree-like graphs and results in a
664 balanced layout.
665 Default is normal. */
666 enum layoutalgorithm_e layoutalgorithm;
667
668 /* Layout downfactor, layout upfactor, layout nearfactor The layout
669 algorithm partitions the set of edges into edges pointing upward,
670 edges pointing downward, and edges pointing sidewards. The last type
671 of edges is also called near edges. If the layout.downfactor is
672 large compared to the layout.upfactor and the layout.nearfactor,
673 then the positions of the nodes is mainly determined by the edges
674 pointing downwards. If the layout.upfactor is large compared to the
675 layout.downfactor and the layout.nearfactor, then the positions of
676 the nodes is mainly determined by the edges pointing upwards. If the
677 layout.nearfactor is large, then the positions of the nodes is
678 mainly determined by the edges pointing sidewards. These attributes
679 have no effect, if the method for downward laid out trees is used.
680 Defalut is normal. */
681 int layout_downfactor;
682 int layout_upfactor;
683 int layout_nearfactor;
684 /* Layout splinefactor determines the bending at splines. The factor
685 100 indicates a very sharp bending, a factor 1 indicates a very flat
686 bending. Useful values are 30 : : : 80. */
687 int layout_splinefactor;
688
689 /* Late edge labels yes means that the graph is first partitioned and
690 then, labels are introduced. The default algorithm first creates
691 labels and then partitions the graph, which yield a more compact
692 layout, but may have more crossings.
693 Default is no. */
694 enum decision_e late_edge_labels;
695
696 /* Display edge labels yes means display labels and no means don't
697 display edge labels.
698 Default vaule is no. */
699 enum decision_e display_edge_labels;
700
701 /* Dirty edge labels yes enforces a fast layout of edge labels, which
702 may very ugly because several labels may be drawn at the same place.
703 Dirty edge labels cannot be used if splines are used.
704 Default is no.
705 */
706 enum decision_e dirty_edge_labels;
707
708 /* Finetuning no switches the fine tuning phase of the graph layout
709 algorithm off, while it is on as default. The fine tuning phase
710 tries to give all edges the same length.
711 Default is yes. */
712 enum decision_e finetuning;
713
714 /* Ignore singles yes hides all nodes which would appear single and
715 unconnected from the remaining graph. Such nodes have no edge at all
716 and are sometimes very ugly. Default is to show all nodes.
717 Default is no. */
718 enum decision_e ignore_singles;
719
720 /* Straight phase yes initiates an additional phase that tries to avoid
721 bendings in long edges.
722 Long edges are laid out by long straight vertical lines with
723 gradient 90 degree. Thus, this phase is not very appropriate for
724 normal layout, but it is recommended, if an orthogonal layout is
725 selected (see manhattan.edges).
726 Default is no. */
727 enum decision_e straight_phase;
728
729 /* priority phase yes replaces the normal pendulum method by a
730 specialized method: It forces straight long edges with 90 degree,
731 just as the straight phase. In fact, the straight phase is a fine
732 tune phase of the priority method. This phase is also recommended,
733 if an orthogonal layout is selected (see manhattan.edges).
734 Default is no. */
735 enum decision_e priority_phase;
736
737 /* manhattan edges yes switches the orthogonal layout on. Orthogonal
738 layout (or manhattan layout) means that all edges consist of line
739 segments with gradient 0 or 90 degree. Vertical edge segments might
740 by shared by several edges, while horizontal edge segments are never
741 shared. This results in very aesthetical layouts just for flowcharts.
742 If the orthogonal layout is used, then the priority phase and
743 straight phase should be used. Thus, these both phases are switched
744 on, too, unless priority layout and straight line tuning are
745 switched off explicitly.
746 Default is no. */
747 enum decision_e manhattan_edges;
748
749 /* Smanhattan edges yes switches a specialized orthogonal layout on:
750 Here, all horizontal edge segments between two levels share the same
751 horizontal line, i.e. not only vertical edge segments are shared,
752 but horizontal edge segments are shared by several edges, too. This
753 looks nice for trees but might be too confusing in general, because
754 the location of an edge might be ambiguously.
755 Default is no. */
756 enum decision_e smanhattan_edges;
757
758 /* Near edges no suppresses near edges and bent near edges in the
759 graph layout.
760 Default is yes. */
761 enum decision_e near_edges;
762
763 /* Orientation specifies the orientation of the graph: top.to.bottom,
764 bottom.to.top, left.to.right or right.to.left. Note: the normal
765 orientation is top.to.bottom. All explanations here are given
766 relatively to the normal orientation, i.e., e.g., if the orientation
767 is left to right, the attribute xlspace is not the horizontal but
768 the vertical distance between lines, etc.
769 Default is to_to_bottom. */
770 enum orientation_e orientation;
771
772 /* Node alignment specified the vertical alignment of nodes at the
773 horizontal reference line of the levels. If top is specified, the
774 tops of all nodes of a level have the same y-coordinate; on bottom,
775 the bottoms have the same y-coordinate, on center the nodes are
776 centered at the levels.
777 Default is center. */
778 enum alignement_e node_alignement;
779
780 /* Port sharing no suppresses the sharing of ports of edges at the
781 nodes. Normally, if multiple edges are adjacent to the same node,
782 and the arrow head of all these edges has the same visual appearance
783 (color, size, etc.), then these edges may share a port at a node,
784 i.e. only one arrow head is draw, and all edges are incoming into
785 this arrow head. This allows to have many edges adjacent to one node
786 without getting confused by too many arrow heads. If no port sharing
787 is used, each edge has its own port, i.e. its own place where it is
788 adjacent to the node.
789 Default is yes. */
790 enum decision_e port_sharing;
791
792 /* Arrow mode fixed (default) should be used, if port sharing is used,
793 because then, only a fixed set of rotations for the arrow heads are
794 used. If the arrow mode is free, then each arrow head is rotated
795 individually to each edge. But this can yield to a black spot, where
796 nothing is recognizable, if port sharing is used, since all these
797 qdifferently rotated arrow heads are drawn at the same place. If the
798 arrow mode is fixed, then the arrow head is rotated only in steps of
799 45 degree, and only one arrow head occurs at each port.
800 Default is fixed. */
801 enum arrow_mode_e arrow_mode;
802
803 /* Treefactor The algorithm tree for downward laid out trees tries to
804 produce a medium dense, balanced tree-like layout. If the tree
805 factor is greater than 0.5, the tree edges are spread, i.e. they
806 get a larger gradient. This may improve the readability of the tree.
807 Note: it is not obvious whether spreading results in a more dense or
808 wide layout. For a tree, there is a tree factor such that the whole
809 tree is minimal wide.
810 Default is 0.5. */
811 float treefactor;
812
813 /* Spreadlevel This parameter only influences the algorithm tree, too.
814 For large, balanced trees, spreading of the uppermost nodes would
815 enlarge the width of the tree too much, such that the tree does not
816 fit anymore in a window. Thus, the spreadlevel specifies the minimal
817 level (rank) where nodes are spread. Nodes of levels upper than
818 spreadlevel are not spread.
819 Default is 1. */
820 int spreadlevel;
821
822 /* Crossing weight specifies the weight that is used for the crossing
823 reduction: bary (default), median, barymedian or medianbary. We
824 cannot give a general recommendation, which is the best method. For
825 graphs with very large average degree of edges (number of incoming
826 and outgoing edges at a node), the weight bary is the fastest
827 method. With the weights barymedian and medianbary, equal weights of
828 different nodes are not very probable, thus the crossing reduction
829 phase 2 might be very fast.
830 Default is bary. */
831 enum crossing_type_e crossing_weight;
832
833 /* Crossing phase2 is the most time consuming phase of the crossing
834 reduction. In this phase, the nodes that happen to have equal
835 crossing weights are permuted. By specifying no, this phase is
836 suppressed.
837 Default is yes. */
838 enum decision_e crossing_phase2;
839
840 /* Crossing optimization is a postprocessing phase after the normal
841 crossing reduction: we try to optimize locally, by exchanging pairs
842 of nodes to reduce the crossings. Although this phase is not very
843 time consuming, it can be suppressed by specifying no.
844 Default is yes. */
845 enum decision_e crossing_optimization;
846
847 /* View allows to select the fisheye views. Because
848 of the fixed size of the window that shows the graph, we normally
849 can only see a small amount of a large graph. If we shrink the graph
850 such that it fits into the window, we cannot recognize any detail
851 anymore. Fisheye views are coordinate transformations: the view onto
852 the graph is distort, to overcome this usage deficiency. The polar
853 fisheye is easy to explain: assume a projection of the plane that
854 contains the graph picture onto a spheric ball. If we now look onto
855 this ball in 3 D, we have a polar fisheye view. There is a focus
856 point which is magnified such that we see all details. Parts of the
857 plane that are far away from the focus point are demagnified very
858 much. Cartesian fisheye have a similar effect; only the formula for
859 the coordinate transformation is different. Selecting cfish means
860 the cartesian fisheye is used which demagnifies such that the whole
861 graph is visible (self adaptable cartesian fisheye). With fcfish,
862 the cartesian fisheye shows the region of a fixed radius around the
863 focus point (fixed radius cartesian fisheye). This region might be
864 smaller than the whole graph, but the demagnification needed to show
865 this region in the window is also not so large, thus more details
866 are recognizable. With pfish the self adaptable polar fisheye is
867 selected that shows the whole graph, and with fpfish the fixed
868 radius polar fisheye is selected.
869 Defalut is normal view. */
870 enum view_e view;
871
872 /* Edges no suppresses the drawing of edges.
873 Default is yes. */
874 enum decision_e edges;
875
876 /* Nodes no suppresses the drawing of nodes.
877 Default is yes. */
878 enum decision_e nodes;
879
880 /* Splines specifies whether splines are used to draw edges (yes or no).
881 As default, polygon segments are used to draw edges, because this is
882 much faster. Note that the spline drawing routine is not fully
883 validated, and is very slow. Its use is mainly to prepare high
884 quality PostScript output for very small graphs.
885 Default is no. */
886 enum decision_e splines;
887
888 /* Bmax set the maximal number of iterations that are done for the
889 reduction of edge bendings.
890 Default is 100. */
891 int bmax;
892
893 /* Cmin set the minimal number of iterations that are done for the
894 crossing reduction with the crossing weights. The normal method
895 stops if two consecutive checks does not reduce the number of
896 crossings anymore. However, this increasing of the number of
897 crossings might be locally, such that after some more iterations,
898 the crossing number might decrease much more.
899 Default is 0. */
900 int cmin;
901
902 /* Cmax set the maximal number of interactions for crossing reduction.
903 This is helpful for speedup the layout process.
904 Default is infinite. */
905 int cmax;
906
907 /* Pmin set the minimal number of iterations that is done with the
908 pendulum method. Similar to the crossing reduction, this method
909 stops if the `imbalancement weight' does not decreases anymore.
910 However, the increasing of the imbalancement weight might be locally,
911 such that after some more iterations, the imbalancement weight might
912 decrease much more.
913 Default is 0. */
914 int pmin;
915
916 /* Pmax set the maximal number of iterations of the pendulum method.
917 This is helpful for speedup the layout process.
918 Default is 100. */
919 int pmax;
920
921 /* Rmin set the minimal number of iterations that is done with the
922 rubberband method. This is similar as for the pendulum method.
923 Default is 0. */
924 int rmin;
925
926 /* Rmax set the maximal number of iterations of the rubberband method.
927 This is helpful for speedup the layout process.
928 Default is 100. */
929 int rmax;
930
931 /* Smax set the maximal number of iterations of the straight line
932 recognition phase (useful only, if the straight line recognition
933 phase is switched on, see attribute straight.phase).
934 Default is 100. */
935 int smax;
936
937 /* Generic values.
938 */
939 node_t node;
940 edge_t edge;
941
942 /* List of nodes declared.
943 Pointer. */
944 node_t *node_list;
945
946 /* List of edges declared.
947 Pointer. */
948 edge_t *edge_list;
949
950 };
951
952 /* Graph typedefs. */
953 typedef struct graph_s graph_t;
954
955 void new_graph PARAMS ((graph_t *g));
956 void new_node PARAMS ((node_t *node));
957 void new_edge PARAMS ((edge_t *edge));
958
959 void add_node PARAMS ((graph_t *graph, node_t *node));
960 void add_edge PARAMS ((graph_t *graph, edge_t *edge));
961
962 void open_node PARAMS ((struct obstack *os));
963 void output_node PARAMS ((node_t *node, struct obstack *os));
964 void close_node PARAMS ((struct obstack *os));
965
966 void open_edge PARAMS ((edge_t *edge, struct obstack *os));
967 void output_edge PARAMS ((edge_t *edge, struct obstack *os));
968 void close_edge PARAMS ((struct obstack *os));
969
970 void open_graph PARAMS ((struct obstack *os));
971 void output_graph PARAMS ((graph_t *graph, struct obstack *os));
972 void close_graph PARAMS ((graph_t *graph, struct obstack *os));
973
974 #endif /* VCG_H_ */
975