1 /* VCG description handler for Bison. 
   3    Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. 
   5    This file is part of Bison, the GNU Compiler Compiler. 
   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) 
  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. 
  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.  */ 
  27 #include "vcg_defaults.h" 
  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. 
  34 quote (char const *name
) 
  36   return quotearg_n_style (2, c_quoting_style
, name
); 
  40 /* Initialize a graph with the default values. */ 
  47   g
->infos
[0] = G_INFOS1
; 
  48   g
->infos
[1] = G_INFOS2
; 
  49   g
->infos
[2] = G_INFOS3
; 
  52   g
->textcolor 
= G_TEXTCOLOR
; 
  53   g
->bordercolor 
= G_BORDERCOLOR
; 
  57   g
->borderwidth 
= G_BORDERWIDTH
; 
  60   g
->folding 
= G_FOLDING
; 
  64   g
->textmode 
= G_TEXTMODE
; 
  67   g
->vertical_order 
= G_VERTICAL_ORDER
; 
  68   g
->horizontal_order 
= G_HORIZONTAL_ORDER
; 
  70   g
->xmax 
= G_XMAX
; /* Not output. */ 
  71   g
->ymax 
= G_YMAX
; /* Not output. */ 
  78   g
->xlspace 
= G_XLSPACE
; /* Not output. */ 
  80   g
->xraster 
= G_XRASTER
; 
  81   g
->yraster 
= G_YRASTER
; 
  82   g
->xlraster 
= G_XLRASTER
; 
  84   g
->hidden 
= G_HIDDEN
; /* No default value. */ 
  86   g
->classname 
= G_CLASSNAME
; /* No class name association. */ 
  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
; 
  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
; 
 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
; 
 118   g
->splines 
= G_SPLINES
; 
 129   g
->node_list 
= G_NODE_LIST
; 
 130   g
->edge_list 
= G_EDGE_LIST
; 
 136 /* Initialize a node with the default values. */ 
 143   n
->locx 
= N_LOCX
; /* Default unspcified. */ 
 144   n
->locy 
= N_LOCY
; /* Default unspcified. */ 
 146   n
->vertical_order 
= N_VERTICAL_ORDER
; /* Default unspcified. */ 
 147   n
->horizontal_order 
= N_HORIZONTAL_ORDER
;     /* Default unspcified. */ 
 149   n
->width 
= N_WIDTH
; /* We assume that we can't define it now. */ 
 150   n
->height 
= N_HEIGHT
; /* Also. */ 
 152   n
->shrink 
= N_SHRINK
; 
 153   n
->expand 
= N_EXPAND
; 
 155   n
->folding 
= N_FOLDING
; /* No explicit default value. */ 
 158   n
->textmode 
= N_TEXTMODE
; 
 159   n
->borderwidth 
= N_BORDERWIDTH
; 
 162   n
->textcolor 
= N_TEXTCOLOR
; 
 163   n
->bordercolor 
= N_BORDERCOLOR
; 
 165   n
->infos
[0] = N_INFOS1
; 
 166   n
->infos
[1] = N_INFOS2
; 
 167   n
->infos
[2] = N_INFOS3
; 
 172 /* Initialize an edge with the default values. */ 
 176   e
->type 
= E_EDGE_TYPE
; 
 178   e
->sourcename 
= E_SOURCENAME
; 
 179   e
->targetname 
= E_TARGETNAME
; 
 182   e
->linestyle 
= E_LINESTYLE
; 
 183   e
->thickness 
= E_THICKNESS
; 
 188   e
->textcolor 
= E_TEXTCOLOR
; 
 189   e
->arrowcolor 
= E_ARROWCOLOR
; 
 190   e
->backarrowcolor 
= E_BACKARROWCOLOR
; 
 192   e
->arrowsize 
= E_ARROWSIZE
; 
 193   e
->backarrowsize 
= E_BACKARROWSIZE
; 
 194   e
->arrowstyle 
= E_ARROWSTYLE
; 
 196   e
->backarrowstyle 
= E_BACKARROWSTYLE
; 
 198   e
->priority 
= E_PRIORITY
; 
 200   e
->anchor 
= E_ANCHOR
; 
 202   e
->horizontal_order 
= E_HORIZONTAL_ORDER
; 
 207 /*----------------------------------------------. 
 209 | Return string corresponding to an enum value. | 
 210 `----------------------------------------------*/ 
 213 get_color_str (enum color color
) 
 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
; 
 254 get_textmode_str (enum textmode textmode
) 
 258     case centered
:      return "center"; 
 259     case left_justify
:  return "left_justify"; 
 260     case right_justify
: return "right_justify"; 
 261     default:            abort (); return NULL
; 
 266 get_shape_str (enum shape shape
) 
 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
; 
 279 get_layoutalgorithm_str (enum layoutalgorithm layoutalgorithm
) 
 281   switch (layoutalgorithm
) 
 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
; 
 302 get_decision_str (enum decision decision
) 
 306     case no
:    return "no"; 
 307     case yes
:   return "yes"; 
 308     default:    abort (); return NULL
