]>
git.saurik.com Git - bison.git/blob - src/vcg.c
   1 /* VCG description handler for Bison. 
   2    Copyright 2001, 2002 Free Software Foundation, Inc. 
   4    This file is part of Bison, the GNU Compiler Compiler. 
   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) 
  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. 
  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.  */ 
  23 #include "vcg_defaults.h" 
  26 /* Return an unambiguous printable representated, for NAME, suitable 
  27    for C strings.  Use slot 2 since the user may use slots 0 and 1. 
  31 quote (char const *name
) 
  33   return quotearg_n_style (2, c_quoting_style
, name
); 
  37 /* Initialize a graph with the default values. */ 
  39 new_graph (graph_t 
*g
) 
  44   g
->infos
[0] = G_INFOS1
; 
  45   g
->infos
[1] = G_INFOS2
; 
  46   g
->infos
[2] = G_INFOS3
; 
  49   g
->textcolor 
= G_TEXTCOLOR
; 
  50   g
->bordercolor 
= G_BORDERCOLOR
; 
  54   g
->borderwidth 
= G_BORDERWIDTH
; 
  57   g
->folding 
= G_FOLDING
; 
  59   g
->stretch 
= G_STRETCH
; 
  61   g
->textmode 
= G_TEXTMODE
; 
  64   g
->vertical_order 
= G_VERTICAL_ORDER
; 
  65   g
->horizontal_order 
= G_HORIZONTAL_ORDER
; 
  67   g
->xmax 
= G_XMAX
; /* Not output. */ 
  68   g
->ymax 
= G_YMAX
; /* Not output. */ 
  75   g
->xlspace 
= G_XLSPACE
; /* Not output. */ 
  77   g
->xraster 
= G_XRASTER
; 
  78   g
->yraster 
= G_YRASTER
; 
  79   g
->xlraster 
= G_XLRASTER
; 
  81   g
->hidden 
= G_HIDDEN
; /* No default value. */ 
  83   g
->classname 
= G_CLASSNAME
; /* No class name association. */ 
  85   g
->layoutalgorithm 
= G_LAYOUTALGORITHM
; 
  86   g
->layout_downfactor 
= G_LAYOUT_DOWNFACTOR
; 
  87   g
->layout_upfactor 
= G_LAYOUT_UPFACTOR
; 
  88   g
->layout_nearfactor 
= G_LAYOUT_NEARFACTOR
; 
  89   g
->layout_splinefactor 
= G_LAYOUT_SPLINEFACTOR
; 
  91   g
->late_edge_labels 
= G_LATE_EDGE_LABELS
; 
  92   g
->display_edge_labels 
= G_DISPLAY_EDGE_LABELS
; 
  93   g
->dirty_edge_labels 
= G_DIRTY_EDGE_LABELS
; 
  94   g
->finetuning 
= G_FINETUNING
; 
  95   g
->ignore_singles 
= G_IGNORE_SINGLES
; 
  96   g
->straight_phase 
= G_STRAIGHT_PHASE
; 
  97   g
->priority_phase 
= G_PRIORITY_PHASE
; 
  98   g
->manhattan_edges 
= G_MANHATTAN_EDGES
; 
  99   g
->smanhattan_edges 
= G_SMANHATTAN_EDGES
; 
 100   g
->near_edges 
= G_NEAR_EDGES
; 
 102   g
->orientation 
= G_ORIENTATION
; 
 103   g
->node_alignement 
= G_NODE_ALIGNEMENT
; 
 104   g
->port_sharing 
= G_PORT_SHARING
; 
 105   g
->arrow_mode 
= G_ARROW_MODE
; 
 106   g
->treefactor 
= G_TREEFACTOR
; 
 107   g
->spreadlevel 
= G_SPREADLEVEL
; 
 108   g
->crossing_weight 
= G_CROSSING_WEIGHT
; 
 109   g
->crossing_phase2 
= G_CROSSING_PHASE2
; 
 110   g
->crossing_optimization 
= G_CROSSING_OPTIMIZATION
; 
 115   g
->splines 
= G_SPLINES
; 
 126   g
->node_list 
= G_NODE_LIST
; 
 127   g
->edge_list 
= G_EDGE_LIST
; 
 133 /* Initialize a node with the defalut values. */ 
 135 new_node (node_t 
*node
) 
 137   node
->title 
= N_TITLE
; 
 138   node
->label 
= N_LABEL
; 
 140   node
->locx 
= N_LOCX
; /* Default unspcified. */ 
 141   node
