]> git.saurik.com Git - bison.git/blame - src/vcg.h
Regenerate.
[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
fc8f2965
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
342b8b6e
AD
584 calculated. */
585 int vertical_order;
586
fc8f2965
AD
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
342b8b6e
AD
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
fc8f2965
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.
342b8b6e 670 The default value is NULL. */
106344fb 671 struct infoname *infoname;
fc8f2965
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
342b8b6e
AD
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
c4b66126
AD
761 /* priority phase yes replaces the normal pendulum method by a
762 specialized method: It forces straight long edges with 90 degree,
763 just as the straight phase. In fact, the straight phase is a fine
764 tune phase of the priority method. This phase is also recommended,
765 if an orthogonal layout is selected (see manhattan.edges).
ce4d5ce0 766 Default is no. */
106344fb 767 enum decision priority_phase;
ce4d5ce0 768
c4b66126
AD
769 /* manhattan edges yes switches the orthogonal layout on. Orthogonal
770 layout (or manhattan layout) means that all edges consist of line
771 segments with gradient 0 or 90 degree. Vertical edge segments might
772 by shared by several edges, while horizontal edge segments are never
ce4d5ce0 773 shared. This results in very aesthetical layouts just for flowcharts.
c4b66126
AD
774 If the orthogonal layout is used, then the priority phase and
775 straight phase should be used. Thus, these both phases are switched
776 on, too, unless priority layout and straight line tuning are
ce4d5ce0
AD
777 switched off explicitly.
778 Default is no. */
106344fb 779 enum decision manhattan_edges;
ce4d5ce0 780
c4b66126
AD
781 /* Smanhattan edges yes switches a specialized orthogonal layout on:
782 Here, all horizontal edge segments between two levels share the same
783 horizontal line, i.e. not only vertical edge segments are shared,
784 but horizontal edge segments are shared by several edges, too. This
785 looks nice for trees but might be too confusing in general, because
ce4d5ce0
AD
786 the location of an edge might be ambiguously.
787 Default is no. */
106344fb 788 enum decision smanhattan_edges;
c4b66126
AD
789
790 /* Near edges no suppresses near edges and bent near edges in the
ce4d5ce0
AD
791 graph layout.
792 Default is yes. */
106344fb 793 enum decision near_edges;
c4b66126
AD
794
795 /* Orientation specifies the orientation of the graph: top.to.bottom,
796 bottom.to.top, left.to.right or right.to.left. Note: the normal
797 orientation is top.to.bottom. All explanations here are given
798 relatively to the normal orientation, i.e., e.g., if the orientation
799 is left to right, the attribute xlspace is not the horizontal but
ce4d5ce0
AD
800 the vertical distance between lines, etc.
801 Default is to_to_bottom. */
106344fb 802 enum orientation orientation;
ce4d5ce0 803
c4b66126
AD
804 /* Node alignment specified the vertical alignment of nodes at the
805 horizontal reference line of the levels. If top is specified, the
806 tops of all nodes of a level have the same y-coordinate; on bottom,
807 the bottoms have the same y-coordinate, on center the nodes are
ce4d5ce0
AD
808 centered at the levels.
809 Default is center. */
106344fb 810 enum alignment node_alignment;
ce4d5ce0 811
c4b66126
AD
812 /* Port sharing no suppresses the sharing of ports of edges at the
813 nodes. Normally, if multiple edges are adjacent to the same node,
814 and the arrow head of all these edges has the same visual appearance
815 (color, size, etc.), then these edges may share a port at a node,
816 i.e. only one arrow head is draw, and all edges are incoming into
817 this arrow head. This allows to have many edges adjacent to one node
818 without getting confused by too many arrow heads. If no port sharing
819 is used, each edge has its own port, i.e. its own place where it is
ce4d5ce0
AD
820 adjacent to the node.
821 Default is yes. */
106344fb 822 enum decision port_sharing;
ce4d5ce0 823
c4b66126
AD
824 /* Arrow mode fixed (default) should be used, if port sharing is used,
825 because then, only a fixed set of rotations for the arrow heads are
826 used. If the arrow mode is free, then each arrow head is rotated
827 individually to each edge. But this can yield to a black spot, where
828 nothing is recognizable, if port sharing is used, since all these
829 qdifferently rotated arrow heads are drawn at the same place. If the
830 arrow mode is fixed, then the arrow head is rotated only in steps of
ce4d5ce0 831 45 degree, and only one arrow head occurs at each port.
c4b66126 832 Default is fixed. */
106344fb 833 enum arrow_mode arrow_mode;
ce4d5ce0 834
c4b66126
AD
835 /* Treefactor The algorithm tree for downward laid out trees tries to
836 produce a medium dense, balanced tree-like layout. If the tree
837 factor is greater than 0.5, the tree edges are spread, i.e. they
838 get a larger gradient. This may improve the readability of the tree.
839 Note: it is not obvious whether spreading results in a more dense or
840 wide layout. For a tree, there is a tree factor such that the whole
ce4d5ce0
AD
841 tree is minimal wide.
842 Default is 0.5. */
843 float treefactor;
844
c4b66126
AD
845 /* Spreadlevel This parameter only influences the algorithm tree, too.
846 For large, balanced trees, spreading of the uppermost nodes would
847 enlarge the width of the tree too much, such that the tree does not
848 fit anymore in a window. Thus, the spreadlevel specifies the minimal
849 level (rank) where nodes are spread. Nodes of levels upper than
ce4d5ce0
AD
850 spreadlevel are not spread.
851 Default is 1. */
852 int spreadlevel;
853
c4b66126
AD
854 /* Crossing weight specifies the weight that is used for the crossing
855 reduction: bary (default), median, barymedian or medianbary. We
856 cannot give a general recommendation, which is the best method. For
857 graphs with very large average degree of edges (number of incoming
858 and outgoing edges at a node), the weight bary is the fastest
859 method. With the weights barymedian and medianbary, equal weights of
860 different nodes are not very probable, thus the crossing reduction
ce4d5ce0
AD
861 phase 2 might be very fast.
862 Default is bary. */
106344fb 863 enum crossing_type crossing_weight;
ce4d5ce0 864
c4b66126
AD
865 /* Crossing phase2 is the most time consuming phase of the crossing
866 reduction. In this phase, the nodes that happen to have equal
867 crossing weights are permuted. By specifying no, this phase is
ce4d5ce0
AD
868 suppressed.
869 Default is yes. */
106344fb 870 enum decision crossing_phase2;
ce4d5ce0 871
c4b66126
AD
872 /* Crossing optimization is a postprocessing phase after the normal
873 crossing reduction: we try to optimize locally, by exchanging pairs
874 of nodes to reduce the crossings. Although this phase is not very
ce4d5ce0
AD
875 time consuming, it can be suppressed by specifying no.
876 Default is yes. */
106344fb 877 enum decision crossing_optimization;
ce4d5ce0 878
c4b66126
AD
879 /* View allows to select the fisheye views. Because
880 of the fixed size of the window that shows the graph, we normally
881 can only see a small amount of a large graph. If we shrink the graph
882 such that it fits into the window, we cannot recognize any detail
883 anymore. Fisheye views are coordinate transformations: the view onto
884 the graph is distort, to overcome this usage deficiency. The polar
885 fisheye is easy to explain: assume a projection of the plane that
886 contains the graph picture onto a spheric ball. If we now look onto
887 this ball in 3 D, we have a polar fisheye view. There is a focus
888 point which is magnified such that we see all details. Parts of the
889 plane that are far away from the focus point are demagnified very
890 much. Cartesian fisheye have a similar effect; only the formula for
891 the coordinate transformation is different. Selecting cfish means
892 the cartesian fisheye is used which demagnifies such that the whole
893 graph is visible (self adaptable cartesian fisheye). With fcfish,
894 the cartesian fisheye shows the region of a fixed radius around the
895 focus point (fixed radius cartesian fisheye). This region might be
896 smaller than the whole graph, but the demagnification needed to show
897 this region in the window is also not so large, thus more details
898 are recognizable. With pfish the self adaptable polar fisheye is
899 selected that shows the whole graph, and with fpfish the fixed
ce4d5ce0 900 radius polar fisheye is selected.
177d84c0 901 Default is normal view. */
106344fb 902 enum view view;
ce4d5ce0
AD
903
904 /* Edges no suppresses the drawing of edges.
905 Default is yes. */
106344fb 906 enum decision edges;
c4b66126 907
ce4d5ce0
AD
908 /* Nodes no suppresses the drawing of nodes.
909 Default is yes. */
106344fb 910 enum decision nodes;
ce4d5ce0
AD
911
912 /* Splines specifies whether splines are used to draw edges (yes or no).
c4b66126
AD
913 As default, polygon segments are used to draw edges, because this is
914 much faster. Note that the spline drawing routine is not fully
915 validated, and is very slow. Its use is mainly to prepare high
916 quality PostScript output for very small graphs.
ce4d5ce0 917 Default is no. */
106344fb 918 enum decision splines;
ce4d5ce0 919
c4b66126 920 /* Bmax set the maximal number of iterations that are done for the
ce4d5ce0
AD
921 reduction of edge bendings.
922 Default is 100. */
923 int bmax;
924
c4b66126
AD
925 /* Cmin set the minimal number of iterations that are done for the
926 crossing reduction with the crossing weights. The normal method
927 stops if two consecutive checks does not reduce the number of
928 crossings anymore. However, this increasing of the number of
929 crossings might be locally, such that after some more iterations,
ce4d5ce0
AD
930 the crossing number might decrease much more.
931 Default is 0. */
932 int cmin;
c4b66126
AD
933
934 /* Cmax set the maximal number of interactions for crossing reduction.
ce4d5ce0
AD
935 This is helpful for speedup the layout process.
936 Default is infinite. */
937 int cmax;
c4b66126
AD
938
939 /* Pmin set the minimal number of iterations that is done with the
940 pendulum method. Similar to the crossing reduction, this method
941 stops if the `imbalancement weight' does not decreases anymore.
ce4d5ce0 942 However, the increasing of the imbalancement weight might be locally,
c4b66126 943 such that after some more iterations, the imbalancement weight might
ce4d5ce0
AD
944 decrease much more.
945 Default is 0. */
946 int pmin;
c4b66126
AD
947
948 /* Pmax set the maximal number of iterations of the pendulum method.
ce4d5ce0
AD
949 This is helpful for speedup the layout process.
950 Default is 100. */
951 int pmax;
c4b66126
AD
952
953 /* Rmin set the minimal number of iterations that is done with the
ce4d5ce0
AD
954 rubberband method. This is similar as for the pendulum method.
955 Default is 0. */
956 int rmin;
c4b66126
AD
957
958 /* Rmax set the maximal number of iterations of the rubberband method.
ce4d5ce0
AD
959 This is helpful for speedup the layout process.
960 Default is 100. */
961 int rmax;
962
c4b66126
AD
963 /* Smax set the maximal number of iterations of the straight line
964 recognition phase (useful only, if the straight line recognition
ce4d5ce0
AD
965 phase is switched on, see attribute straight.phase).
966 Default is 100. */
967 int smax;
968
969 /* Generic values.
970 */
106344fb
PE
971 node node;
972 edge edge;
ce4d5ce0
AD
973
974 /* List of nodes declared.
975 Pointer. */
106344fb 976 node *node_list;
c4b66126 977
ce4d5ce0
AD
978 /* List of edges declared.
979 Pointer. */
106344fb 980 edge *edge_list;
c4b66126 981
ce4d5ce0
AD
982};
983
984/* Graph typedefs. */
106344fb 985typedef struct graph graph;
ce4d5ce0 986
106344fb
PE
987void new_graph (graph *g);
988void new_node (node *n);
989void new_edge (edge *e);
ce4d5ce0 990
106344fb
PE
991void add_node (graph *g, node *n);
992void add_edge (graph *g, edge *e);
ce4d5ce0 993
fc8f2965 994void add_colorentry (graph *g, int color_idx, int red_cp,
d33cb3ae 995 int green_cp, int blue_cp);
106344fb
PE
996void add_classname (graph *g, int val, const char *name);
997void add_infoname (graph *g, int val, const char *name);
342b8b6e 998
d33cb3ae 999void open_node (FILE *fout);
106344fb 1000void output_node (node *n, FILE *fout);
d33cb3ae 1001void close_node (FILE *fout);
ce4d5ce0 1002
106344fb
PE
1003void open_edge (edge *e, FILE *fout);
1004void output_edge (edge *e, FILE *fout);
d33cb3ae 1005void close_edge (FILE *fout);
ce4d5ce0 1006
d33cb3ae 1007void open_graph (FILE *fout);
106344fb
PE
1008void output_graph (graph *g, FILE *fout);
1009void close_graph (graph *g, FILE *fout);
ce4d5ce0
AD
1010
1011#endif /* VCG_H_ */