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