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