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