/[bison]/bison/src/vcg.c
ViewVC logotype

Diff of /bison/src/vcg.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by akim, Wed Aug 15 08:49:20 2001 UTC revision 1.6 by akim, Thu Oct 4 14:55:21 2001 UTC
# Line 21  Line 21 
21  #include "system.h"  #include "system.h"
22  #include "vcg.h"  #include "vcg.h"
23  #include "vcg_defaults.h"  #include "vcg_defaults.h"
 #include "xalloc.h"  
 #include "complain.h"  
24    
25  /* Initialize a graph with the default values. */  /* Initialize a graph with the default values. */
26  void  void
# Line 51  new_graph (graph_t *g) Line 49  new_graph (graph_t *g)
49    g->textmode = G_TEXTMODE;    g->textmode = G_TEXTMODE;
50    g->shape = G_SHAPE;    g->shape = G_SHAPE;
51    
52      g->vertical_order = G_VERTICAL_ORDER;
53      g->horizontal_order = G_HORIZONTAL_ORDER;
54    
55    g->xmax = G_XMAX; /* Not output. */    g->xmax = G_XMAX; /* Not output. */
56    g->ymax = G_YMAX; /* Not output. */    g->ymax = G_YMAX; /* Not output. */
57    
# Line 231  get_color_str (enum color_e c) Line 232  get_color_str (enum color_e c)
232      case orchid:        return "orchid";      case orchid:        return "orchid";
233      case black:         return "black";      case black:         return "black";
234      default:      default:
235        complain (_("vcg graph: no such color."));        assert (!"Not a default color.");
       return get_color_str(G_COLOR);  
236      }      }
237    return NULL;    return NULL;
238  }  }
# Line 246  get_textmode_str (enum textmode_e t) Line 246  get_textmode_str (enum textmode_e t)
246      case left_justify:  return "left_justify";      case left_justify:  return "left_justify";
247      case right_justify: return "right_justify";      case right_justify: return "right_justify";
248      default:      default:
249        complain (_("vcg graph: no such text mode"));        assert (!"Not a text mode.");
       return get_textmode_str(G_TEXTMODE);  
250      }      }
251    return NULL;    return NULL;
252  }  }
# Line 262  get_shape_str (enum shape_e s) Line 261  get_shape_str (enum shape_e s)
261      case ellipse:       return "ellipse";      case ellipse:       return "ellipse";
262      case triangle:      return "triangle";      case triangle:      return "triangle";
263      default:      default:
264        complain (_("vcg graph: no such shape"));        assert (!"Not a shape.");
       return get_shape_str(G_SHAPE);  
265      }      }
266    return NULL;    return NULL;
267  }  }
# Line 288  get_layoutalgorithm_str (enum layoutalgo Line 286  get_layoutalgorithm_str (enum layoutalgo
286      case dfs:           return "dfs";      case dfs:           return "dfs";
287      case tree:          return "tree";      case tree:          return "tree";
288      default:      default:
289        return "normal";        assert (!"Not a layout algorithm.");
290      }      }
291    return NULL;    return NULL;
292  }  }
293    
294  static const char *  static const char *
295  get_decision_str (enum decision_e d, enum decision_e defaults)  get_decision_str (enum decision_e d)
296  {  {
297    switch (d)    switch (d)
298      {      {
299      case no:    return "no";      case no:    return "no";
300      case yes:   return "yes";      case yes:   return "yes";
301      default:      default:
302        complain (_("vcg graph: no such decision"));        assert (!"Either yes nor no.");
       return get_decision_str(defaults, 0);  
303      }      }
304    return NULL;    return NULL;
305  }  }
# Line 317  get_orientation_str (enum orientation_e Line 314  get_orientation_str (enum orientation_e
314      case left_to_right: return "left_to_right";      case left_to_right: return "left_to_right";
315      case right_to_left: return "right_to_left";      case right_to_left: return "right_to_left";
316      default:      default:
317        complain (_("vcg graph: no such an orientation"));        assert (!"Not an orientation.");
       return get_orientation_str(G_ORIENTATION);  
318      }      }
319    return NULL;    return NULL;
320  }  }
# Line 332  get_node_alignement_str (enum alignement Line 328  get_node_alignement_str (enum alignement
328      case top:           return "top";      case top:           return "top";
329      case bottom:        return "bottom";      case bottom:        return "bottom";
330      default:      default:
331        complain (_("vcg graph: no such an alignement"));        assert (!"Not an alignement.");
       return get_node_alignement_str(G_NODE_ALIGNEMENT);  
332      }      }
333    return NULL;    return NULL;
334  }  }
# Line 346  get_arrow_mode_str (enum arrow_mode_e a) Line 341  get_arrow_mode_str (enum arrow_mode_e a)
341      case fixed:         return "fixed";      case fixed:         return "fixed";
342      case free_a:        return "free";      case free_a:        return "free";
343      default:      default:
344        complain (_("vcg graph: no such an arrow mode"));        assert (!"Not an arrow mode.");
       return get_arrow_mode_str(G_ARROW_MODE);  
345      }      }
346    return NULL;    return NULL;
347  }  }
# Line 362  get_crossing_type_str (enum crossing_typ Line 356  get_crossing_type_str (enum crossing_typ
356      case barymedian:    return "barymedian";      case barymedian:    return "barymedian";
357      case medianbary:    return "medianbary";      case medianbary:    return "medianbary";
358      default:      default:
359        complain (_("vcg graph: no such crossing_type"));        assert (!"Not a crossing type.");
       return get_crossing_type_str(G_CROSSING_WEIGHT);  
360      }      }
361    return NULL;    return NULL;
362  }  }
# Line 379  get_view_str (enum view_e v) Line 372  get_view_str (enum view_e v)
372      case fcfish:        return "fcfish";      case fcfish:        return "fcfish";
373      case fpfish:        return "fpfish";      case fpfish:        return "fpfish";
374      default:      default:
375        complain (_("vcg graph: no such view"));        assert (!"Not a view.");
       return get_view_str(G_VIEW);  