->locy 
= N_LOCY
; /* Default unspcified. */ 
 143   node
->vertical_order 
= N_VERTICAL_ORDER
;      /* Default unspcified. */ 
 144   node
->horizontal_order 
= N_HORIZONTAL_ORDER
;  /* Default unspcified. */ 
 146   node
->width 
= N_WIDTH
; /* We assume that we can't define it now. */ 
 147   node
->height 
= N_HEIGHT
; /* Also. */ 
 149   node
->shrink 
= N_SHRINK
; 
 150   node
->stretch 
= N_STRETCH
; 
 152   node
->folding 
= N_FOLDING
; /* No explicit default value. */ 
 154   node
->shape 
= N_SHAPE
; 
 155   node
->textmode 
= N_TEXTMODE
; 
 156   node
->borderwidth 
= N_BORDERWIDTH
; 
 158   node
->color 
= N_COLOR
; 
 159   node
->textcolor 
= N_TEXTCOLOR
; 
 160   node
->bordercolor 
= N_BORDERCOLOR
; 
 162   node
->infos
[0] = N_INFOS1
; 
 163   node
->infos
[1] = N_INFOS2
; 
 164   node
->infos
[2] = N_INFOS3
; 
 169 /* Initialize a edge with the defalut values. */ 
 171 new_edge (edge_t 
*edge
) 
 173   edge
->type 
= E_EDGE_TYPE
; 
 175   edge
->sourcename 
= E_SOURCENAME
; 
 176   edge
->targetname 
= E_TARGETNAME
; 
 177   edge
->label 
= E_LABEL
; 
 179   edge
->linestyle 
= E_LINESTYLE
; 
 180   edge
->thickness 
= E_THICKNESS
; 
 182   edge
->class = E_CLASS
; 
 184   edge
->color 
= E_COLOR
; 
 185   edge
->textcolor 
= E_TEXTCOLOR
; 
 186   edge
->arrowcolor 
= E_ARROWCOLOR
; 
 187   edge
->backarrowcolor 
= E_BACKARROWCOLOR
; 
 189   edge
->arrowsize 
= E_ARROWSIZE
; 
 190   edge
->backarrowsize 
= E_BACKARROWSIZE
; 
 191   edge
->arrowstyle 
= E_ARROWSTYLE
; 
 193   edge
->backarrowstyle 
= E_BACKARROWSTYLE
; 
 195   edge
->priority 
= E_PRIORITY
; 
 197   edge
->anchor 
= E_ANCHOR
; 
 199   edge
->horizontal_order 
= E_HORIZONTAL_ORDER
; 
 204 /*----------------------------------------------. 
 206 | Return string corresponding to an enum value. | 
 207 `----------------------------------------------*/ 
 210 get_color_str (enum color_e c
) 
 214     case white
:         return "white"; 
 215     case blue
:          return "blue"; 
 216     case red
:           return "red"; 
 217     case green
:         return "green"; 
 218     case yellow
:        return "yellow"; 
 219     case magenta
:       return "magenta"; 
 220     case cyan
:          return "cyan"; 
 221     case darkgrey
:      return "darkgrey"; 
 222     case darkblue
:      return "darkblue"; 
 223     case darkred
:       return "darkred"; 
 224     case darkgreen
:     return "darkgreen"; 
 225     case darkyellow
:    return "darkyellow"; 
 226     case darkmagenta
:   return "darkmagenta"; 
 227     case darkcyan
:      return "darkcyan"; 
 228     case gold
:          return "gold"; 
 229     case lightgrey
:     return "lightgrey"; 
 230     case lightblue
:     return "lightblue"; 
 231     case lightred
:      return "lightred"; 
 232     case lightgreen
:    return "lightgreen"; 
 233     case lightyellow
:   return "lightyellow"; 
 234     case lightmagenta
:  return "lightmagenta"; 
 235     case lightcyan
:     return "lightcyan"; 
 236     case lilac
:         return "lilac"; 
 237     case turquoise
:     return "turquoise"; 
 238     case aquamarine
:    return "aquamarine"; 
 239     case khaki
:         return "khaki"; 
 240     case purple
:        return "purple"; 
 241     case yellowgreen
:   return "yellowgreen"; 
 242     case pink
:          return "pink"; 
 243     case orange
:        return "orange"; 
 244     case orchid
:        return "orchid"; 
 245     case black
:         return "black"; 
 247 #define A_known_default_color 0 
 248       assert (A_known_default_color
); 
 254 get_textmode_str (enum textmode_e t
) 
 258     case centered
