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