]> git.saurik.com Git - bison.git/blame - src/vcg.h
Update.
[bison.git] / src / vcg.h
CommitLineData
ce4d5ce0 1/* VCG description handler for Bison.
106344fb
PE
2
3 Copyright (C) 2001, 2002 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
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. */
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/* Layout Algorithms which can be found in VCG.
c4b66126 106 Details about each algoithm can be found below. */
106344fb 107enum layoutalgorithm
ce4d5ce0
AD
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. */
106344fb 126enum decision
ce4d5ce0
AD
127{
128 yes,
129 no
130};
131
132/* VCG graph orientation. */
106344fb 133enum orientation
ce4d5ce0
AD
134{
135 top_to_bottom,
136 bottom_to_top,
137 left_to_right,
138 right_to_left
139};
140
106344fb
PE
141/* VCG alignment for node alignement. */
142enum alignment
ce4d5ce0
AD
143{
144 center,
145 top,
146 bottom
147};
148
149/* VCG arrow mode. */
106344fb 150enum arrow_mode
ce4d5ce0
AD
151{
152 fixed,
153 free_a
154};
155
156/* VCG crossing weight type. */
106344fb 157enum crossing_type
ce4d5ce0
AD
158{
159 bary,
160 median,
161 barymedian,
162 medianbary
163};
164
165/* VCG views. */
106344fb 166enum view
ce4d5ce0
AD
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
106344fb 179struct node
ce4d5ce0 180{
c4b66126 181 /* Title the unique string identifying the node. This attribute is
ce4d5ce0 182 mandatory. */
342b8b6e 183 const char *title;
c4b66126
AD
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
ce4d5ce0 188 the node. */
342b8b6e 189 const char *label;
c4b66126
AD
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.
ce4d5ce0
AD
199 Default is none. */
200 int locx;
201 int locy;
202
c4b66126
AD
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
ce4d5ce0
AD
211 ignored, if they are in conflict with near edge specifications.
212 Default values are unspecified. */
213 int vertical_order;
214
c4b66126
AD
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.
ce4d5ce0
AD
225 Default is unspecified. */
226 int horizontal_order;
227
228 /* width, height is the width and height of a node including the border.
c4b66126 229 If no value (in pixels) is given then width and height are
ce4d5ce0
AD
230 calculated from the size of the label.
231 Default are width and height of the label. */
232 int width;
233 int height;
234
106344fb 235 /* shrink, expand gives the shrinking and expanding factor of the
c4b66126 236 node. The values of the attributes width, height, borderwidth and
106344fb 237 the size of the label text is scaled by ((expand=shrink) \Lambda
c4b66126
AD
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,
106344fb 240 i.e. if (expand,shrink) = (2,1) for the graph and (expand,shrink)
c4b66126
AD
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
ce4d5ce0
AD
243 specified by scaling: float.
244 Default are 1,1. */
245 int shrink;
106344fb 246 int expand;
ce4d5ce0 247
c4b66126
AD
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,
ce4d5ce0
AD
264 then the summary node attributes are inherited from these attributes.
265 Default is none. */
266 int folding;
c4b66126
AD
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
ce4d5ce0
AD
270 of the other shapes.
271 Default is box. */
106344fb 272 enum shape shape;
c4b66126
AD
273
274 /* textmode specifies the adjustment of the text within the border of a
ce4d5ce0
AD
275 node. The possibilities are center, left.justify and right.justify.
276 Default is center. */
106344fb 277 enum textmode textmode;
c4b66126
AD
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
ce4d5ce0
AD
282 graphs.
283 Default is 2. */
284 int borderwidth;
c4b66126 285
ce4d5ce0
AD
286 /* node color.
287 Default is white or transparent, */
106344fb 288 enum color color;
c4b66126
AD
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
ce4d5ce0
AD
292 combines additional text labels with a node or a folded graph. info1,
293 Default is black. */
106344fb 294 enum color textcolor;
c4b66126
AD
295
296 /* info2, info3 can be selected from the menu. The corresponding text
ce4d5ce0
AD
297 labels can be shown by mouse clicks on nodes.\f
298 Default are null strings. */
342b8b6e 299 const char *infos[3];
c4b66126 300
ce4d5ce0
AD
301 /* Node border color.
302 Default is textcolor. */
106344fb 303 enum color bordercolor;
c4b66126 304
ce4d5ce0 305 /* Next node node... */
106344fb 306 struct node *next;
ce4d5ce0
AD
307};
308
309/* typedef alias. */
106344fb 310typedef struct node node;
ce4d5ce0
AD
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. */
106344fb 326enum linestyle
ce4d5ce0
AD
327{
328 continuous,
329 dashed,
330 dotted,
331 invisible
332};
333
106344fb 334enum arrowstyle
ce4d5ce0
AD
335{
336 solid,
337 line,
338 none
339};
340
106344fb
PE
341/* The struct edge itself. */
342struct edge
ce4d5ce0 343{
c4b66126 344
ce4d5ce0
AD
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. */
c4b66126
AD
351 const char *sourcename; /* Mandatory. */
352
ce4d5ce0
AD
353 /* Targetname is the title of the target node of the edge.
354 Default: none. */
c4b66126
AD
355 const char *targetname; /* Mandatory. */
356
357 /* Label specifies the label of the edge. It is drawn if
ce4d5ce0
AD
358 display.edge.labels is set to yes.
359 Default: no label. */
c4b66126 360 const char *label;
ce4d5ce0
AD
361
362 /* Linestyle specifies the style the edge is drawn. Possibilities are:
c4b66126
AD
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
ce4d5ce0
AD
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. */
106344fb 369 enum linestyle linestyle;
c4b66126 370
ce4d5ce0
AD
371 /* Thickness is the thickness of an edge.
372 Default is 2. */
373 int thickness;
374
c4b66126
AD
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
ce4d5ce0
AD
377 regions of k. See the node attribute folding and the folding commands.
378 Default is 1. */
379 int class;
c4b66126
AD
380
381 /* color is the color of the edge.
ce4d5ce0 382 Default is black. */
106344fb 383 enum color color;
c4b66126
AD
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
ce4d5ce0
AD
390 corresponds to the strength of the rubberband.
391 Default is color. */
106344fb 392 enum color textcolor;
c4b66126 393
ce4d5ce0
AD
394 /* Arrow color.
395 Default is color. */
106344fb 396 enum color arrowcolor;
c4b66126 397
ce4d5ce0
AD
398 /* BackArrow color.
399 Default is color. */
106344fb 400 enum color backarrowcolor;
c4b66126
AD
401
402 /* arrowsize, backarrowsize The arrow head is a right-angled, isosceles
ce4d5ce0
AD
403 triangle and the cathetuses have length arrowsize.
404 Default is 10. */
405 int arrowsize;
c4b66126 406
ce4d5ce0
AD
407 /* Backarrow size
408 Default is 0. */
409 int backarrowsize;
c4b66126
AD
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,
ce4d5ce0
AD
417 i.e. no arrow head, solid, and line.
418 Default is solid. */
106344fb 419 enum arrowstyle arrowstyle;
c4b66126 420
ce4d5ce0 421 /* Default is none. */
106344fb 422 enum arrowstyle backarrowstyle;
c4b66126 423
ce4d5ce0
AD
424 /* Default is 1. */
425 int priority;
c4b66126
AD
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
ce4d5ce0
AD
431 fields.).
432 Default is none. */
433 int anchor;
c4b66126
AD
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
ce4d5ce0
AD
445 horizontal order.
446 Default is unspcified. */
447 int horizontal_order;
c4b66126 448
ce4d5ce0
AD
449 /*
450 ** Next edge node...
451 */
106344fb 452 struct edge *next;
ce4d5ce0
AD
453
454};
455
456/*
c4b66126 457** typedef alias.
ce4d5ce0 458*/
106344fb 459typedef struct edge edge;
ce4d5ce0 460
ce4d5ce0
AD
461/*--------------------------------------------------------.
462| Graph attributs list. Structure that describes a graph. |
463`--------------------------------------------------------*/
464
106344fb 465struct graph
ce4d5ce0
AD
466{
467 /* Graph title or name.
c4b66126
AD
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
ce4d5ce0
AD
475 visualized explicitly.
476 By default, it's the name of the vcg graph file description. */
c4b66126
AD
477 const char *title;
478
ce4d5ce0 479 /* Graph label.
c4b66126
AD
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
ce4d5ce0
AD
483 NEWLINE that influences the size of the node.
484 By default, it takes the title value */
c4b66126
AD
485 const char *label;
486
ce4d5ce0 487 /* Any informations.
c4b66126
AD
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
ce4d5ce0 491 clicks on nodes.
177d84c0 492 Default values are empty strings (here NULL pointers) */
c4b66126
AD
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
ce4d5ce0 497 color of the summary node for subgraphs. Colors are given in the enum
c4b66126
AD
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
ce4d5ce0
AD
502 index 2, green has index 3, etc.
503 Default is white for background and white or transparent for summary
504 nodes. */
106344fb 505 enum color color;
ce4d5ce0 506
c4b66126 507 /* Textcolor.
177d84c0
PE
508 need explanations ???
509 default is black for summary nodes. */
106344fb 510 enum color textcolor;
ce4d5ce0 511
c4b66126
AD
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
ce4d5ce0 515 width and height of the summary node of inner subgraphs.
177d84c0 516 Default is the default of the textcolor. */
106344fb 517 enum color bordercolor;
c4b66126
AD
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
ce4d5ce0 521 summary node of inner subgraphs.
177d84c0 522 Default value is 100. */
ce4d5ce0
AD
523 int width;
524 int height;
c4b66126 525
ce4d5ce0 526 /* Specify the thickness if summary node's border in pixels.
177d84c0 527 default value is 2. */
ce4d5ce0
AD
528 int borderwidth;
529
c4b66126
AD
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
ce4d5ce0
AD
534 be specified in the form loc: fx:int y:intg.
535 The default value is 0. */
536 int x;
537 int y;
c4b66126
AD
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
ce4d5ce0 541 summary nodes.
177d84c0 542 Default value is 0 */
ce4d5ce0 543 int folding;
c4b66126 544
106344fb
PE
545 /* Shrink, expand gives the shrinking and expanding factor for the
546 graph's representation (default is 1, 1). ((expand=shrink) \Lambda
c4b66126 547 100) is the scaling of the graph in percentage, e.g.,
106344fb
PE
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
c4b66126
AD
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:
ce4d5ce0
AD
552 float (here, scaling 1.0 means normal size). */
553 int shrink;
106344fb 554 int expand;
ce4d5ce0 555
c4b66126
AD
556 /* textmode specifies the adjustment of the text within the border of a
557 summary node. The possibilities are center, left.justify and
ce4d5ce0
AD
558 right.justify.
559 Default value is center.*/
106344fb 560 enum textmode textmode;
c4b66126
AD
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
ce4d5ce0 577 order of the whole level.
177d84c0 578 Default is box, other: rhomb, ellipse, triangle. */
106344fb 579 enum shape shape;
c4b66126 580
342b8b6e
AD
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;
c4b66126
AD
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
ce4d5ce0
AD
604 positioning commands.
605 Defaults are 90 and 90. */
606 int xmax;
607 int ymax;
c4b66126 608
106344fb 609 /* xy-base: specify the upper left corner coordinates of the graph
ce4d5ce0
AD
610 relatively to the root window.
611 Defaults are 5, 5. */
612 int xbase;
613 int ybase;
c4b66126
AD
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
ce4d5ce0
AD
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
c4b66126
AD
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
ce4d5ce0 633 points (the dummy nodes). It should be a divisor of xraster.
177d84c0 634 defaults are 1,1. */
ce4d5ce0
AD
635 int xraster;
636 int yraster;
637
c4b66126 638 /* xlraster is the horizontal raster for the positions of the line
ce4d5ce0
AD
639 control points (the dummy nodes). It should be a divisor of xraster.
640 defaults is 1. */
641 int xlraster;
c4b66126
AD
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
ce4d5ce0 652 difference between hiding of edges and the edge line style invisible.
c4b66126
AD
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.
ce4d5ce0
AD
657 No default value. */
658 int hidden;
659
c4b66126
AD
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
ce4d5ce0 662 additional text labels. The names are used in the menus.
c4b66126
AD
663 defaults are 1,2,3...
664 By default, no class names. */
106344fb 665 struct classname *classname;
ce4d5ce0 666
342b8b6e
AD
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. */
106344fb 671 struct infoname *infoname;
342b8b6e
AD
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. */
106344fb 679 struct colorentry *colorentry;
c4b66126
AD
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
ce4d5ce0 698 sum of incoming and outgoing edges. These algorithms may have various
c4b66126 699 effects, and can sometimes be used as replacements of maxdepthslow
ce4d5ce0 700 or mindepthslow.
c4b66126 701
ce4d5ce0 702 The algorithm minbackward can be used if the graph is acyclic.
c4b66126
AD
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
ce4d5ce0
AD
705 balanced layout.
706 Default is normal. */
106344fb 707 enum layoutalgorithm layoutalgorithm;
c4b66126
AD
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
ce4d5ce0 720 have no effect, if the method for downward laid out trees is used.
177d84c0 721 Default is normal. */
ce4d5ce0
AD
722 int layout_downfactor;
723 int layout_upfactor;
724 int layout_nearfactor;
c4b66126 725 /* Layout splinefactor determines the bending at splines. The factor
ce4d5ce0
AD
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;
c4b66126
AD
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
ce4d5ce0
AD
733 layout, but may have more crossings.
734 Default is no. */
106344fb 735 enum decision late_edge_labels;
c4b66126
AD
736
737 /* Display edge labels yes means display labels and no means don't
ce4d5ce0
AD
738 display edge labels.
739 Default vaule is no. */
106344fb 740 enum decision display_edge_labels;
c4b66126
AD
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.
ce4d5ce0
AD
744 Dirty edge labels cannot be used if splines are used.
745 Default is no.
746 */
106344fb 747 enum decision dirty_edge_labels;
c4b66126
AD
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
ce4d5ce0
AD
751 tries to give all edges the same length.
752 Default is yes. */
106344fb 753 enum decision finetuning;
c4b66126
AD
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
ce4d5ce0
AD
757 and are sometimes very ugly. Default is to show all nodes.
758 Default is no. */
106344fb 759 enum decision ignore_singles;
c4b66126 760
106344fb 761 /* Long straight phase yes initiates an additional phase that tries to avoid
ce4d5ce0 762 bendings in long edges.
c4b66126
AD
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
ce4d5ce0
AD
766 selected (see manhattan.edges).
767 Default is no. */
106344fb 768 enum decision long_straight_phase;
ce4d5ce0 769
c4b66126
AD
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).
ce4d5ce0 775 Default is no. */
106344fb 776 enum decision priority_phase;
ce4d5ce0 777
c4b66126
AD
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
ce4d5ce0 782 shared. This results in very aesthetical layouts just for flowcharts.
c4b66126
AD
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
ce4d5ce0
AD
786 switched off explicitly.
787 Default is no. */
106344fb 788 enum decision manhattan_edges;
ce4d5ce0 789
c4b66126
AD
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
ce4d5ce0
AD
795 the location of an edge might be ambiguously.
796 Default is no. */
106344fb 797 enum decision smanhattan_edges;
c4b66126
AD
798
799 /* Near edges no suppresses near edges and bent near edges in the
ce4d5ce0
AD
800 graph layout.
801 Default is yes. */
106344fb 802 enum decision near_edges;
c4b66126
AD
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
ce4d5ce0
AD
809 the vertical distance between lines, etc.
810 Default is to_to_bottom. */
106344fb 811 enum orientation orientation;
ce4d5ce0 812
c4b66126
AD
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
ce4d5ce0
AD
817 centered at the levels.
818 Default is center. */
106344fb 819 enum alignment node_alignment;
ce4d5ce0 820
c4b66126
AD
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
ce4d5ce0
AD
829 adjacent to the node.
830 Default is yes. */
106344fb 831 enum decision port_sharing;
ce4d5ce0 832
c4b66126
AD
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
ce4d5ce0 840 45 degree, and only one arrow head occurs at each port.
c4b66126 841 Default is fixed. */
106344fb 842 enum arrow_mode arrow_mode;
ce4d5ce0 843
c4b66126
AD
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
ce4d5ce0
AD
850 tree is minimal wide.
851 Default is 0.5. */
852 float treefactor;
853
c4b66126
AD
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
ce4d5ce0
AD
859 spreadlevel are not spread.
860 Default is 1. */
861 int spreadlevel;
862
c4b66126
AD
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
ce4d5ce0
AD
870 phase 2 might be very fast.
871 Default is bary. */
106344fb 872 enum crossing_type crossing_weight;
ce4d5ce0 873
c4b66126
AD
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
ce4d5ce0
AD
877 suppressed.
878 Default is yes. */
106344fb 879 enum decision crossing_phase2;
ce4d5ce0 880
c4b66126
AD
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
ce4d5ce0
AD
884 time consuming, it can be suppressed by specifying no.
885 Default is yes. */
106344fb 886 enum decision crossing_optimization;
ce4d5ce0 887
c4b66126
AD
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
ce4d5ce0 909 radius polar fisheye is selected.
177d84c0 910 Default is normal view. */
106344fb 911 enum view view;
ce4d5ce0
AD
912
913 /* Edges no suppresses the drawing of edges.
914 Default is yes. */
106344fb 915 enum decision edges;
c4b66126 916
ce4d5ce0
AD
917 /* Nodes no suppresses the drawing of nodes.
918 Default is yes. */
106344fb 919 enum decision nodes;
ce4d5ce0
AD
920
921 /* Splines specifies whether splines are used to draw edges (yes or no).
c4b66126
AD
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.
ce4d5ce0 926 Default is no. */
106344fb 927 enum decision splines;
ce4d5ce0 928
c4b66126 929 /* Bmax set the maximal number of iterations that are done for the
ce4d5ce0
AD
930 reduction of edge bendings.
931 Default is 100. */
932 int bmax;
933
c4b66126
AD
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,
ce4d5ce0
AD
939 the crossing number might decrease much more.
940 Default is 0. */
941 int cmin;
c4b66126
AD
942
943 /* Cmax set the maximal number of interactions for crossing reduction.
ce4d5ce0
AD
944 This is helpful for speedup the layout process.
945 Default is infinite. */
946 int cmax;
c4b66126
AD
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.
ce4d5ce0 951 However, the increasing of the imbalancement weight might be locally,
c4b66126 952 such that after some more iterations, the imbalancement weight might
ce4d5ce0
AD
953 decrease much more.
954 Default is 0. */
955 int pmin;
c4b66126
AD
956
957 /* Pmax set the maximal number of iterations of the pendulum method.
ce4d5ce0
AD
958 This is helpful for speedup the layout process.
959 Default is 100. */
960 int pmax;
c4b66126
AD
961
962 /* Rmin set the minimal number of iterations that is done with the
ce4d5ce0
AD
963 rubberband method. This is similar as for the pendulum method.
964 Default is 0. */
965 int rmin;
c4b66126
AD
966
967 /* Rmax set the maximal number of iterations of the rubberband method.
ce4d5ce0
AD
968 This is helpful for speedup the layout process.
969 Default is 100. */
970 int rmax;
971
c4b66126
AD
972 /* Smax set the maximal number of iterations of the straight line
973 recognition phase (useful only, if the straight line recognition
ce4d5ce0
AD
974 phase is switched on, see attribute straight.phase).
975 Default is 100. */
976 int smax;
977
978 /* Generic values.
979 */
106344fb
PE
980 node node;
981 edge edge;
ce4d5ce0
AD
982
983 /* List of nodes declared.
984 Pointer. */
106344fb 985 node *node_list;
c4b66126 986
ce4d5ce0
AD
987 /* List of edges declared.
988 Pointer. */
106344fb 989 edge *edge_list;
c4b66126 990
ce4d5ce0
AD
991};
992
993/* Graph typedefs. */
106344fb 994typedef struct graph graph;
ce4d5ce0 995
106344fb
PE
996void new_graph (graph *g);
997void new_node (node *n);
998void new_edge (edge *e);
ce4d5ce0 999
106344fb
PE
1000void add_node (graph *g, node *n);
1001void add_edge (graph *g, edge *e);
ce4d5ce0 1002
106344fb 1003void add_colorentry (graph *g, int color_idx, int red_cp,
d33cb3ae 1004 int green_cp, int blue_cp);
106344fb
PE
1005void add_classname (graph *g, int val, const char *name);
1006void add_infoname (graph *g, int val, const char *name);
342b8b6e 1007
d33cb3ae 1008void open_node (FILE *fout);
106344fb 1009void output_node (node *n, FILE *fout);
d33cb3ae 1010void close_node (FILE *fout);
ce4d5ce0 1011
106344fb
PE
1012void open_edge (edge *e, FILE *fout);
1013void output_edge (edge *e, FILE *fout);
d33cb3ae 1014void close_edge (FILE *fout);
ce4d5ce0 1015
d33cb3ae 1016void open_graph (FILE *fout);
106344fb
PE
1017void output_graph (graph *g, FILE *fout);
1018void close_graph (graph *g, FILE *fout);
ce4d5ce0
AD
1019
1020#endif /* VCG_H_ */