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