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