:      return "center"; 
 259     case left_justify
:  return "left_justify"; 
 260     case right_justify
: return "right_justify"; 
 262 #define A_known_text_mode 0 
 263       assert (A_known_text_mode
); 
 269 get_shape_str (enum shape_e s
) 
 273     case box
:           return "box"; 
 274     case rhomb
:         return "rhomb"; 
 275     case ellipse
:       return "ellipse"; 
 276     case triangle
:      return "triangle"; 
 278 #define A_known_shape 0 
 279       assert (A_known_shape
); 
 285 get_layoutalgorithm_str (enum layoutalgorithm_e l
) 
 289     case normal
:        return "normal"; 
 290     case maxdepth
:      return "maxdepth"; 
 291     case mindepth
:      return "mindepth"; 
 292     case maxdepthslow
:  return "maxdepthslow"; 
 293     case mindepthslow
:  return "mindepthslow"; 
 294     case maxdegree
:     return "maxdegree"; 
 295     case mindegree
:     return "mindegree"; 
 296     case maxindegree
:   return "maxindegree"; 
 297     case minindegree
:   return "minindegree"; 
 298     case maxoutdegree
:  return "maxoutdegree"; 
 299     case minoutdegree
:  return "minoutdegree"; 
 300     case minbackward
:   return "minbackward"; 
 301     case dfs
:           return "dfs"; 
 302     case tree
:          return "tree"; 
 304 #define A_known_layout_algorithm 0 
 305       assert (A_known_layout_algorithm
); 
 311 get_decision_str (enum decision_e d
) 
 315     case no
:    return "no"; 
 316     case yes
:   return "yes"; 
 318 #define Either_yes_nor_no 0 
 319       assert (Either_yes_nor_no
); 
 325 get_orientation_str (enum orientation_e o
) 
 329     case top_to_bottom
: return "top_to_bottom"; 
 330     case bottom_to_top
: return "bottom_to_top"; 
 331     case left_to_right
: return "left_to_right"; 
 332     case right_to_left
: return "right_to_left"; 
 334 #define A_knownn_orientation 0 
 335       assert (A_knownn_orientation
); 
 341 get_node_alignement_str (enum alignement_e a
) 
 345     case center
:        return "center"; 
 346     case top
:           return "top"; 
 347     case bottom
:        return "bottom"; 
 349 #define A_known_alignement 0 
 350       assert (A_known_alignement
); 
 356 get_arrow_mode_str (enum arrow_mode_e a
) 
 360     case fixed
:         return "fixed"; 
 361     case free_a
:        return "free"; 
 363 #define A_known_arrow_mode 0 
 364       assert (A_known_arrow_mode
); 
 370 get_crossing_type_str (enum crossing_type_e c
) 
 374     case bary
:          return "bary"; 
 375     case median
:        return "median"; 
 376     case barymedian
:    return "barymedian"; 
 377     case medianbary
:    return "medianbary"; 
 379 #define A_known_crossing_type 0 
 380       assert (A_known_crossing_type
); 
 386 get_view_str (enum view_e v
) 
 390     case normal_view
:   return "normal_view"; 
 391     case cfish
:         return "cfish"; 
 392     case pfish
:         return "pfish"; 
 393     case fcfish
:        return "fcfish"; 
 394     case fpfish
:        return "fpfish"; 
 396 #define A_known_view 0 
 397       assert (A_known_view
); 
 403 get_linestyle_str (enum linestyle_e l
) 
 407     case continuous
:    return "continuous"; 
 408     case dashed
:        return "dashed"; 
 409     case dotted
:        return "dotted"; 
 410     case invisible
:     return "invisible"; 
 412 #define A_known_line_style 0 
 413       assert (A_known_line_style
); 
 419 get_arrowstyle_str (enum arrowstyle_e a
) 
 423     case solid
: return "solid"; 
 424     case line
:  return "line"; 
 425     case none
:  return "none"; 
 427 #define A_known_arrow_style 0 
 428       assert (A_known_arrow_style
); 
 433 /*----------------------------. 
 435 | Edge and Nodes int a graph. | 
 436 `----------------------------*/ 
 439 add_node (graph_t 
*graph
, node_t 
*node
) 
 441   node
->next 
= graph
->node_list
; 
 442   graph
->node_list 
= node
; 
 446 add_edge (graph_t 
*graph
, edge_t 
*edge
) 
 448   edge
->next 
= graph
->edge_list
; 
 449   graph
->edge_list 
= edge
; 
 453 add_classname (graph_t 
*g
, int val
, const char *name
) 
 455   struct classname_s 
