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