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