; 
 313 get_orientation_str (enum orientation orientation
) 
 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
; 
 326 get_node_alignment_str (enum alignment alignment
) 
 330     case center
:        return "center"; 
 331     case top
:           return "top"; 
 332     case bottom
:        return "bottom"; 
 333     default:            abort (); return NULL
; 
 338 get_arrow_mode_str (enum arrow_mode arrow_mode
) 
 342     case fixed
:         return "fixed"; 
 343     case free_a
:        return "free"; 
 344     default:            abort (); return NULL
; 
 349 get_crossing_type_str (enum crossing_type crossing_type
) 
 351   switch (crossing_type
) 
 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
; 
 362 get_view_str (enum view view
) 
 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
; 
 376 get_linestyle_str (enum linestyle linestyle
) 
 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
; 
 389 get_arrowstyle_str (enum arrowstyle arrowstyle
) 
 393     case solid
: return "solid"; 
 394     case line
:  return "line"; 
 395     case none
:  return "none"; 
 396     default:    abort (); return NULL
; 
 400 /*------------------------------. 
 402 | Edge and nodes into a graph.  | 
 403 `------------------------------*/ 
 406 add_node (graph 
*g
, node 
*n
) 
 408   n
->next 
= g
->node_list
; 
 413 add_edge (graph 
*g
, edge 
*e
) 
 415   e
->next 
= g
->edge_list
; 
 420 add_classname (graph 
*g
, int val
, const char *name
) 
 422   struct classname 
*classname
; 
 424   MALLOC (classname
, 1); 
 426   classname
->name 
= name
; 
 427   classname
->next 
= g
->classname
; 
 428   g
->classname 
= classname
; 
 432 add_infoname (graph 
*g
, int integer
, const char *str
) 
 434   struct infoname 
*infoname
; 
 436   MALLOC (infoname
, 1); 
 437   infoname
->integer 
= integer
; 
 438   infoname
->chars 
= str
; 
 439   infoname
->next 
= g
->infoname
; 
 440   g
->infoname 
= infoname
; 
 443 /* Build a colorentry struct and add it to the list.  */ 
 445 add_colorentry (graph 
*g
, int color_idx
, int red_cp
, 
 446                 int green_cp
, int blue_cp
) 
 448   struct colorentry 
*ce
; 
 451   ce
->color_index 
= color_idx
; 
 453   ce
->green_cp 
= green_cp
; 
 454   ce
->blue_cp 
= blue_cp
; 
 455   ce
->next 
= g
->colorentry
; 
 459 /*-------------------------------------. 
 460 | Open and close functions (formatted) | 
 461 `-------------------------------------*/ 
 464 open_edge (edge 
*e
, FILE *fout
) 
 469       fputs ("\tedge: {\n", fout
); 
 472       fputs ("\tbackedge: {\n", fout
); 
 475       fputs ("\tnearedge: {\n", fout
); 
 478       fputs ("\tbentnearedge: {\n", fout
); 
 481       fputs ("\tedge: {\n", fout
); 
 486 close_edge (FILE *fout
) 
 488   fputs ("\t}\n", fout
); 
 492 open_node (FILE *fout
) 
 494   fputs ("\tnode: {\n", fout
); 
 498 close_node (FILE *fout
) 
 500   fputs ("\t}\n", fout
); 
 504 open_graph (FILE *fout
) 
 506   fputs ("graph: {\n", fout
); 
 510 close_graph (graph 
*g
, FILE *fout
) 
 514   /* FIXME: Unallocate nodes and edges if required.  */ 
 518     for (n 
= g
->node_list
; n
; n 
= n
->next
) 
 521         output_node (n
, fout
); 
 531     for (e 
= g
->edge_list
; e
; e 
= e
->next
) 
 534         output_edge (e
, fout
); 
 542 /*-------------------------------------------. 
 543 | Output functions (formatted) in file FOUT  | 
 544 `-------------------------------------------*/ 
 547 output_node (node 
*n
, FILE *fout
) 
 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
)); 
 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
); 
 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
); 
 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
); 
 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
); 
 572   if (n
->folding 
!= N_FOLDING
) 
 573     fprintf (fout
, "\t\tfolding:\t%d\n", n
->folding
); 
 575   if (n
->textmode 
!= N_TEXTMODE
) 
 576     fprintf (fout
, "\t\ttextmode:\t%s\n", 
 577              get_textmode_str (n
->textmode
)); 
 579   if (n
->shape 
!= N_SHAPE
) 
 580     fprintf (fout
, "\t\tshape:\t%s\n", get_shape_str (n
->shape
)); 
 582   if (n
->borderwidth 
!= N_BORDERWIDTH
) 
 583     fprintf (fout
, "\t\tborderwidth:\t%d\n", n
->borderwidth
); 
 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
)); 
 596     for (i 
= 0; i 
< 3; ++i
) 
 598         fprintf (fout
, "\t\tinfo%d:\t%s\n", 
 599                  i
, quote (n
->infos
[i
])); 
 604 output_edge (edge 
*e
, FILE *fout
) 
 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
)); 
 613   if (e
->label 
!= E_LABEL
) 
 614     fprintf (fout
, "\t\tlabel:\t%s\n", quote (e
->label
)); 
 616   if (e
->linestyle 
!= E_LINESTYLE
) 
 617     fprintf (fout
, "\t\tlinestyle:\t%s\n", 
 618              quote (get_linestyle_str (e
->linestyle
))); 
 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); 
 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
)); 
 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
); 
 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
)); 
 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
); 
 658 output_graph (graph 
*g
, FILE *fout
) 
 661     fprintf (fout
, "\ttitle:\t%s\n", quote (g
->title
)); 
 663     fprintf (fout
, "\tlabel:\t%s\n", quote (g
->label
)); 
 667     for (i 
= 0; i 
< 3; ++i
) 
 669         fprintf (fout
, "\tinfo%d:\t%s\n", i
, quote (g
->infos
[i
])); 
 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
)); 
 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
); 
 688     fprintf (fout
, "\tx:\t%d\n", g
->x
); 
 690     fprintf (fout
, "\ty:\t%d\n", g
->y
); 
 692   if (g
->folding 
!= G_FOLDING
) 
 693     fprintf (fout
, "\tfolding:\t%d\n", g
->folding
); 
 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
); 
 700   if (g
->textmode 
!= G_TEXTMODE
) 
 701     fprintf (fout
, "\ttextmode:\t%s\n", 
 702              get_textmode_str (g
->textmode
)); 
 704   if (g
->shape 
!= G_SHAPE
) 
 705     fprintf (fout
, "\tshape:\t%s\n", get_shape_str (g
->shape
)); 
 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
); 
 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
); 
 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
); 
 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
); 
 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
); 
 736   if (g
->hidden 
!= G_HIDDEN
) 
 737     fprintf (fout
, "\thidden:\t%d\n", g
->hidden
); 
 739   /* FIXME: Unallocate struct list if required. 
 740      Maybe with a little function.  */ 
 741   if (g
->classname 
!= G_CLASSNAME
) 
 743       struct classname 
