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