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