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