]> git.saurik.com Git - bison.git/blob - src/vcg.c
* src/vcg.c (open_edge, close_edge, open_node, close_node): Change
[bison.git] / src / vcg.c
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 #include "system.h"
22 #include "xalloc.h"
23 #include "vcg.h"
24 #include "vcg_defaults.h"
25
26 /* Initialize a graph with the default values. */
27 void
28 new_graph (graph_t *g)
29 {
30 g->title = G_TITLE;
31 g->label = G_LABEL;
32
33 g->infos[0] = G_INFOS1;
34 g->infos[1] = G_INFOS2;
35 g->infos[2] = G_INFOS3;
36
37 g->color = G_COLOR;
38 g->textcolor = G_TEXTCOLOR;
39 g->bordercolor = G_BORDERCOLOR;
40
41 g->width = G_WIDTH;
42 g->height = G_HEIGHT;
43 g->borderwidth = G_BORDERWIDTH;
44 g->x = G_X;
45 g->y = G_Y;
46 g->folding = G_FOLDING;
47 g->shrink = G_SHRINK;
48 g->stretch = G_STRETCH;
49
50 g->textmode = G_TEXTMODE;
51 g->shape = G_SHAPE;
52
53 g->vertical_order = G_VERTICAL_ORDER;
54 g->horizontal_order = G_HORIZONTAL_ORDER;
55
56 g->xmax = G_XMAX; /* Not output. */
57 g->ymax = G_YMAX; /* Not output. */
58
59 g->xbase = G_XBASE;
60 g->ybase = G_YBASE;
61
62 g->xspace = G_XSPACE;
63 g->yspace = G_YSPACE;
64 g->xlspace = G_XLSPACE; /* Not output. */
65
66 g->xraster = G_XRASTER;
67 g->yraster = G_YRASTER;
68 g->xlraster = G_XLRASTER;
69
70 g->hidden = G_HIDDEN; /* No default value. */
71
72 g->classname = G_CLASSNAME; /* No class name association. */
73
74 g->layoutalgorithm = G_LAYOUTALGORITHM;
75 g->layout_downfactor = G_LAYOUT_DOWNFACTOR;
76 g->layout_upfactor = G_LAYOUT_UPFACTOR;
77 g->layout_nearfactor = G_LAYOUT_NEARFACTOR;
78 g->layout_splinefactor = G_LAYOUT_SPLINEFACTOR;
79
80 g->late_edge_labels = G_LATE_EDGE_LABELS;
81 g->display_edge_labels = G_DISPLAY_EDGE_LABELS;
82 g->dirty_edge_labels = G_DIRTY_EDGE_LABELS;
83 g->finetuning = G_FINETUNING;
84 g->ignore_singles = G_IGNORE_SINGLES;
85 g->straight_phase = G_STRAIGHT_PHASE;
86 g->priority_phase = G_PRIORITY_PHASE;
87 g->manhattan_edges = G_MANHATTAN_EDGES;
88 g->smanhattan_edges = G_SMANHATTAN_EDGES;
89 g->near_edges = G_NEAR_EDGES;
90
91 g->orientation = G_ORIENTATION;
92 g->node_alignement = G_NODE_ALIGNEMENT;
93 g->port_sharing = G_PORT_SHARING;
94 g->arrow_mode = G_ARROW_MODE;
95 g->treefactor = G_TREEFACTOR;
96 g->spreadlevel = G_SPREADLEVEL;
97 g->crossing_weight = G_CROSSING_WEIGHT;
98 g->crossing_phase2 = G_CROSSING_PHASE2;
99 g->crossing_optimization = G_CROSSING_OPTIMIZATION;
100 g->view = G_VIEW;
101
102 g->edges = G_EDGES;
103 g->nodes = G_NODES;
104 g->splines = G_SPLINES;
105
106 g->bmax = G_BMAX;
107 g->cmin = G_CMIN;
108 g->cmax = G_CMAX;
109 g->pmin = G_PMIN;
110 g->pmax = G_PMAX;
111 g->rmin = G_RMIN;
112 g->rmax = G_RMAX;
113 g->smax = G_SMAX;
114
115 g->node_list = G_NODE_LIST;
116 g->edge_list = G_EDGE_LIST;
117
118 new_edge(&g->edge);
119 new_node(&g->node);
120 }
121
122 /* Initialize a node with the defalut values. */
123 void
124 new_node (node_t *node)
125 {
126 node->title = N_TITLE;
127 node->label = N_LABEL;
128
129 node->locx = N_LOCX; /* Default unspcified. */
130 node->locy = N_LOCY; /* Default unspcified. */
131
132 node->vertical_order = N_VERTICAL_ORDER; /* Default unspcified. */
133 node->horizontal_order = N_HORIZONTAL_ORDER; /* Default unspcified. */
134
135 node->width = N_WIDTH; /* We assume that we can't define it now. */
136 node->height = N_HEIGHT; /* Also. */
137
138 node->shrink = N_SHRINK;
139 node->stretch = N_STRETCH;
140
141 node->folding = N_FOLDING; /* No explicit default value. */
142
143 node->shape = N_SHAPE;
144 node->textmode = N_TEXTMODE;
145 node->borderwidth = N_BORDERWIDTH;
146
147 node->color = N_COLOR;
148 node->textcolor = N_TEXTCOLOR;
149 node->bordercolor = N_BORDERCOLOR;
150
151 node->infos[0] = N_INFOS1;
152 node->infos[1] = N_INFOS2;
153 node->infos[2] = N_INFOS3;
154
155 node->next = N_NEXT;
156 }
157
158 /* Initialize a edge with the defalut values. */
159 void
160 new_edge (edge_t *edge)
161 {
162 edge->type = E_EDGE_TYPE;
163
164 edge->sourcename = E_SOURCENAME;
165 edge->targetname = E_TARGETNAME;
166 edge->label = E_LABEL;
167
168 edge->linestyle = E_LINESTYLE;
169 edge->thickness = E_THICKNESS;
170
171 edge->class = E_CLASS;
172
173 edge->color = E_COLOR;
174 edge->textcolor = E_TEXTCOLOR;
175 edge->arrowcolor = E_ARROWCOLOR;
176 edge->backarrowcolor = E_BACKARROWCOLOR;
177
178 edge->arrowsize = E_ARROWSIZE;
179 edge->backarrowsize = E_BACKARROWSIZE;
180 edge->arrowstyle = E_ARROWSTYLE;
181
182 edge->backarrowstyle = E_BACKARROWSTYLE;
183
184 edge->priority = E_PRIORITY;
185
186 edge->anchor = E_ANCHOR;
187
188 edge->horizontal_order = E_HORIZONTAL_ORDER;
189
190 edge->next = E_NEXT;
191 }
192
193 /*----------------------------------------------.
194 | Get functions. |
195 | Return string corresponding to an enum value. |
196 `----------------------------------------------*/
197
198 static const char *
199 get_color_str (enum color_e c)
200 {
201 switch (c)
202 {
203 case white: return "white";
204 case blue: return "blue";
205 case red: return "red";
206 case green: return "green";
207 case yellow: return "yellow";
208 case magenta: return "magenta";
209 case cyan: return "cyan";
210 case darkgrey: return "darkgrey";
211 case darkblue: return "darkblue";
212 case darkred: return "darkred";
213 case darkgreen: return "darkgreen";
214 case darkyellow: return "darkyellow";
215 case darkmagenta: return "darkmagenta";
216 case darkcyan: return "darkcyan";
217 case gold: return "gold";
218 case lightgrey: return "lightgrey";
219 case lightblue: return "lightblue";
220 case lightred: return "lightred";
221 case lightgreen: return "lightgreen";
222 case lightyellow: return "lightyellow";
223 case lightmagenta: return "lightmagenta";
224 case lightcyan: return "lightcyan";
225 case lilac: return "lilac";
226 case turquoise: return "turquoise";
227 case aquamarine: return "aquamarine";
228 case khaki: return "khaki";
229 case purple: return "purple";
230 case yellowgreen: return "yellowgreen";
231 case pink: return "pink";
232 case orange: return "orange";
233 case orchid: return "orchid";
234 case black: return "black";
235 default:
236 assert (!"Not a default color.");
237 }
238 return NULL;
239 }
240
241 static const char *
242 get_textmode_str (enum textmode_e t)
243 {
244 switch (t)
245 {
246 case centered: return "center";
247 case left_justify: return "left_justify";
248 case right_justify: return "right_justify";
249 default:
250 assert (!"Not a text mode.");
251 }
252 return NULL;
253 }
254
255 static const char *
256 get_shape_str (enum shape_e s)
257 {
258 switch (s)
259 {
260 case box: return "box";
261 case rhomb: return "rhomb";
262 case ellipse: return "ellipse";
263 case triangle: return "triangle";
264 default:
265 assert (!"Not a shape.");
266 }
267 return NULL;
268 }
269
270 static const char *
271 get_layoutalgorithm_str (enum layoutalgorithm_e l)
272 {
273 switch (l)
274 {
275 case normal: return "normal";
276 case maxdepth: return "maxdepth";
277 case mindepth: return "mindepth";
278 case maxdepthslow: return "maxdepthslow";
279 case mindepthslow: return "mindepthslow";
280 case maxdegree: return "maxdegree";
281 case mindegree: return "mindegree";
282 case maxindegree: return "maxindegree";
283 case minindegree: return "minindegree";
284 case maxoutdegree: return "maxoutdegree";
285 case minoutdegree: return "minoutdegree";
286 case minbackward: return "minbackward";
287 case dfs: return "dfs";
288 case tree: return "tree";
289 default:
290 assert (!"Not a layout algorithm.");
291 }
292 return NULL;
293 }
294
295 static const char *
296 get_decision_str (enum decision_e d)
297 {
298 switch (d)
299 {
300 case no: return "no";
301 case yes: return "yes";
302 default:
303 assert (!"Either yes nor no.");
304 }
305 return NULL;
306 }
307
308 static const char *
309 get_orientation_str (enum orientation_e o)
310 {
311 switch (o)
312 {
313 case top_to_bottom: return "top_to_bottom";
314 case bottom_to_top: return "bottom_to_top";
315 case left_to_right: return "left_to_right";
316 case right_to_left: return "right_to_left";
317 default:
318 assert (!"Not an orientation.");
319 }
320 return NULL;
321 }
322
323 static const char *
324 get_node_alignement_str (enum alignement_e a)
325 {
326 switch (a)
327 {
328 case center: return "center";
329 case top: return "top";
330 case bottom: return "bottom";
331 default:
332 assert (!"Not an alignement.");
333 }
334 return NULL;
335 }
336
337 static const char *
338 get_arrow_mode_str (enum arrow_mode_e a)
339 {
340 switch (a)
341 {
342 case fixed: return "fixed";
343 case free_a: return "free";
344 default:
345 assert (!"Not an arrow mode.");
346 }
347 return NULL;
348 }
349
350 static const char *
351 get_crossing_type_str (enum crossing_type_e c)
352 {
353 switch (c)
354 {
355 case bary: return "bary";
356 case median: return "median";
357 case barymedian: return "barymedian";
358 case medianbary: return "medianbary";
359 default:
360 assert (!"Not a crossing type.");
361 }
362 return NULL;
363 }
364
365 static const char *
366 get_view_str (enum view_e v)
367 {
368 switch (v)
369 {
370 case normal_view: return "normal_view";
371 case cfish: return "cfish";
372 case pfish: return "pfish";
373 case fcfish: return "fcfish";
374 case fpfish: return "fpfish";
375 default:
376 assert (!"Not a view.");
377 }
378 return NULL;
379 }
380
381 static const char *
382 get_linestyle_str (enum linestyle_e l)
383 {
384 switch (l)
385 {
386 case continuous: return "continuous";
387 case dashed: return "dashed";
388 case dotted: return "dotted";
389 case invisible: return "invisible";
390 default:
391 assert (!"Not a line style.");
392 }
393 return NULL;
394 }
395
396 static const char *
397 get_arrowstyle_str (enum arrowstyle_e a)
398 {
399 switch (a)
400 {
401 case solid: return "solid";
402 case line: return "line";
403 case none: return "none";
404 default:
405 assert (!"Not an arrow style.");
406 }
407 return NULL;
408 }
409
410 /*----------------------------.
411 | Add functions. |
412 | Edge and Nodes int a graph. |
413 `----------------------------*/
414
415 void
416 add_node (graph_t *graph, node_t *node)
417 {
418 node->next = graph->node_list;
419 graph->node_list = node;
420 }
421
422 void
423 add_edge (graph_t *graph, edge_t *edge)
424 {
425 edge->next = graph->edge_list;
426 graph->edge_list = edge;
427 }
428
429 void
430 add_classname (graph_t *g, int val, const char *name)
431 {
432 struct classname_s *classname;
433
434 classname = XMALLOC (struct classname_s, 1);
435 classname->no = val;
436 classname->name = name;
437 classname->next = g->classname;
438 g->classname = classname;
439 }
440
441 void
442 add_infoname (graph_t *g, int integer, const char *string)
443 {
444 struct infoname_s *infoname;
445
446 infoname = XMALLOC (struct infoname_s, 1);
447 infoname->integer = integer;
448 infoname->string = string;
449 infoname->next = g->infoname;
450 g->infoname = infoname;
451 }
452
453 /* Build a colorentry struct and add it to the list. */
454 void
455 add_colorentry (graph_t *g, int color_idx, int red_cp,
456 int green_cp, int blue_cp)
457 {
458 struct colorentry_s *ce;
459
460 ce = XMALLOC (struct colorentry_s, 1);
461 ce->color_index = color_idx;
462 ce->red_cp = red_cp;
463 ce->green_cp = green_cp;
464 ce->blue_cp = blue_cp;
465 ce->next = g->colorentry;
466 g->colorentry = ce;
467 }
468
469 /*-------------------------------------.
470 | Open and close functions (formatted) |
471 `-------------------------------------*/
472
473 void
474 open_edge(edge_t *edge, FILE *fout)
475 {
476 switch (edge->type)
477 {
478 case normal_edge:
479 fputs ("\tedge: {\n", fout);
480 break;
481 case back_edge:
482 fputs ("\tbackedge: {\n", fout);
483 break;
484 case near_edge:
485 fputs ("\tnearedge: {\n", fout);
486 break;
487 case bent_near_edge:
488 fputs ("\tbentnearedge: {\n", fout);
489 break;
490 default:
491 fputs ("\tedge: {\n", fout);
492 }
493 }
494
495 void
496 close_edge(FILE *fout)
497 {
498 fputs ("\t}\n", fout);
499 }
500
501 void
502 open_node(FILE *fout)
503 {
504 fputs ("\tnode: {\n", fout);
505 }
506
507 void
508 close_node(FILE *fout)
509 {
510 fputs ("\t}\n", fout);
511 }
512
513 void
514 open_graph(FILE *fout)
515 {
516 fputs ("graph: {\n", fout);
517 }
518
519 void
520 close_graph(graph_t *graph, FILE *fout)
521 {
522 fputc ('\n', fout);
523
524 /* FIXME: Unallocate nodes and edges if required. */
525 {
526 node_t *node;
527
528 for (node = graph->node_list; node; node = node->next)
529 {
530 open_node (fout);
531 output_node (node, fout);
532 close_node (fout);
533 }
534 }
535
536 fputc ('\n', fout);
537
538 {
539 edge_t *edge;
540
541 for (edge = graph->edge_list; edge; edge = edge->next)
542 {
543 open_edge (edge, fout);
544 output_edge (edge, fout);
545 close_edge (fout);
546 }
547 }
548
549 fputs ("}\n", fout);
550 }
551
552 /*-------------------------------------------.
553 | Output functions (formatted) in file FOUT |
554 `-------------------------------------------*/
555
556 void
557 output_node (node_t *node, FILE *fout)
558 {
559 if (node->title != N_TITLE)
560 fprintf (fout, "\t\ttitle:\t\"%s\"\n", node->title);
561 if (node->label != N_LABEL)
562 fprintf (fout, "\t\tlabel:\t\"%s\"\n", node->label);
563
564 if ((node->locx != N_LOCX) && (node->locy != N_LOCY))
565 fprintf (fout, "\t\tloc { x: %d y: %d }\t\n", node->locx, node->locy);
566
567 if (node->vertical_order != N_VERTICAL_ORDER)
568 fprintf (fout, "\t\tvertical_order:\t%d\n", node->vertical_order);
569 if (node->horizontal_order != N_HORIZONTAL_ORDER)
570 fprintf (fout, "\t\thorizontal_order:\t%d\n", node->horizontal_order);
571
572 if (node->width != N_WIDTH)
573 fprintf (fout, "\t\twidth:\t%d\n", node->width);
574 if (node->height != N_HEIGHT)
575 fprintf (fout, "\t\theight:\t%d\n", node->height);
576
577 if (node->shrink != N_SHRINK)
578 fprintf (fout, "\t\tshrink:\t%d\n", node->shrink);
579 if (node->stretch != N_STRETCH)
580 fprintf (fout, "\t\tstretch:\t%d\n", node->stretch);
581
582 if (node->folding != N_FOLDING)
583 fprintf (fout, "\t\tfolding:\t%d\n", node->folding);
584
585 if (node->textmode != N_TEXTMODE)
586 fprintf (fout, "\t\ttextmode:\t%s\n",
587 get_textmode_str (node->textmode));
588
589 if (node->shape != N_SHAPE)
590 fprintf (fout, "\t\tshape:\t%s\n", get_shape_str (node->shape));
591
592 if (node->borderwidth != N_BORDERWIDTH)
593 fprintf (fout, "\t\tborderwidth:\t%d\n", node->borderwidth);
594
595 if (node->color != N_COLOR)
596 fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (node->color));
597 if (node->textcolor != N_TEXTCOLOR)
598 fprintf (fout, "\t\ttextcolor:\t%s\n",
599 get_color_str (node->textcolor));
600 if (node->bordercolor != N_BORDERCOLOR)
601 fprintf (fout, "\t\tbordercolor:\t%s\n",
602 get_color_str (node->bordercolor));
603
604 if (node->infos[0])
605 fprintf (fout, "\t\tinfo1:\t\"%s\"\n", node->infos[0]);
606 if (node->infos[1])
607 fprintf (fout, "\t\tinfo2:\t\"%s\"\n", node->infos[1]);
608 if (node->infos[2])
609 fprintf (fout, "\t\tinfo3:\t\"%s\"\n", node->infos[2]);
610 }
611
612 void
613 output_edge (edge_t *edge, FILE *fout)
614 {
615 /* FIXME: SOURCENAME and TARGETNAME are mandatory
616 so it has to be fatal not to give these informations. */
617 if (edge->sourcename != E_SOURCENAME)
618 fprintf (fout, "\t\tsourcename:\t\"%s\"\n", edge->sourcename);
619 if (edge->targetname != E_TARGETNAME)
620 fprintf (fout, "\t\ttargetname:\t\"%s\"\n", edge->targetname);
621
622 if (edge->label != E_LABEL)
623 fprintf (fout, "\t\tlabel:\t\"%s\"\n", edge->label);
624
625 if (edge->linestyle != E_LINESTYLE)
626 fprintf (fout, "\t\tlinestyle:\t\"%s\"\n",
627 get_linestyle_str(edge->linestyle));
628
629 if (edge->thickness != E_THICKNESS)
630 fprintf (fout, "\t\tthickness:\t%d\n", edge->thickness);
631 if (edge->class != E_CLASS)
632 fprintf (fout, "\t\tclass:\t%d\n", edge->class);
633
634 if (edge->color != E_COLOR)
635 fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (edge->color));
636 if (edge->color != E_TEXTCOLOR)
637 fprintf (fout, "\t\ttextcolor:\t%s\n",
638 get_color_str (edge->textcolor));
639 if (edge->arrowcolor != E_ARROWCOLOR)
640 fprintf (fout, "\t\tarrowcolor:\t%s\n",
641 get_color_str (edge->arrowcolor));
642 if (edge->backarrowcolor != E_BACKARROWCOLOR)
643 fprintf (fout, "\t\tbackarrowcolor:\t%s\n",
644 get_color_str (edge->backarrowcolor));
645
646 if (edge->arrowsize != E_ARROWSIZE)
647 fprintf (fout, "\t\tarrowsize:\t%d\n", edge->arrowsize);
648 if (edge->backarrowsize != E_BACKARROWSIZE)
649 fprintf (fout, "\t\tbackarrowsize:\t%d\n", edge->backarrowsize);
650
651 if (edge->arrowstyle != E_ARROWSTYLE)
652 fprintf (fout, "\t\tarrowstyle:\t%s\n",
653 get_arrowstyle_str(edge->arrowstyle));
654 if (edge->backarrowstyle != E_BACKARROWSTYLE)
655 fprintf (fout, "\t\tbackarrowstyle:\t%s\n",
656 get_arrowstyle_str(edge->backarrowstyle));
657
658 if (edge->priority != E_PRIORITY)
659 fprintf (fout, "\t\tpriority:\t%d\n", edge->priority);
660 if (edge->anchor != E_ANCHOR)
661 fprintf (fout, "\t\tanchor:\t%d\n", edge->anchor);
662 if (edge->horizontal_order != E_HORIZONTAL_ORDER)
663 fprintf (fout, "\t\thorizontal_order:\t%d\n", edge->horizontal_order);
664 }
665
666 void
667 output_graph (graph_t *graph, FILE *fout)
668 {
669 if (graph->title)
670 fprintf (fout, "\ttitle:\t\"%s\"\n", graph->title);
671 if (graph->label)
672 fprintf (fout, "\tlabel:\t\"%s\"\n", graph->label);
673
674 if (graph->infos[0])
675 fprintf (fout, "\tinfo1:\t\"%s\"\n", graph->infos[0]);
676 if (graph->infos[1])
677 fprintf (fout, "\tinfo2:\t\"%s\"\n", graph->infos[1]);
678 if (graph->infos[2])
679 fprintf (fout, "\tinfo3:\t\"%s\"\n", graph->infos[2]);
680
681 if (graph->color != G_COLOR)
682 fprintf (fout, "\tcolor:\t%s\n", get_color_str (graph->color));
683 if (graph->textcolor != G_TEXTCOLOR)
684 fprintf (fout, "\ttextcolor:\t%s\n", get_color_str (graph->textcolor));
685 if (graph->bordercolor != G_BORDERCOLOR)
686 fprintf (fout, "\tbordercolor:\t%s\n",
687 get_color_str (graph->bordercolor));
688
689 if (graph->width != G_WIDTH)
690 fprintf (fout, "\twidth:\t%d\n", graph->width);
691 if (graph->height != G_HEIGHT)
692 fprintf (fout, "\theight:\t%d\n", graph->height);
693 if (graph->borderwidth != G_BORDERWIDTH)
694 fprintf (fout, "\tborderwidth:\t%d\n", graph->borderwidth);
695
696 if (graph->x != G_X)
697 fprintf (fout, "\tx:\t%d\n", graph->x);
698 if (graph->y != G_Y)
699 fprintf (fout, "\ty:\t%d\n", graph->y);
700
701 if (graph->folding != G_FOLDING)
702 fprintf (fout, "\tfolding:\t%d\n", graph->folding);
703
704 if (graph->shrink != G_SHRINK)
705 fprintf (fout, "\tshrink:\t%d\n", graph->shrink);
706 if (graph->stretch != G_STRETCH)
707 fprintf (fout, "\tstretch:\t%d\n", graph->stretch);
708
709 if (graph->textmode != G_TEXTMODE)
710 fprintf (fout, "\ttextmode:\t%s\n",
711 get_textmode_str (graph->textmode));
712
713 if (graph->shape != G_SHAPE)
714 fprintf (fout, "\tshape:\t%s\n", get_shape_str (graph->shape));
715
716 if (graph->vertical_order != G_VERTICAL_ORDER)
717 fprintf (fout, "\tvertical_order:\t%d\n", graph->vertical_order);
718 if (graph->horizontal_order != G_HORIZONTAL_ORDER)
719 fprintf (fout, "\thorizontal_order:\t%d\n", graph->horizontal_order);
720
721 if (graph->xmax != G_XMAX)
722 fprintf (fout, "\txmax:\t%d\n", graph->xmax);
723 if (graph->ymax != G_YMAX)
724 fprintf (fout, "\tymax:\t%d\n", graph->ymax);
725
726 if (graph->xbase != G_XBASE)
727 fprintf (fout, "\txbase:\t%d\n", graph->xbase);
728 if (graph->ybase != G_YBASE)
729 fprintf (fout, "\tybase:\t%d\n", graph->ybase);
730
731 if (graph->xspace != G_XSPACE)
732 fprintf (fout, "\txspace:\t%d\n", graph->xspace);
733 if (graph->yspace != G_YSPACE)
734 fprintf (fout, "\tyspace:\t%d\n", graph->yspace);
735 if (graph->xlspace != G_XLSPACE)
736 fprintf (fout, "\txlspace:\t%d\n", graph->xlspace);
737
738 if (graph->xraster != G_XRASTER)
739 fprintf (fout, "\txraster:\t%d\n", graph->xraster);
740 if (graph->yraster != G_YRASTER)
741 fprintf (fout, "\tyraster:\t%d\n", graph->yraster);
742 if (graph->xlraster != G_XLRASTER)
743 fprintf (fout, "\txlraster:\t%d\n", graph->xlraster);
744
745 if (graph->hidden != G_HIDDEN)
746 fprintf (fout, "\thidden:\t%d\n", graph->hidden);
747
748 /* FIXME: Unallocate struct list if required.
749 Maybe with a little function. */
750 if (graph->classname != G_CLASSNAME)
751 {
752 struct classname_s *ite;
753
754 for (ite = graph->classname; ite; ite = ite->next)
755 fprintf (fout, "\tclassname %d :\t%s\n", ite->no, ite->name);
756 }
757
758 if (graph->infoname != G_INFONAME)
759 {
760 struct infoname_s *ite;
761
762 for (ite = graph->infoname; ite; ite = ite->next)
763 fprintf (fout, "\tinfoname %d :\t%s\n", ite->integer, ite->string);
764 }
765
766 if (graph->colorentry != G_COLORENTRY)
767 {
768 struct colorentry_s *ite;
769
770 for (ite = graph->colorentry; ite; ite = ite->next)
771 {
772 fprintf (fout, "\tcolorentry %d :\t%d %d %d\n",
773 ite->color_index,
774 ite->red_cp,
775 ite->green_cp,
776 ite->blue_cp);
777 }
778 }
779
780 if (graph->layoutalgorithm != G_LAYOUTALGORITHM)
781 fprintf (fout, "\tlayoutalgorithm:\t%s\n",
782 get_layoutalgorithm_str(graph->layoutalgorithm));
783
784 if (graph->layout_downfactor != G_LAYOUT_DOWNFACTOR)
785 fprintf (fout, "\tlayout_downfactor:\t%d\n", graph->layout_downfactor);
786 if (graph->layout_upfactor != G_LAYOUT_UPFACTOR)
787 fprintf (fout, "\tlayout_upfactor:\t%d\n", graph->layout_upfactor);
788 if (graph->layout_nearfactor != G_LAYOUT_NEARFACTOR)
789 fprintf (fout, "\tlayout_nearfactor:\t%d\n", graph->layout_nearfactor);
790 if (graph->layout_splinefactor != G_LAYOUT_SPLINEFACTOR)
791 fprintf (fout, "\tlayout_splinefactor:\t%d\n",
792 graph->layout_splinefactor);
793
794 if (graph->late_edge_labels != G_LATE_EDGE_LABELS)
795 fprintf (fout, "\tlate_edge_labels:\t%s\n",
796 get_decision_str(graph->late_edge_labels));
797 if (graph->display_edge_labels != G_DISPLAY_EDGE_LABELS)
798 fprintf (fout, "\tdisplay_edge_labels:\t%s\n",
799 get_decision_str(graph->display_edge_labels));
800 if (graph->dirty_edge_labels != G_DIRTY_EDGE_LABELS)
801 fprintf (fout, "\tdirty_edge_labels:\t%s\n",
802 get_decision_str(graph->dirty_edge_labels));
803 if (graph->finetuning != G_FINETUNING)
804 fprintf (fout, "\tfinetuning:\t%s\n",
805 get_decision_str(graph->finetuning));
806 if (graph->ignore_singles != G_IGNORE_SINGLES)
807 fprintf (fout, "\tignore_singles:\t%s\n",
808 get_decision_str(graph->ignore_singles));
809 if (graph->straight_phase != G_STRAIGHT_PHASE)
810 fprintf (fout, "\tstraight_phase:\t%s\n",
811 get_decision_str(graph->straight_phase));
812 if (graph->priority_phase != G_PRIORITY_PHASE)
813 fprintf (fout, "\tpriority_phase:\t%s\n",
814 get_decision_str(graph->priority_phase));
815 if (graph->manhattan_edges != G_MANHATTAN_EDGES)
816 fprintf (fout,
817 "\tmanhattan_edges:\t%s\n",
818 get_decision_str(graph->manhattan_edges));
819 if (graph->smanhattan_edges != G_SMANHATTAN_EDGES)
820 fprintf (fout,
821 "\tsmanhattan_edges:\t%s\n",
822 get_decision_str(graph->smanhattan_edges));
823 if (graph->near_edges != G_NEAR_EDGES)
824 fprintf (fout, "\tnear_edges:\t%s\n",
825 get_decision_str(graph->near_edges));
826
827 if (graph->orientation != G_ORIENTATION)
828 fprintf (fout, "\torientation:\t%s\n",
829 get_orientation_str(graph->orientation));
830
831 if (graph->node_alignement != G_NODE_ALIGNEMENT)
832 fprintf (fout, "\tnode_alignement:\t%s\n",
833 get_node_alignement_str(graph->node_alignement));
834
835 if (graph->port_sharing != G_PORT_SHARING)
836 fprintf (fout, "\tport_sharing:\t%s\n",
837 get_decision_str(graph->port_sharing));
838
839 if (graph->arrow_mode != G_ARROW_MODE)
840 fprintf (fout, "\tarrow_mode:\t%s\n",
841 get_arrow_mode_str(graph->arrow_mode));
842
843 if (graph->treefactor != G_TREEFACTOR)
844 fprintf (fout, "\ttreefactor:\t%f\n", graph->treefactor);
845 if (graph->spreadlevel != G_SPREADLEVEL)
846 fprintf (fout, "\tspreadlevel:\t%d\n", graph->spreadlevel);
847
848 if (graph->crossing_weight != G_CROSSING_WEIGHT)
849 fprintf (fout, "\tcrossing_weight:\t%s\n",
850 get_crossing_type_str(graph->crossing_weight));
851 if (graph->crossing_phase2 != G_CROSSING_PHASE2)
852 fprintf (fout, "\tcrossing_phase2:\t%s\n",
853 get_decision_str(graph->crossing_phase2));
854 if (graph->crossing_optimization != G_CROSSING_OPTIMIZATION)
855 fprintf (fout, "\tcrossing_optimization:\t%s\n",
856 get_decision_str(graph->crossing_optimization));
857
858 if (graph->view != G_VIEW)
859 fprintf (fout, "\tview:\t%s\n", get_view_str(graph->view));
860
861 if (graph->edges != G_EDGES)
862 fprintf (fout, "\tedges:\t%s\n", get_decision_str(graph->edges));
863
864 if (graph->nodes != G_NODES)
865 fprintf (fout,"\tnodes:\t%s\n", get_decision_str(graph->nodes));
866
867 if (graph->splines != G_SPLINES)
868 fprintf (fout, "\tsplines:\t%s\n", get_decision_str(graph->splines));
869
870 if (graph->bmax != G_BMAX)
871 fprintf (fout, "\tbmax:\t%d\n", graph->bmax);
872 if (graph->cmin != G_CMIN)
873 fprintf (fout, "\tcmin:\t%d\n", graph->cmin);
874 if (graph->cmax != G_CMAX)
875 fprintf (fout, "\tcmax:\t%d\n", graph->cmax);
876 if (graph->pmin != G_PMIN)
877 fprintf (fout, "\tpmin:\t%d\n", graph->pmin);
878 if (graph->pmax != G_PMAX)
879 fprintf (fout, "\tpmax:\t%d\n", graph->pmax);
880 if (graph->rmin != G_RMIN)
881 fprintf (fout, "\trmin:\t%d\n", graph->rmin);
882 if (graph->rmax != G_RMAX)
883 fprintf (fout, "\trmax:\t%d\n", graph->rmax);
884 if (graph->smax != G_SMAX)
885 fprintf (fout, "\tsmax:\t%d\n", graph->smax);
886 }