*ite
; 
 745       for (ite 
= g
->classname
; ite
; ite 
= ite
->next
) 
 746         fprintf (fout
, "\tclassname %d :\t%s\n", ite
->no
, ite
->name
); 
 749   if (g
->infoname 
!= G_INFONAME
) 
 751       struct infoname 
*ite
; 
 753       for (ite 
= g
->infoname
; ite
; ite 
= ite
->next
) 
 754         fprintf (fout
, "\tinfoname %d :\t%s\n", ite
->integer
, ite
->chars
); 
 757   if (g
->colorentry 
!= G_COLORENTRY
) 
 759       struct colorentry 
*ite
; 
 761       for (ite 
= g
->colorentry
; ite
; ite 
= ite
->next
) 
 763           fprintf (fout
, "\tcolorentry %d :\t%d %d %d\n", 
 771   if (g
->layoutalgorithm 
!= G_LAYOUTALGORITHM
) 
 772     fprintf (fout
, "\tlayoutalgorithm:\t%s\n", 
 773              get_layoutalgorithm_str (g
->layoutalgorithm
)); 
 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
); 
 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
) 
 808              "\tmanhattan_edges:\t%s\n", 
 809              get_decision_str (g
->manhattan_edges
)); 
 810   if (g
->smanhattan_edges 
!= G_SMANHATTAN_EDGES
) 
 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
)); 
 818   if (g
->orientation 
!= G_ORIENTATION
) 
 819     fprintf (fout
, "\torientation:\t%s\n", 
 820              get_orientation_str (g
->orientation
)); 
 822   if (g
->node_alignment 
!= G_NODE_ALIGNMENT
) 
 823     fprintf (fout
, "\tnode_alignment:\t%s\n", 
 824              get_node_alignment_str (g
->node_alignment
)); 
 826   if (g
->port_sharing 
!= G_PORT_SHARING
) 
 827     fprintf (fout
, "\tport_sharing:\t%s\n", 
 828              get_decision_str (g
->port_sharing
)); 
 830   if (g
->arrow_mode 
!= G_ARROW_MODE
) 
 831     fprintf (fout
, "\tarrow_mode:\t%s\n", 
 832              get_arrow_mode_str (g
->arrow_mode
)); 
 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
); 
 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
)); 
 849   if (g
->view 
!= G_VIEW
) 
 850     fprintf (fout
, "\tview:\t%s\n", get_view_str (g
->view
)); 
 852   if (g
->edges 
!= G_EDGES
) 
 853     fprintf (fout
, "\tedges:\t%s\n", get_decision_str (g
->edges
)); 
 855   if (g
->nodes 
!= G_NODES
) 
 856     fprintf (fout
,"\tnodes:\t%s\n", get_decision_str (g
->nodes
)); 
 858   if (g
->splines 
!= G_SPLINES
) 
 859     fprintf (fout
, "\tsplines:\t%s\n", get_decision_str (g
->splines
)); 
 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
);