*classname
; 
 457   classname 
= XMALLOC (struct classname_s
, 1); 
 459   classname
->name 
= name
; 
 460   classname
->next 
= g
->classname
; 
 461   g
->classname 
= classname
; 
 465 add_infoname (graph_t 
*g
, int integer
, const char *string
) 
 467   struct infoname_s 
*infoname
; 
 469   infoname 
= XMALLOC (struct infoname_s
, 1); 
 470   infoname
->integer 
= integer
; 
 471   infoname
->string 
= string
; 
 472   infoname
->next 
= g
->infoname
; 
 473   g
->infoname 
= infoname
; 
 476 /* Build a colorentry struct and add it to the list.  */ 
 478 add_colorentry (graph_t 
*g
, int color_idx
, int red_cp
, 
 479                 int green_cp
, int blue_cp
) 
 481   struct colorentry_s 
*ce
; 
 483   ce 
= XMALLOC (struct colorentry_s
, 1); 
 484   ce
->color_index 
= color_idx
; 
 486   ce
->green_cp 
= green_cp
; 
 487   ce
->blue_cp 
= blue_cp
; 
 488   ce
->next 
= g
->colorentry
; 
 492 /*-------------------------------------. 
 493 | Open and close functions (formatted) | 
 494 `-------------------------------------*/ 
 497 open_edge(edge_t 
*edge
, FILE *fout
) 
 502       fputs ("\tedge: {\n", fout
); 
 505       fputs ("\tbackedge: {\n", fout
); 
 508       fputs ("\tnearedge: {\n", fout
); 
 511       fputs ("\tbentnearedge: {\n", fout
); 
 514       fputs ("\tedge: {\n", fout
); 
 519 close_edge(FILE *fout
) 
 521   fputs ("\t}\n", fout
); 
 525 open_node(FILE *fout
) 
 527   fputs ("\tnode: {\n", fout
); 
 531 close_node(FILE *fout
) 
 533   fputs ("\t}\n", fout
); 
 537 open_graph(FILE *fout
) 
 539   fputs ("graph: {\n", fout
); 
 543 close_graph(graph_t 
*graph
, FILE *fout
) 
 547   /* FIXME: Unallocate nodes and edges if required.  */ 
 551     for (node 
= graph
->node_list
; node
; node 
= node
->next
) 
 554         output_node (node
, fout
); 
 564     for (edge 
= graph
->edge_list
; edge
; edge 
= edge
->next
) 
 566         open_edge (edge
, fout
); 
 567         output_edge (edge
, fout
); 
 575 /*-------------------------------------------. 
 576 | Output functions (formatted) in file FOUT  | 
 577 `-------------------------------------------*/ 
 580 output_node (node_t 
*node
, FILE *fout
) 
 582   if (node
->title 
!= N_TITLE
) 
 583     fprintf (fout
, "\t\ttitle:\t%s\n", quote (node
->title
)); 
 584   if (node
->label 
!= N_LABEL
) 
 585     fprintf (fout
, "\t\tlabel:\t%s\n", quote (node
->label
)); 
 587   if ((node
->locx 
!= N_LOCX
) && (node
->locy 
!= N_LOCY
)) 
 588     fprintf (fout
, "\t\tloc { x: %d  y: %d }\t\n", node
->locx
, node
->locy
); 
 590   if (node
->vertical_order 
!= N_VERTICAL_ORDER
) 
 591     fprintf (fout
, "\t\tvertical_order:\t%d\n", node
->vertical_order
); 
 592   if (node
->horizontal_order 
!= N_HORIZONTAL_ORDER
) 
 593     fprintf (fout
, "\t\thorizontal_order:\t%d\n", node
->horizontal_order
); 
 595   if (node
->width 
!= N_WIDTH
) 
 596     fprintf (fout
, "\t\twidth:\t%d\n", node
->width
); 
 597   if (node
->height 
!= N_HEIGHT
) 
 598     fprintf (fout
, "\t\theight:\t%d\n", node
->height
); 
 600   if (node
->shrink 
!= N_SHRINK
) 
 601     fprintf (fout
, "\t\tshrink:\t%d\n", node
->shrink
); 
 602   if (node
->stretch 
!= N_STRETCH
) 
 603     fprintf (fout
, "\t\tstretch:\t%d\n", node
->stretch
); 
 605   if (node
->folding 
!= N_FOLDING
) 
 606     fprintf (fout
, "\t\tfolding:\t%d\n", node
->folding
); 
 608   if (node
->textmode 
!= N_TEXTMODE
) 
 609     fprintf (fout
, "\t\ttextmode:\t%s\n", 
 610              get_textmode_str (node
->textmode
)); 
 612   if (node
->shape 
!= N_SHAPE
) 
 613     fprintf (fout
, "\t\tshape:\t%s\n", get_shape_str (node
->shape
)); 
 615   if (node
->borderwidth 
!= N_BORDERWIDTH
) 
 616     fprintf (fout
, "\t\tborderwidth:\t%d\n", node
->borderwidth
); 
 618   if (node
->color 
!= N_COLOR
) 
 619     fprintf (fout
, "\t\tcolor:\t%s\n", get_color_str (node
->color
)); 
 620   if (node
->textcolor 
!= N_TEXTCOLOR
) 
 621     fprintf (fout
, "\t\ttextcolor:\t%s\n", 
 622              get_color_str (node
->textcolor
)); 
 623   if (node
->bordercolor 
!= N_BORDERCOLOR
) 
 624     fprintf (fout
, "\t\tbordercolor:\t%s\n", 
 625              get_color_str (node
->bordercolor
)); 
 629     for (i 
= 0; i 
< 3; ++i
) 
 631         fprintf (fout
, "\t\tinfo%d:\t%s\n", 
 632                  i
, quote (node
->infos
[i
])); 
 637 output_edge (edge_t 
*edge
, FILE *fout
) 
 639   /* FIXME: SOURCENAME and TARGETNAME are mandatory 
 640      so it has to be fatal not to give these informations.  */ 
 641   if (edge
->sourcename 
!= E_SOURCENAME
) 
 642     fprintf (fout
, "\t\tsourcename:\t%s\n", quote (edge
->sourcename
)); 
 643   if (edge
->targetname 
!= E_TARGETNAME
) 
 644     fprintf (fout
, "\t\ttargetname:\t%s\n", quote (edge
->targetname
)); 
 646   if (edge
->label 
!= E_LABEL
) 
 647     fprintf (fout
, "\t\tlabel:\t%s\n", quote (edge
->label
)); 
 649   if (edge
->linestyle 
!= E_LINESTYLE
) 
 650     fprintf (fout
, "\t\tlinestyle:\t%s\n", 
 651              quote (get_linestyle_str(edge
->linestyle
))); 
 653   if (edge
->thickness 
!= E_THICKNESS
) 
 654     fprintf (fout
, "\t\tthickness:\t%d\n", edge
->thickness
); 
 655   if (edge
->class != E_CLASS
) 
 656     fprintf (fout
, "\t\tclass:\t%d\n", edge
->class); 
 658   if (edge
->color 
!= E_COLOR
) 
 659     fprintf (fout
, "\t\tcolor:\t%s\n", get_color_str (edge
->color
)); 
 660   if (edge
->color 
!= E_TEXTCOLOR
) 
 661     fprintf (fout
, "\t\ttextcolor:\t%s\n", 
 662              get_color_str (edge
->textcolor
)); 
 663   if (edge
->arrowcolor 
!= E_ARROWCOLOR
) 
 664     fprintf (fout
, "\t\tarrowcolor:\t%s\n", 
 665              get_color_str (edge
->arrowcolor
)); 
 666   if (edge
->backarrowcolor 
!= E_BACKARROWCOLOR
) 
 667     fprintf (fout
, "\t\tbackarrowcolor:\t%s\n", 
 668              get_color_str (edge
->backarrowcolor
)); 
 670   if (edge
->arrowsize 
!= E_ARROWSIZE
) 
 671     fprintf (fout
, "\t\tarrowsize:\t%d\n", edge
->arrowsize
); 
 672   if (edge
->backarrowsize 
!= E_BACKARROWSIZE
) 
 673     fprintf (fout
, "\t\tbackarrowsize:\t%d\n", edge
->backarrowsize
); 
 675   if (edge
->arrowstyle 
!= E_ARROWSTYLE
) 
 676     fprintf (fout
, "\t\tarrowstyle:\t%s\n", 
 677              get_arrowstyle_str(edge
->arrowstyle
)); 
 678   if (edge
->backarrowstyle 
!= E_BACKARROWSTYLE
) 
 679     fprintf (fout
, "\t\tbackarrowstyle:\t%s\n", 
 680              get_arrowstyle_str(edge
->backarrowstyle
)); 
 682   if (edge
->priority 
!= E_PRIORITY
) 
 683     fprintf (fout
, "\t\tpriority:\t%d\n", edge
->priority
); 
 684   if (edge
->anchor 
!= E_ANCHOR
) 
 685     fprintf (fout
, "\t\tanchor:\t%d\n", edge
->anchor
); 
 686   if (edge
->horizontal_order 
!= E_HORIZONTAL_ORDER
) 
 687     fprintf (fout
, "\t\thorizontal_order:\t%d\n", edge
->horizontal_order
); 
 691 output_graph (graph_t 
*graph
, FILE *fout
) 
 694     fprintf (fout
, "\ttitle:\t%s\n", quote (graph
->title
)); 
 696     fprintf (fout
, "\tlabel:\t%s\n", quote (graph
->label
)); 
 700     for (i 
= 0; i 
< 3; ++i
) 
 702         fprintf (fout
, "\tinfo%d:\t%s\n", i
, quote (graph
->infos
[i
])); 
 705   if (graph
->color 
!= G_COLOR
) 
 706     fprintf (fout
, "\tcolor:\t%s\n", get_color_str (graph
->color
)); 
 707   if (graph
->textcolor 
!= G_TEXTCOLOR
) 
 708     fprintf (fout
, "\ttextcolor:\t%s\n", get_color_str (graph
->textcolor
)); 
 709   if (graph
->bordercolor 
!= G_BORDERCOLOR
) 
 710     fprintf (fout
, "\tbordercolor:\t%s\n", 
 711              get_color_str (graph
->bordercolor
)); 
 713   if (graph
->width 
!= G_WIDTH
) 
 714     fprintf (fout
, "\twidth:\t%d\n", graph
->width
); 
 715   if (graph
->height 
!= G_HEIGHT
) 
 716     fprintf (fout
, "\theight:\t%d\n", graph
->height
); 
 717   if (graph
->borderwidth 
!= G_BORDERWIDTH
) 
 718     fprintf (fout
, "\tborderwidth:\t%d\n", graph
->borderwidth
); 
 721     fprintf (fout
, "\tx:\t%d\n", graph
->x
); 
 723     fprintf (fout
, "\ty:\t%d\n", graph
->y
); 
 725   if (graph
->folding 
!= G_FOLDING
) 
 726     fprintf (fout
, "\tfolding:\t%d\n", graph
->folding
); 
 728   if (graph
->shrink 
!= G_SHRINK
) 
 729     fprintf (fout
, "\tshrink:\t%d\n", graph
->shrink
); 
 730   if (graph
->stretch 
!= G_STRETCH
) 
 731     fprintf (fout
, "\tstretch:\t%d\n", graph
->stretch
); 
 733   if (graph
->textmode 
!= G_TEXTMODE
) 
 734     fprintf (fout
, "\ttextmode:\t%s\n", 
 735              get_textmode_str (graph
->textmode
)); 
 737   if (graph
->shape 
!= G_SHAPE
) 
 738     fprintf (fout
, "\tshape:\t%s\n", get_shape_str (graph
->shape
)); 
 740   if (graph
->vertical_order 
!= G_VERTICAL_ORDER
) 
 741     fprintf (fout
, "\tvertical_order:\t%d\n", graph
->vertical_order
); 
 742   if (graph
->horizontal_order 
!= G_HORIZONTAL_ORDER
) 
 743     fprintf (fout
, "\thorizontal_order:\t%d\n", graph
->horizontal_order
); 
 745   if (graph
->xmax 
!= G_XMAX
) 
 746     fprintf (fout
, "\txmax:\t%d\n", graph
->xmax
); 
 747   if (graph
->ymax 
!= G_YMAX
) 
 748     fprintf (fout
, "\tymax:\t%d\n", graph
->ymax
); 
 750   if (graph
->xbase 
!= G_XBASE
) 
 751     fprintf (fout
, "\txbase:\t%d\n", graph
->xbase
); 
 752   if (graph
->ybase 
!= G_YBASE
) 
 753     fprintf (fout
, "\tybase:\t%d\n", graph
->ybase
); 
 755   if (graph
->xspace 
!= G_XSPACE
) 
 756     fprintf (fout
, "\txspace:\t%d\n", graph
->xspace
); 
 757   if (graph
->yspace 
!= G_YSPACE
) 
 758     fprintf (fout
, "\tyspace:\t%d\n", graph
->yspace
); 
 759   if (graph
->xlspace 
!= G_XLSPACE
) 
 760     fprintf (fout
, "\txlspace:\t%d\n", graph
->xlspace
); 
 762   if (graph
->xraster 
!= G_XRASTER
) 
 763     fprintf (fout
, "\txraster:\t%d\n", graph
->xraster
); 
 764   if (graph
->yraster 
!= G_YRASTER
) 
 765     fprintf (fout
, "\tyraster:\t%d\n", graph
->yraster
); 
 766   if (graph
->xlraster 
!= G_XLRASTER
) 
 767     fprintf (fout
, "\txlraster:\t%d\n", graph
->xlraster
); 
 769   if (graph
->hidden 
!= G_HIDDEN
) 
 770     fprintf (fout
, "\thidden:\t%d\n", graph
->hidden
); 
 772   /* FIXME: Unallocate struct list if required. 
 773      Maybe with a little function.  */ 
 774   if (graph
->classname 
!= G_CLASSNAME
) 
 776       struct classname_s 