376      }      }
377    return NULL;    return NULL;
378  }  }
# Line 395  get_linestyle_str (enum linestyle_e l) Line 387  get_linestyle_str (enum linestyle_e l)
387      case dotted:        return "dotted";      case dotted:        return "dotted";
388      case invisible:     return "invisible";      case invisible:     return "invisible";
389      default:      default:
390        complain (_("vcg graph: no such linestyle"));        assert (!"Not a line style.");
       return get_linestyle_str(E_LINESTYLE);  
391      }      }
392    return NULL;    return NULL;
393  }  }
# Line 410  get_arrowstyle_str (enum arrowstyle_e a) Line 401  get_arrowstyle_str (enum arrowstyle_e a)
401      case line:  return "line";      case line:  return "line";
402      case none:  return "none";      case none:  return "none";
403      default:      default:
404        complain (_("vcg graph: no such an arrowstyle"));        assert (!"Not an arrow style.");
       return get_arrowstyle_str(E_ARROWSTYLE);  
405      }      }
406    return NULL;    return NULL;
407  }  }
# Line 435  add_edge (graph_t *graph, edge_t *edge) Line 425  add_edge (graph_t *graph, edge_t *edge)
425    graph->edge_list = edge;    graph->edge_list = edge;
426  }  }
427    
428    void
429    add_classname (graph_t *g, int val, const char *name)
430    {
431      struct classname_s *classname;
432      
433      classname = XMALLOC (struct classname_s, 1);
434      classname->no = val;
435      classname->name = name;
436      classname->next = g->classname;
437      g->classname = classname;
438    }
439    
440    void
441    add_infoname (graph_t *g, int integer, const char *string)
442    {
443      struct infoname_s *infoname;
444      
445      infoname = XMALLOC (struct infoname_s, 1);
446      infoname->integer = integer;
447      infoname->string = string;
448      infoname->next = g->infoname;
449      g->infoname = infoname;
450    }
451    
452    /* Build a colorentry struct and add it to the list.  */
453    void
454    add_colorentry (graph_t *g, int color_idx, int red_cp,
455                    int green_cp, int blue_cp)
456    {
457      struct colorentry_s *ce;
458      
459      ce = XMALLOC (struct colorentry_s, 1);
460      ce->color_index = color_idx;
461      ce->red_cp = red_cp;
462      ce->green_cp = green_cp;
463      ce->blue_cp = blue_cp;
464      ce->next = g->colorentry;
465      g->colorentry = ce;
466    }
467    
468  /*-------------------------------------.  /*-------------------------------------.
469  | Open and close functions (formatted) |  | Open and close functions (formatted) |
470  `-------------------------------------*/  `-------------------------------------*/
471    
472  void  void
473  open_edge(edge_t *edge, struct obstack *os)  open_edge(edge_t *edge, FILE *fout)
474  {  {
475    switch (edge->type)    switch (edge->type)
476      {      {
477      case normal_edge:      case normal_edge:
478        obstack_sgrow (os, "\tedge: {\n");        fputs ("\tedge: {\n", fout);
479        break;        break;
480      case back_edge:      case back_edge:
481        obstack_sgrow (os, "\tbackedge: {\n");        fputs ("\tbackedge: {\n", fout);
482        break;        break;
483      case near_edge:      case near_edge:
484        obstack_sgrow (os, "\tnearedge: {\n");        fputs ("\tnearedge: {\n", fout);
485        break;        break;
486      case bent_near_edge:      case bent_near_edge:
487        obstack_sgrow (os, "\tbentnearedge: {\n");        fputs ("\tbentnearedge: {\n", fout);
488        break;        break;
489      default:      default:
490        obstack_sgrow (os, "\tedge: {\n");        fputs ("\tedge: {\n", fout);
491      }      }
492  }  }
493    
494  void  void
495  close_edge(struct obstack *os)  close_edge(FILE *fout)
496  {  {
497    obstack_sgrow (os, "\t}\n");    fputs ("\t}\n", fout);
498  }  }
499    
500  void  void
501  open_node(struct obstack *os)  open_node(FILE *fout)
502  {  {
503    obstack_sgrow (os, "\tnode: {\n");    fputs ("\tnode: {\n", fout);
504  }  }
505    
506  void  void
507  close_node(struct obstack *os)  close_node(FILE *fout)
508  {  {
509    obstack_sgrow (os, "\t}\n");    fputs ("\t}\n", fout);
510  }  }
511    
512  void  void
513  open_graph(struct obstack *os)  open_graph(FILE *fout)
514  {  {
515    obstack_sgrow (os, "graph: {\n");    fputs ("graph: {\n", fout);
516  }  }
517    
518  void  void
519  close_graph(graph_t *graph, struct obstack *os)  close_graph(graph_t *graph, FILE *fout)
520  {  {
521    obstack_1grow (os, '\n');    fputc ('\n', fout);
522    
523      /* FIXME: Unallocate nodes and edges if required.  */
524    {    {
525      node_t *node;      node_t *node;
526    
527      for (node = graph->node_list; node; node = node->next)      for (node = graph->node_list; node; node = node->next)
528        {        {
529          open_node (os);          open_node (fout);
530          output_node (node, os);          output_node (node, fout);
531          close_node (os);          close_node (fout);
532        }        }
533    }    }
534    
535    obstack_1grow (os, '\n');    fputc ('\n', fout);
536    
537    {    {
538      edge_t *edge;      edge_t *edge;
539    
540      for (edge = graph->edge_list; edge; edge = edge->next)      for (edge = graph->edge_list; edge; edge = edge->next)
541        {        {
542          open_edge (edge, os);          open_edge (edge, fout);
543          output_edge (edge, os);          output_edge (edge, fout);
544          close_edge (os);          close_edge (fout);
545        }        }
546    }    }
547    
548    obstack_sgrow (os, "}\n");    fputs ("}\n", fout);
549  }  }
550    
551  /*-------------------------------------------.  /*-------------------------------------------.
552  | Output functions (formatted) in obstack os |  | Output functions (formatted) in file FOUT  |
553  `-------------------------------------------*/  `-------------------------------------------*/
554    
555  void  void
556  output_node (node_t *node, struct obstack *os)  output_node (node_t *node, FILE *fout)
557  {  {
558    if (node->title != N_TITLE)    if (node->title != N_TITLE)
559      obstack_fgrow1 (os, "\t\ttitle:\t\"%s\"\n", node->title);      fprintf (fout, "\t\ttitle:\t\"%s\"\n", node->title);
560    if (node->label != N_LABEL)    if (node->label != N_LABEL)
561      obstack_fgrow1 (os, "\t\tlabel:\t\"%s\"\n", node->label);      fprintf (fout, "\t\tlabel:\t\"%s\"\n", node->label);
562    
563    if ((node->locx != N_LOCX) && (node->locy != N_LOCY))    if ((node->locx != N_LOCX) && (node->locy != N_LOCY))
564      obstack_fgrow2 (os, "\t\tloc { x: %d  y: %d }\t\n", node->locx, node->locy);      fprintf (fout, "\t\tloc { x: %d  y: %d }\t\n", node->locx, node->locy);
565    
566    if (node->vertical_order != N_VERTICAL_ORDER)    if (node->vertical_order != N_VERTICAL_ORDER)
567      obstack_fgrow1 (os, "\t\tvertical_order:\t%d\n", node->vertical_order);      fprintf (fout, "\t\tvertical_order:\t%d\n", node->vertical_order);
568    if (node->horizontal_order != N_HORIZONTAL_ORDER)    if (node->horizontal_order != N_HORIZONTAL_ORDER)
569      obstack_fgrow1 (os, "\t\thorizontal_order:\t%d\n", node->horizontal_order);      fprintf (fout, "\t\thorizontal_order:\t%d\n", node->horizontal_order);
570    
571    if (node->width != N_WIDTH)    if (node->width != N_WIDTH)
572      obstack_fgrow1 (os, "\t\twidth:\t%d\n", node->width);      fprintf (fout, "\t\twidth:\t%d\n", node->width);
573    if (node->height != N_HEIGHT)    if (node->height != N_HEIGHT)
574      obstack_fgrow1 (os, "\t\theight:\t%d\n", node->height);      fprintf (fout, "\t\theight:\t%d\n", node->height);
575    
576    if (node->shrink != N_SHRINK)    if (node->shrink != N_SHRINK)
577      obstack_fgrow1 (os, "\t\tshrink:\t%d\n", node->shrink);      fprintf (fout, "\t\tshrink:\t%d\n", node->shrink);
578    if (node->stretch != N_STRETCH)    if (node->stretch != N_STRETCH)
579      obstack_fgrow1 (os, "\t\tstretch:\t%d\n", node->stretch);      fprintf (fout, "\t\tstretch:\t%d\n", node->stretch);
580    
581    if (node->folding != N_FOLDING)    if (node->folding != N_FOLDING)
582      obstack_fgrow1 (os, "\t\tfolding:\t%d\n", node->folding);      fprintf (fout, "\t\tfolding:\t%d\n", node->folding);
583    
584    if (node->textmode != N_TEXTMODE)    if (node->textmode != N_TEXTMODE)
585      obstack_fgrow1 (os, "\t\ttextmode:\t%s\n",      fprintf (fout, "\t\ttextmode:\t%s\n",
586                      get_textmode_str (node->textmode));               get_textmode_str (node->textmode));
587    
588    if (node->shape != N_SHAPE)    if (node->shape != N_SHAPE)
589      obstack_fgrow1 (os, "\t\tshape:\t%s\n", get_shape_str (node->shape));      fprintf (fout, "\t\tshape:\t%s\n", get_shape_str (node->shape));
590    
591    if (node->borderwidth != N_BORDERWIDTH)    if (node->borderwidth != N_BORDERWIDTH)
592      obstack_fgrow1 (os, "\t\tborderwidth:\t%d\n", node->borderwidth);      fprintf (fout, "\t\tborderwidth:\t%d\n", node->borderwidth);
593    
594    if (node->color != N_COLOR)    if (node->color != N_COLOR)
595      obstack_fgrow1 (os, "\t\tcolor:\t%s\n", get_color_str (node->color));      fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (node->color));
596    if (node->textcolor != N_TEXTCOLOR)    if (node->textcolor != N_TEXTCOLOR)
597      obstack_fgrow1 (os, "\t\ttextcolor:\t%s\n",      fprintf (fout, "\t\ttextcolor:\t%s\n",
598                      get_color_str (node->textcolor));               get_color_str (node->textcolor));
599    if (node->bordercolor != N_BORDERCOLOR)    if (node->bordercolor != N_BORDERCOLOR)
600      obstack_fgrow1 (os, "\t\tbordercolor:\t%s\n",      fprintf (fout, "\t\tbordercolor:\t%s\n",
601                      get_color_str (node->bordercolor));               get_color_str (node->bordercolor));
602    
603    if (node->infos[0])    if (node->infos[0])
604      obstack_fgrow1 (os, "\t\tinfo1:\t\"%s\"\n", node->infos[0]);      fprintf (fout, "\t\tinfo1:\t\"%s\"\n", node->infos[0]);
605    if (node->infos[1])    if (node->infos[1])
606      obstack_fgrow1 (os, "\t\tinfo2:\t\"%s\"\n", node->infos[1]);      fprintf (fout, "\t\tinfo2:\t\"%s\"\n", node->infos[1]);
607    if (node->infos[2])    if (node->infos[2])
608      obstack_fgrow1 (os, "\t\tinfo3:\t\"%s\"\n", node->infos[2]);      fprintf (fout, "\t\tinfo3:\t\"%s\"\n", node->infos[2]);
609  }  }
610    
611  void  void
612  output_edge (edge_t *edge, struct obstack *os)  output_edge (edge_t *edge, FILE *fout)
613  {  {
614    /* FIXME: SOURCENAME and TARGETNAME are mandatory    /* FIXME: SOURCENAME and TARGETNAME are mandatory
615       so it has to be fatal not to give these informations.  */       so it has to be fatal not to give these informations.  */
616    if (edge->sourcename != E_SOURCENAME)    if (edge->sourcename != E_SOURCENAME)
617      obstack_fgrow1 (os, "\t\tsourcename:\t\"%s\"\n", edge->sourcename);      fprintf (fout, "\t\tsourcename:\t\"%s\"\n", edge->sourcename);
618    if (edge->targetname != E_TARGETNAME)    if (edge->targetname != E_TARGETNAME)
619      obstack_fgrow1 (os, "\t\ttargetname:\t\"%s\"\n", edge->targetname);      fprintf (fout, "\t\ttargetname:\t\"%s\"\n", edge->targetname);
620    
621    if (edge->label != E_LABEL)    if (edge->label != E_LABEL)
622      obstack_fgrow1 (os, "\t\tlabel:\t\"%s\"\n", edge->label);      fprintf (fout, "\t\tlabel:\t\"%s\"\n", edge->label);
623    
624    if (edge->linestyle != E_LINESTYLE)    if (edge->linestyle != E_LINESTYLE)
625      obstack_fgrow1 (os, "\t\tlinestyle:\t\"%s\"\n",      fprintf (fout, "\t\tlinestyle:\t\"%s\"\n",
626                      get_linestyle_str(edge->linestyle));               get_linestyle_str(edge->linestyle));
627    
628    if (edge->thickness != E_THICKNESS)    if (edge->thickness != E_THICKNESS)
629      obstack_fgrow1 (os, "\t\tthickness:\t%d\n", edge->thickness);      fprintf (fout, "\t\tthickness:\t%d\n", edge->thickness);
630    if (edge->class != E_CLASS)    if (edge->class != E_CLASS)
631      obstack_fgrow1 (os, "\t\tclass:\t%d\n", edge->class);      fprintf (fout, "\t\tclass:\t%d\n", edge->class);
632    
633    if (edge->color != E_COLOR)    if (edge->color != E_COLOR)
634      obstack_fgrow1 (os, "\t\tcolor:\t%s\n", get_color_str (edge->color));      fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (edge->color));
635    if (edge->color != E_TEXTCOLOR)    if (edge->color != E_TEXTCOLOR)
636      obstack_fgrow1 (os, "\t\ttextcolor:\t%s\n",      fprintf (fout, "\t\ttextcolor:\t%s\n",
637                      get_color_str (edge->textcolor));               get_color_str (edge->textcolor));
638    if (edge->arrowcolor != E_ARROWCOLOR)    if (edge->arrowcolor != E_ARROWCOLOR)
639      obstack_fgrow1 (os, "\t\tarrowcolor:\t%s\n",      fprintf (fout, "\t\tarrowcolor:\t%s\n",
640                      get_color_str (edge->arrowcolor));               get_color_str (edge->arrowcolor));
641    if (edge->backarrowcolor != E_BACKARROWCOLOR)    if (edge->backarrowcolor != E_BACKARROWCOLOR)
642      obstack_fgrow1 (os, "\t\tbackarrowcolor:\t%s\n",      fprintf (fout, "\t\tbackarrowcolor:\t%s\n",
643                      get_color_str (edge->backarrowcolor));               get_color_str (edge->backarrowcolor));
644    
645    if (edge->arrowsize != E_ARROWSIZE)    if (edge->arrowsize != E_ARROWSIZE)
646      obstack_fgrow1 (os, "\t\tarrowsize:\t%d\n", edge->arrowsize);      fprintf (fout, "\t\tarrowsize:\t%d\n", edge->arrowsize);
647    if (edge->backarrowsize != E_BACKARROWSIZE)    if (edge->backarrowsize != E_BACKARROWSIZE)
648      obstack_fgrow1 (os, "\t\tbackarrowsize:\t%d\n", edge->backarrowsize);      fprintf (fout, "\t\tbackarrowsize:\t%d\n", edge->backarrowsize);
649    
650    if (edge->arrowstyle != E_ARROWSTYLE)    if (edge->arrowstyle != E_ARROWSTYLE)
651      obstack_fgrow1 (os, "\t\tarrowstyle:\t%s\n",      fprintf (fout, "\t\tarrowstyle:\t%s\n",
652                      get_arrowstyle_str(edge->arrowstyle));               get_arrowstyle_str(edge->arrowstyle));
653    if (edge->backarrowstyle != E_BACKARROWSTYLE)    if (edge->backarrowstyle != E_BACKARROWSTYLE)
654      obstack_fgrow1 (os, "\t\tbackarrowstyle:\t%s\n",      fprintf (fout, "\t\tbackarrowstyle:\t%s\n",
655                      get_arrowstyle_str(edge->backarrowstyle));               get_arrowstyle_str(edge->backarrowstyle));
656    
657    if (edge->priority != E_PRIORITY)    if (edge->priority != E_PRIORITY)
658      obstack_fgrow1 (os, "\t\tpriority:\t%d\n", edge->priority);      fprintf (fout, "\t\tpriority:\t%d\n", edge->priority);
659    if (edge->anchor != E_ANCHOR)    if (edge->anchor != E_ANCHOR)
660      obstack_fgrow1 (os, "\t\tanchor:\t%d\n", edge->anchor);      fprintf (fout, "\t\tanchor:\t%d\n", edge->anchor);
661    if (edge->horizontal_order != E_HORIZONTAL_ORDER)    if (edge->horizontal_order != E_HORIZONTAL_ORDER)
662      obstack_fgrow1 (os, "\t\thorizontal_order:\t%d\n", edge->horizontal_order);      fprintf (fout, "\t\thorizontal_order:\t%d\n", edge->horizontal_order);
663  }  }
664    
665  void  void
666  output_graph (graph_t *graph, struct obstack *os)  output_graph (graph_t *graph, FILE *fout)
667  {  {
668    if (graph->title)    if (graph->title)
669      obstack_fgrow1 (os, "\ttitle:\t\"%s\"\n", graph->title);      fprintf (fout, "\ttitle:\t\"%s\"\n", graph->title);
670    if (graph->label)    if (graph->label)
671      obstack_fgrow1 (os, "\tlabel:\t\"%s\"\n", graph->label);      fprintf (fout, "\tlabel:\t\"%s\"\n", graph->label);
672    
673    if (graph->infos[0])    if (graph->infos[0])
674      obstack_fgrow1 (os, "\tinfo1:\t\"%s\"\n", graph->infos[0]);      fprintf (fout, "\tinfo1:\t\"%s\"\n", graph->infos[0]);
675    if (graph->infos[1])    if (graph->infos[1])
676      obstack_fgrow1 (os, "\tinfo2:\t\"%s\"\n", graph->infos[1]);      fprintf (fout, "\tinfo2:\t\"%s\"\n", graph->infos[1]);
677    if (graph->infos[2])    if (graph->infos[2])
678      obstack_fgrow1 (os, "\tinfo3:\t\"%s\"\n", graph->infos[2]);      fprintf (fout, "\tinfo3:\t\"%s\"\n", graph->infos[2]);
679    
680    if (graph->color != G_COLOR)    if (graph->color != G_COLOR)
681      obstack_fgrow1 (os, "\tcolor:\t%s\n", get_color_str (graph->color));      fprintf (fout, "\tcolor:\t%s\n", get_color_str (graph->color));
682    if (graph->textcolor != G_TEXTCOLOR)    if (graph->textcolor != G_TEXTCOLOR)
683      obstack_fgrow1 (os, "\ttextcolor:\t%s\n", get_color_str (graph->textcolor));      fprintf (fout, "\ttextcolor:\t%s\n", get_color_str (graph->textcolor));
684    if (graph->bordercolor != G_BORDERCOLOR)    if (graph->bordercolor != G_BORDERCOLOR)
685      obstack_fgrow1 (os, "\tbordercolor:\t%s\n",      fprintf (fout, "\tbordercolor:\t%s\n",
686                      get_color_str (graph->bordercolor));               get_color_str (graph->bordercolor));
687    
688    if (graph->width != G_WIDTH)    if (graph->width != G_WIDTH)
689      obstack_fgrow1 (os, "\twidth:\t%d\n", graph->width);      fprintf (fout, "\twidth:\t%d\n", graph->width);
690    if (graph->height != G_HEIGHT)    if (graph->height != G_HEIGHT)
691      obstack_fgrow1 (os, "\theight:\t%d\n", graph->height);      fprintf (fout, "\theight:\t%d\n", graph->height);
692    if (graph->borderwidth != G_BORDERWIDTH)    if (graph->borderwidth != G_BORDERWIDTH)
693      obstack_fgrow1 (os, "\tborderwidth:\t%d\n", graph->borderwidth);      fprintf (fout, "\tborderwidth:\t%d\n", graph->borderwidth);
694    
695    if (graph->x != G_X)    if (graph->x != G_X)
696      obstack_fgrow1 (os, "\tx:\t%d\n", graph->x);      fprintf (fout, "\tx:\t%d\n", graph->x);
697    if (graph->y != G_Y)    if (graph->y != G_Y)
698      obstack_fgrow1 (os, "\ty:\t%d\n", graph->y);      fprintf (fout, "\ty:\t%d\n", graph->y);
699    
700    if (graph->folding != G_FOLDING)    if (graph->folding != G_FOLDING)
701      obstack_fgrow1 (os, "\tfolding:\t%d\n", graph->folding);      fprintf (fout, "\tfolding:\t%d\n", graph->folding);
702    
703    if (graph->shrink != G_SHRINK)    if (graph->shrink != G_SHRINK)
704      obstack_fgrow1 (os, "\tshrink:\t%d\n", graph->shrink);      fprintf (fout, "\tshrink:\t%d\n", graph->shrink);
705    if (graph->stretch != G_STRETCH)    if (graph->stretch != G_STRETCH)
706      obstack_fgrow1 (os, "\tstretch:\t%d\n", graph->stretch);      fprintf (fout, "\tstretch:\t%d\n", graph->stretch);
707    
708    if (graph->textmode != G_TEXTMODE)    if (graph->textmode != G_TEXTMODE)
709      obstack_fgrow1 (os, "\ttextmode:\t%s\n",      fprintf (fout, "\ttextmode:\t%s\n",
710                      get_textmode_str (graph->textmode));               get_textmode_str (graph->textmode));
711    
712    if (graph->shape != G_SHAPE)    if (graph->shape != G_SHAPE)
713      obstack_fgrow1 (os, "\tshape:\t%s\n", get_shape_str (graph->shape));      fprintf (fout, "\tshape:\t%s\n", get_shape_str (graph->shape));
714      
715      if (graph->vertical_order != G_VERTICAL_ORDER)
716        fprintf (fout, "\tvertical_order:\t%d\n", graph->vertical_order);  
717      if (graph->horizontal_order != G_HORIZONTAL_ORDER)
718        fprintf (fout, "\thorizontal_order:\t%d\n", graph->horizontal_order);  
719    
720    if (graph->xmax != G_XMAX)    if (graph->xmax != G_XMAX)
721      obstack_fgrow1 (os, "\txmax:\t%d\n", graph->xmax);      fprintf (fout, "\txmax:\t%d\n", graph->xmax);
722    if (graph->ymax != G_YMAX)    if (graph->ymax != G_YMAX)
723      obstack_fgrow1 (os, "\tymax:\t%d\n", graph->ymax);      fprintf (fout, "\tymax:\t%d\n", graph->ymax);
724    
725    if (graph->xbase != G_XBASE)    if (graph->xbase != G_XBASE)
726      obstack_fgrow1 (os, "\txbase:\t%d\n", graph->xbase);      fprintf (fout, "\txbase:\t%d\n", graph->xbase);
727    if (graph->ybase != G_YBASE)    if (graph->ybase != G_YBASE)
728      obstack_fgrow1 (os, "\tybase:\t%d\n", graph->ybase);      fprintf (fout, "\tybase:\t%d\n", graph->ybase);
729    
730    if (graph->xspace != G_XSPACE)    if (graph->xspace != G_XSPACE)
731      obstack_fgrow1 (os, "\txspace:\t%d\n", graph->xspace);      fprintf (fout, "\txspace:\t%d\n", graph->xspace);
732    if (graph->yspace != G_YSPACE)    if (graph->yspace != G_YSPACE)
733      obstack_fgrow1 (os, "\tyspace:\t%d\n", graph->yspace);      fprintf (fout, "\tyspace:\t%d\n", graph->yspace);
734    if (graph->xlspace != G_XLSPACE)    if (graph->xlspace != G_XLSPACE)
735      obstack_fgrow1 (os, "\txlspace:\t%d\n", graph->xlspace);      fprintf (fout, "\txlspace:\t%d\n", graph->xlspace);
736    
737    if (graph->xraster != G_XRASTER)    if (graph->xraster != G_XRASTER)
738      obstack_fgrow1 (os, "\txraster:\t%d\n", graph->xraster);      fprintf (fout, "\txraster:\t%d\n", graph->xraster);
739    if (graph->yraster != G_YRASTER)    if (graph->yraster != G_YRASTER)
740      obstack_fgrow1 (os, "\tyraster:\t%d\n", graph->yraster);      fprintf (fout, "\tyraster:\t%d\n", graph->yraster);
741    if (graph->xlraster != G_XLRASTER)    if (graph->xlraster != G_XLRASTER)
742      obstack_fgrow1 (os, "\txlraster:\t%d\n", graph->xlraster);      fprintf (fout, "\txlraster:\t%d\n", graph->xlraster);
743    
744    if (graph->hidden != G_HIDDEN)    if (graph->hidden != G_HIDDEN)
745      obstack_fgrow1 (os, "\thidden:\t%d\n", graph->hidden);      fprintf (fout, "\thidden:\t%d\n", graph->hidden);
746      
747      /* FIXME: Unallocate struct list if required.  
748         Maybe with a little function.  */
749    if (graph->classname != G_CLASSNAME)    if (graph->classname != G_CLASSNAME)
750      {      {
751        struct classname_s *ite;        struct classname_s *ite;
752    
753        for (ite = graph->classname; ite; ite = ite->next)        for (ite = graph->classname; ite; ite = ite->next)
754          obstack_fgrow2 (os, "\tclassname %d :\t%s\n", ite->no, ite->name);          fprintf (fout, "\tclassname %d :\t%s\n", ite->no, ite->name);
755        }
756    
757      if (graph->infoname != G_INFONAME)
758        {
759          struct infoname_s *ite;
760    
761          for (ite = graph->infoname; ite; ite = ite->next)
762            fprintf (fout, "\tinfoname %d :\t%s\n", ite->integer, ite->string);
763        }
764    
765      if (graph->colorentry != G_COLORENTRY)
766        {
767          struct colorentry_s *ite;
768          
769          for (ite = graph->colorentry; ite; ite = ite->next)
770            {      
771              fprintf (fout, "\tcolorentry %d :\t%d %d %d\n",
772                       ite->color_index,
773                       ite->red_cp,
774                       ite->green_cp,
775                       ite->blue_cp);
776            }    
777      }      }
778    
779    if (graph->layoutalgorithm != G_LAYOUTALGORITHM)    if (graph->layoutalgorithm != G_LAYOUTALGORITHM)
780      obstack_fgrow1 (os, "\tlayoutalgorithm:\t%s\n",      fprintf (fout, "\tlayoutalgorithm:\t%s\n",
781                      get_layoutalgorithm_str(graph->layoutalgorithm));               get_layoutalgorithm_str(graph->layoutalgorithm));
782    
783    if (graph->layout_downfactor != G_LAYOUT_DOWNFACTOR)    if (graph->layout_downfactor != G_LAYOUT_DOWNFACTOR)
784      obstack_fgrow1 (os, "\tlayout_downfactor:\t%d\n", graph->layout_downfactor);      fprintf (fout, "\tlayout_downfactor:\t%d\n", graph->layout_downfactor);
785    if (graph->layout_upfactor != G_LAYOUT_UPFACTOR)    if (graph->layout_upfactor != G_LAYOUT_UPFACTOR)
786      obstack_fgrow1 (os, "\tlayout_upfactor:\t%d\n", graph->layout_upfactor);      fprintf (fout, "\tlayout_upfactor:\t%d\n", graph->layout_upfactor);
787    if (graph->layout_nearfactor != G_LAYOUT_NEARFACTOR)    if (graph->layout_nearfactor != G_LAYOUT_NEARFACTOR)
788      obstack_fgrow1 (os, "\tlayout_nearfactor:\t%d\n", graph->layout_nearfactor);      fprintf (fout, "\tlayout_nearfactor:\t%d\n", graph->layout_nearfactor);
789    if (graph->layout_splinefactor != G_LAYOUT_SPLINEFACTOR)    if (graph->layout_splinefactor != G_LAYOUT_SPLINEFACTOR)
790      obstack_fgrow1 (os, "\tlayout_splinefactor:\t%d\n",      fprintf (fout, "\tlayout_splinefactor:\t%d\n",
791                      graph->layout_splinefactor);               graph->layout_splinefactor);
792    
793    if (graph->late_edge_labels != G_LATE_EDGE_LABELS)    if (graph->late_edge_labels != G_LATE_EDGE_LABELS)
794      obstack_fgrow1 (os, "\tlate_edge_labels:\t%s\n",      fprintf (fout, "\tlate_edge_labels:\t%s\n",
795                      get_decision_str(graph->late_edge_labels,               get_decision_str(graph->late_edge_labels));
                                      G_LATE_EDGE_LABELS));  
796    if (graph->display_edge_labels != G_DISPLAY_EDGE_LABELS)    if (graph->display_edge_labels != G_DISPLAY_EDGE_LABELS)
797      obstack_fgrow1 (os, "\tdisplay_edge_labels:\t%s\n",      fprintf (fout, "\tdisplay_edge_labels:\t%s\n",
798                      get_decision_str(graph->display_edge_labels,               get_decision_str(graph->display_edge_labels));
                                      G_DISPLAY_EDGE_LABELS));  
799    if (graph->dirty_edge_labels != G_DIRTY_EDGE_LABELS)    if (graph->dirty_edge_labels != G_DIRTY_EDGE_LABELS)
800      obstack_fgrow1 (os, "\tdirty_edge_labels:\t%s\n",      fprintf (fout, "\tdirty_edge_labels:\t%s\n",
801                      get_decision_str(graph->dirty_edge_labels,               get_decision_str(graph->dirty_edge_labels));
                                      G_DIRTY_EDGE_LABELS));  
802    if (graph->finetuning != G_FINETUNING)    if (graph->finetuning != G_FINETUNING)
803      obstack_fgrow1 (os, "\tfinetuning:\t%s\n",      fprintf (fout, "\tfinetuning:\t%s\n",
804                      get_decision_str(graph->finetuning, G_FINETUNING));               get_decision_str(graph->finetuning));
805    if (graph->ignore_singles != G_IGNORE_SINGLES)    if (graph->ignore_singles != G_IGNORE_SINGLES)
806      obstack_fgrow1 (os, "\tignore_singles:\t%s\n",      fprintf (fout, "\tignore_singles:\t%s\n",
807                      get_decision_str(graph->ignore_singles, G_IGNORE_SINGLES));               get_decision_str(graph->ignore_singles));
808    if (graph->straight_phase != G_STRAIGHT_PHASE)    if (graph->straight_phase != G_STRAIGHT_PHASE)
809      obstack_fgrow1 (os, "\tstraight_phase:\t%s\n",      fprintf (fout, "\tstraight_phase:\t%s\n",
810                      get_decision_str(graph->straight_phase, G_STRAIGHT_PHASE));               get_decision_str(graph->straight_phase));
811    if (graph->priority_phase != G_PRIORITY_PHASE)    if (graph->priority_phase != G_PRIORITY_PHASE)
812      obstack_fgrow1 (os, "\tpriority_phase:\t%s\n",      fprintf (fout, "\tpriority_phase:\t%s\n",
813                      get_decision_str(graph->priority_phase, G_PRIORITY_PHASE));               get_decision_str(graph->priority_phase));
814    if (graph->manhattan_edges != G_MANHATTAN_EDGES)    if (graph->manhattan_edges != G_MANHATTAN_EDGES)
815      obstack_fgrow1 (os,      fprintf (fout,
816                      "\tmanhattan_edges:\t%s\n",               "\tmanhattan_edges:\t%s\n",
817                      get_decision_str(graph->manhattan_edges,               get_decision_str(graph->manhattan_edges));
                                      G_MANHATTAN_EDGES));  
818    if (graph->smanhattan_edges != G_SMANHATTAN_EDGES)    if (graph->smanhattan_edges != G_SMANHATTAN_EDGES)
819      obstack_fgrow1 (os,      fprintf (fout,
820                      "\tsmanhattan_edges:\t%s\n",               "\tsmanhattan_edges:\t%s\n",
821                      get_decision_str(graph->smanhattan_edges,               get_decision_str(graph->smanhattan_edges));
                                      G_SMANHATTAN_EDGES));  
822    if (graph->near_edges != G_NEAR_EDGES)    if (graph->near_edges != G_NEAR_EDGES)
823      obstack_fgrow1 (os, "\tnear_edges:\t%s\n",      fprintf (fout, "\tnear_edges:\t%s\n",
824                      get_decision_str(graph->near_edges, G_NEAR_EDGES));               get_decision_str(graph->near_edges));
825    
826    if (graph->orientation != G_ORIENTATION)    if (graph->orientation != G_ORIENTATION)
827      obstack_fgrow1 (os, "\torientation:\t%s\n",      fprintf (fout, "\torientation:\t%s\n",
828                      get_decision_str(graph->orientation, G_ORIENTATION));               get_orientation_str(graph->orientation));
829    
830    if (graph->node_alignement != G_NODE_ALIGNEMENT)    if (graph->node_alignement != G_NODE_ALIGNEMENT)
831      obstack_fgrow1 (os, "\tnode_alignement:\t%s\n",      fprintf (fout, "\tnode_alignement:\t%s\n",
832                      get_decision_str(graph->node_alignement,               get_node_alignement_str(graph->node_alignement));
                                      G_NODE_ALIGNEMENT));  
833    
834    if (graph->port_sharing != G_PORT_SHARING)    if (graph->port_sharing != G_PORT_SHARING)
835      obstack_fgrow1 (os, "\tport_sharing:\t%s\n",      fprintf (fout, "\tport_sharing:\t%s\n",
836                      get_decision_str(graph->port_sharing, G_PORT_SHARING));               get_decision_str(graph->port_sharing));
837    
838    if (graph->arrow_mode != G_ARROW_MODE)    if (graph->arrow_mode != G_ARROW_MODE)
839      obstack_fgrow1 (os, "\tarrow_mode:\t%s\n",      fprintf (fout, "\tarrow_mode:\t%s\n",
840                      get_arrow_mode_str(graph->arrow_mode));               get_arrow_mode_str(graph->arrow_mode));
841    
842    if (graph->treefactor != G_TREEFACTOR)    if (graph->treefactor != G_TREEFACTOR)
843      obstack_fgrow1 (os, "\ttreefactor:\t%f\n", graph->treefactor);      fprintf (fout, "\ttreefactor:\t%f\n", graph->treefactor);
844    if (graph->spreadlevel != G_SPREADLEVEL)    if (graph->spreadlevel != G_SPREADLEVEL)
845      obstack_fgrow1 (os, "\tspreadlevel:\t%d\n", graph->spreadlevel);      fprintf (fout, "\tspreadlevel:\t%d\n", graph->spreadlevel);
846    
847    if (graph->crossing_weight != G_CROSSING_WEIGHT)    if (graph->crossing_weight != G_CROSSING_WEIGHT)
848      obstack_fgrow1 (os, "\tcrossing_weight:\t%s\n",      fprintf (fout, "\tcrossing_weight:\t%s\n",
849                      get_crossing_type_str(graph->crossing_weight));               get_crossing_type_str(graph->crossing_weight));
850    if (graph->crossing_phase2 != G_CROSSING_PHASE2)    if (graph->crossing_phase2 != G_CROSSING_PHASE2)
851      obstack_fgrow1 (os, "\tcrossing_phase2:\t%s\n",      fprintf (fout, "\tcrossing_phase2:\t%s\n",
852                      get_decision_str(graph->crossing_phase2,               get_decision_str(graph->crossing_phase2));
                                      G_CROSSING_PHASE2));  
853    if (graph->crossing_optimization != G_CROSSING_OPTIMIZATION)    if (graph->crossing_optimization != G_CROSSING_OPTIMIZATION)
854      obstack_fgrow1 (os, "\tcrossing_optimization:\t%s\n",      fprintf (fout, "\tcrossing_optimization:\t%s\n",
855                      get_decision_str(graph->crossing_optimization,               get_decision_str(graph->crossing_optimization));
                                      G_CROSSING_OPTIMIZATION));  
856    
857    if (graph->view != G_VIEW)    if (graph->view != G_VIEW)
858      obstack_fgrow1 (os, "\tview:\t%s\n", get_view_str(graph->view));      fprintf (fout, "\tview:\t%s\n", get_view_str(graph->view));
859    
860    if (graph->edges != G_EDGES)    if (graph->edges != G_EDGES)
861      obstack_fgrow1 (os, "\tedges:\t%s\n", get_decision_str(graph->edges,      fprintf (fout, "\tedges:\t%s\n", get_decision_str(graph->edges));
                                                            G_EDGES));  
862    
863    if (graph->nodes != G_NODES)    if (graph->nodes != G_NODES)
864      obstack_fgrow1 (os,"\tnodes:\t%s\n",      fprintf (fout,"\tnodes:\t%s\n", get_decision_str(graph->nodes));
                     get_decision_str(graph->nodes, G_NODES));  
865    
866    if (graph->splines != G_SPLINES)    if (graph->splines != G_SPLINES)
867      obstack_fgrow1 (os, "\tsplines:\t%s\n",      fprintf (fout, "\tsplines:\t%s\n", get_decision_str(graph->splines));
                     get_decision_str(graph->splines, G_SPLINES));  
868    
869    if (graph->bmax != G_BMAX)    if (graph->bmax != G_BMAX)
870      obstack_fgrow1 (os, "\tbmax:\t%d\n", graph->bmax);      fprintf (fout, "\tbmax:\t%d\n", graph->bmax);
871    if (graph->cmin != G_CMIN)    if (graph->cmin != G_CMIN)
872      obstack_fgrow1 (os, "\tcmin:\t%d\n", graph->cmin);      fprintf (fout, "\tcmin:\t%d\n", graph->cmin);
873    if (graph->cmax != G_CMAX)    if (graph->cmax != G_CMAX)
874      obstack_fgrow1 (os, "\tcmax:\t%d\n", graph->cmax);      fprintf (fout, "\tcmax:\t%d\n", graph->cmax);
875    if (graph->pmin != G_PMIN)    if (graph->pmin != G_PMIN)
876      obstack_fgrow1 (os, "\tpmin:\t%d\n", graph->pmin);      fprintf (fout, "\tpmin:\t%d\n", graph->pmin);
877    if (graph->pmax != G_PMAX)    if (graph->pmax != G_PMAX)
878      obstack_fgrow1 (os, "\tpmax:\t%d\n", graph->pmax);      fprintf (fout, "\tpmax:\t%d\n", graph->pmax);
879    if (graph->rmin != G_RMIN)    if (graph->rmin != G_RMIN)
880      obstack_fgrow1 (os, "\trmin:\t%d\n", graph->rmin);      fprintf (fout, "\trmin:\t%d\n", graph->rmin);
881    if (graph->rmax != G_RMAX)    if (graph->rmax != G_RMAX)
882      obstack_fgrow1 (os, "\trmax:\t%d\n", graph->rmax);      fprintf (fout, "\trmax:\t%d\n", graph->rmax);
883    if (graph->smax != G_SMAX)    if (graph->smax != G_SMAX)
884      obstack_fgrow1 (os, "\tsmax:\t%d\n", graph->smax);      fprintf (fout, "\tsmax:\t%d\n", graph->smax);
885  }  }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26