*ite
; 
 778       for (ite 
= graph
->classname
; ite
; ite 
= ite
->next
) 
 779         fprintf (fout
, "\tclassname %d :\t%s\n", ite
->no
, ite
->name
); 
 782   if (graph
->infoname 
!= G_INFONAME
) 
 784       struct infoname_s 
*ite
; 
 786       for (ite 
= graph
->infoname
; ite
; ite 
= ite
->next
) 
 787         fprintf (fout
, "\tinfoname %d :\t%s\n", ite
->integer
, ite
->string
); 
 790   if (graph
->colorentry 
!= G_COLORENTRY
) 
 792       struct colorentry_s 
*ite
; 
 794       for (ite 
= graph
->colorentry
; ite
; ite 
= ite
->next
) 
 796           fprintf (fout
, "\tcolorentry %d :\t%d %d %d\n", 
 804   if (graph
->layoutalgorithm 
!= G_LAYOUTALGORITHM
) 
 805     fprintf (fout
, "\tlayoutalgorithm:\t%s\n", 
 806              get_layoutalgorithm_str(graph
->layoutalgorithm
)); 
 808   if (graph
->layout_downfactor 
!= G_LAYOUT_DOWNFACTOR
) 
 809     fprintf (fout
, "\tlayout_downfactor:\t%d\n", graph
->layout_downfactor
); 
 810   if (graph
->layout_upfactor 
!= G_LAYOUT_UPFACTOR
) 
 811     fprintf (fout
, "\tlayout_upfactor:\t%d\n", graph
->layout_upfactor
); 
 812   if (graph
->layout_nearfactor 
!= G_LAYOUT_NEARFACTOR
) 
 813     fprintf (fout
, "\tlayout_nearfactor:\t%d\n", graph
->layout_nearfactor
); 
 814   if (graph
->layout_splinefactor 
!= G_LAYOUT_SPLINEFACTOR
) 
 815     fprintf (fout
, "\tlayout_splinefactor:\t%d\n", 
 816              graph
->layout_splinefactor
); 
 818   if (graph
->late_edge_labels 
!= G_LATE_EDGE_LABELS
) 
 819     fprintf (fout
, "\tlate_edge_labels:\t%s\n", 
 820              get_decision_str(graph
->late_edge_labels
)); 
 821   if (graph
->display_edge_labels 
!= G_DISPLAY_EDGE_LABELS
) 
 822     fprintf (fout
, "\tdisplay_edge_labels:\t%s\n", 
 823              get_decision_str(graph
->display_edge_labels
)); 
 824   if (graph
->dirty_edge_labels 
!= G_DIRTY_EDGE_LABELS
) 
 825     fprintf (fout
, "\tdirty_edge_labels:\t%s\n", 
 826              get_decision_str(graph
->dirty_edge_labels
)); 
 827   if (graph
->finetuning 
!= G_FINETUNING
) 
 828     fprintf (fout
, "\tfinetuning:\t%s\n", 
 829              get_decision_str(graph
->finetuning
)); 
 830   if (graph
->ignore_singles 
!= G_IGNORE_SINGLES
) 
 831     fprintf (fout
, "\tignore_singles:\t%s\n", 
 832              get_decision_str(graph
->ignore_singles
)); 
 833   if (graph
->straight_phase 
!= G_STRAIGHT_PHASE
) 
 834     fprintf (fout
, "\tstraight_phase:\t%s\n", 
 835              get_decision_str(graph
->straight_phase
)); 
 836   if (graph
->priority_phase 
!= G_PRIORITY_PHASE
) 
 837     fprintf (fout
, "\tpriority_phase:\t%s\n", 
 838              get_decision_str(graph
->priority_phase
)); 
 839   if (graph
->manhattan_edges 
!= G_MANHATTAN_EDGES
) 
 841              "\tmanhattan_edges:\t%s\n", 
 842              get_decision_str(graph
->manhattan_edges
)); 
 843   if (graph
->smanhattan_edges 
!= G_SMANHATTAN_EDGES
) 
 845              "\tsmanhattan_edges:\t%s\n", 
 846              get_decision_str(graph
->smanhattan_edges
)); 
 847   if (graph
->near_edges 
!= G_NEAR_EDGES
) 
 848     fprintf (fout
, "\tnear_edges:\t%s\n", 
 849              get_decision_str(graph
->near_edges
)); 
 851   if (graph
->orientation 
!= G_ORIENTATION
) 
 852     fprintf (fout
, "\torientation:\t%s\n", 
 853              get_orientation_str(graph
->orientation
)); 
 855   if (graph
->node_alignement 
!= G_NODE_ALIGNEMENT
) 
 856     fprintf (fout
, "\tnode_alignement:\t%s\n", 
 857              get_node_alignement_str(graph
->node_alignement
)); 
 859   if (graph
->port_sharing 
!= G_PORT_SHARING
) 
 860     fprintf (fout
, "\tport_sharing:\t%s\n", 
 861              get_decision_str(graph
->port_sharing
)); 
 863   if (graph
->arrow_mode 
!= G_ARROW_MODE
) 
 864     fprintf (fout
, "\tarrow_mode:\t%s\n", 
 865              get_arrow_mode_str(graph
->arrow_mode
)); 
 867   if (graph
->treefactor 
!= G_TREEFACTOR
) 
 868     fprintf (fout
, "\ttreefactor:\t%f\n", graph
->treefactor
); 
 869   if (graph
->spreadlevel 
!= G_SPREADLEVEL
) 
 870     fprintf (fout
, "\tspreadlevel:\t%d\n", graph
->spreadlevel
); 
 872   if (graph
->crossing_weight 
!= G_CROSSING_WEIGHT
) 
 873     fprintf (fout
, "\tcrossing_weight:\t%s\n", 
 874              get_crossing_type_str(graph
->crossing_weight
)); 
 875   if (graph
->crossing_phase2 
!= G_CROSSING_PHASE2
) 
 876     fprintf (fout
, "\tcrossing_phase2:\t%s\n", 
 877              get_decision_str(graph
->crossing_phase2
)); 
 878   if (graph
->crossing_optimization 
!= G_CROSSING_OPTIMIZATION
) 
 879     fprintf (fout
, "\tcrossing_optimization:\t%s\n", 
 880              get_decision_str(graph
->crossing_optimization
)); 
 882   if (graph
->view 
!= G_VIEW
) 
 883     fprintf (fout
, "\tview:\t%s\n", get_view_str(graph
->view
)); 
 885   if (graph
->edges 
!= G_EDGES
) 
 886     fprintf (fout
, "\tedges:\t%s\n", get_decision_str(graph
->edges
)); 
 888   if (graph
->nodes 
!= G_NODES
) 
 889     fprintf (fout
,"\tnodes:\t%s\n", get_decision_str(graph
->nodes
)); 
 891   if (graph
->splines 
!= G_SPLINES
) 
 892     fprintf (fout
, "\tsplines:\t%s\n", get_decision_str(graph
->splines
)); 
 894   if (graph
->bmax 
!= G_BMAX
) 
 895     fprintf (fout
, "\tbmax:\t%d\n", graph
->bmax
); 
 896   if (graph
->cmin 
!= G_CMIN
) 
 897     fprintf (fout
, "\tcmin:\t%d\n", graph
->cmin
); 
 898   if (graph
->cmax 
!= G_CMAX
) 
 899     fprintf (fout
, "\tcmax:\t%d\n", graph
->cmax
); 
 900   if (graph
->pmin 
!= G_PMIN
) 
 901     fprintf (fout
, "\tpmin:\t%d\n", graph
->pmin
); 
 902   if (graph
->pmax 
!= G_PMAX
) 
 903     fprintf (fout
, "\tpmax:\t%d\n", graph
->pmax
); 
 904   if (graph
->rmin 
!= G_RMIN
) 
 905     fprintf (fout
, "\trmin:\t%d\n", graph
->rmin
); 
 906   if (graph
->rmax 
!= G_RMAX
) 
 907     fprintf (fout
, "\trmax:\t%d\n", graph
->rmax
); 
 908   if (graph
->smax 
!= G_SMAX
) 
 909     fprintf (fout
, "\tsmax:\t%d\n", graph
->smax
);