/[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.10 by eggert, Thu Nov 21 05:26:41 2002 UTC revision 1.11 by eggert, Wed Dec 11 06:56:18 2002 UTC
# Line 19  Line 19 
19     Boston, MA 02111-1307, USA.  */     Boston, MA 02111-1307, USA.  */
20    
21  #include "system.h"  #include "system.h"
22    
23    #include <quotearg.h>
24    
25  #include "vcg.h"  #include "vcg.h"
26  #include "vcg_defaults.h"  #include "vcg_defaults.h"
 #include "quotearg.h"  
27    
28  /* Return an unambiguous printable representated, for NAME, suitable  /* Return an unambiguous printable representated, for NAME, suitable
29     for C strings.  Use slot 2 since the user may use slots 0 and 1.     for C strings.  Use slot 2 since the user may use slots 0 and 1.
# Line 36  quote (char const *name) Line 38  quote (char const *name)
38    
39  /* Initialize a graph with the default values. */  /* Initialize a graph with the default values. */
40  void  void
41  new_graph (graph_t *g)  new_graph (graph *g)
42  {  {
43    g->title = G_TITLE;    g->title = G_TITLE;
44    g->label = G_LABEL;    g->label = G_LABEL;
# Line 56  new_graph (graph_t *g) Line 58  new_graph (graph_t *g)
58    g->y = G_Y;    g->y = G_Y;
59    g->folding = G_FOLDING;    g->folding = G_FOLDING;
60    g->shrink = G_SHRINK;    g->shrink = G_SHRINK;
61    g->stretch = G_STRETCH;    g->expand = G_EXPAND;
62    
63    g->textmode = G_TEXTMODE;    g->textmode = G_TEXTMODE;
64    g->shape = G_SHAPE;    g->shape = G_SHAPE;
# Line 93  new_graph (graph_t *g) Line 95  new_graph (graph_t *g)
95    g->dirty_edge_labels = G_DIRTY_EDGE_LABELS;    g->dirty_edge_labels = G_DIRTY_EDGE_LABELS;
96    g->finetuning = G_FINETUNING;    g->finetuning = G_FINETUNING;
97    g->ignore_singles = G_IGNORE_SINGLES;    g->ignore_singles = G_IGNORE_SINGLES;
98    g->straight_phase = G_STRAIGHT_PHASE;    g->long_straight_phase = G_LONG_STRAIGHT_PHASE;
99    g->priority_phase = G_PRIORITY_PHASE;    g->priority_phase = G_PRIORITY_PHASE;
100    g->manhattan_edges = G_MANHATTAN_EDGES;    g->manhattan_edges = G_MANHATTAN_EDGES;
101    g->smanhattan_edges = G_SMANHATTAN_EDGES;    g->smanhattan_edges = G_SMANHATTAN_EDGES;
102    g->near_edges = G_NEAR_EDGES;    g->near_edges = G_NEAR_EDGES;
103    
104    g->orientation = G_ORIENTATION;    g->orientation = G_ORIENTATION;
105    g->node_alignement = G_NODE_ALIGNEMENT;    g->node_alignment = G_NODE_ALIGNMENT;
106    g->port_sharing = G_PORT_SHARING;    g->port_sharing = G_PORT_SHARING;
107    g->arrow_mode = G_ARROW_MODE;    g->arrow_mode = G_ARROW_MODE;
108    g->treefactor = G_TREEFACTOR;    g->treefactor = G_TREEFACTOR;
# Line 126  new_graph (graph_t *g) Line 128  new_graph (graph_t *g)
128    g->node_list = G_NODE_LIST;    g->node_list = G_NODE_LIST;
129    g->edge_list = G_EDGE_LIST;    g->edge_list = G_EDGE_LIST;
130    
131    new_edge(&g->edge);    new_edge (&g->edge);
132    new_node(&g->node);    new_node (&g->node);
133  }  }
134    
135  /* Initialize a node with the defalut values. */  /* Initialize a node with the default values. */
136  void  void
137  new_node (node_t *node)  new_node (node *n)
138  {  {
139    node->title = N_TITLE;    n->title = N_TITLE;
140    node->label = N_LABEL;    n->label = N_LABEL;
141    
142    node->locx = N_LOCX; /* Default unspcified. */    n->locx = N_LOCX; /* Default unspcified. */
143    node->locy = N_LOCY; /* Default unspcified. */    n->locy = N_LOCY; /* Default unspcified. */
144    
145    node->vertical_order = N_VERTICAL_ORDER;      /* Default unspcified. */    n->vertical_order = N_VERTICAL_ORDER; /* Default unspcified. */
146    node->horizontal_order = N_HORIZONTAL_ORDER;  /* Default unspcified. */    n->horizontal_order = N_HORIZONTAL_ORDER;     /* Default unspcified. */
147    
148    node->width = N_WIDTH; /* We assume that we can't define it now. */    n->width = N_WIDTH; /* We assume that we can't define it now. */
149    node->height = N_HEIGHT; /* Also. */    n->height = N_HEIGHT; /* Also. */
150    
151    node->shrink = N_SHRINK;    n->shrink = N_SHRINK;
152    node->stretch = N_STRETCH;    n->expand = N_EXPAND;
153    
154    node->folding = N_FOLDING; /* No explicit default value. */    n->folding = N_FOLDING; /* No explicit default value. */
155    
156    node->shape = N_SHAPE;    n->shape = N_SHAPE;
157    node->textmode = N_TEXTMODE;    n->textmode = N_TEXTMODE;
158    node->borderwidth = N_BORDERWIDTH;    n->borderwidth = N_BORDERWIDTH;
159    
160    node->color = N_COLOR;    n->color = N_COLOR;
161    node->textcolor = N_TEXTCOLOR;    n->textcolor = N_TEXTCOLOR;
162    node->bordercolor = N_BORDERCOLOR;    n->bordercolor = N_BORDERCOLOR;
163    
164    node->infos[0] = N_INFOS1;    n->infos[0] = N_INFOS1;
165    node->infos[1] = N_INFOS2;    n->infos[1] = N_INFOS2;
166    node->infos[2] = N_INFOS3;    n->infos[2] = N_INFOS3;
167    
168    node->next = N_NEXT;    n->next = N_NEXT;
169  }  }
170    
171  /* Initialize a edge with the defalut values. */  /* Initialize an edge with the default values. */
172  void  void
173  new_edge (edge_t *edge)  new_edge (edge *e)
174  {  {
175    edge->type = E_EDGE_TYPE;    e->type = E_EDGE_TYPE;
176    
177    edge->sourcename = E_SOURCENAME;    e->sourcename = E_SOURCENAME;
178    edge->targetname = E_TARGETNAME;    e->targetname = E_TARGETNAME;
179    edge->label = E_LABEL;    e->label = E_LABEL;
180    
181    edge->linestyle = E_LINESTYLE;    e->linestyle = E_LINESTYLE;
182    edge->thickness = E_THICKNESS;    e->thickness = E_THICKNESS;
183    
184    edge->class = E_CLASS;    e->class = E_CLASS;
185    
186    edge->color = E_COLOR;    e->color = E_COLOR;
187    edge->textcolor = E_TEXTCOLOR;    e->textcolor = E_TEXTCOLOR;
188    edge->arrowcolor = E_ARROWCOLOR;    e->arrowcolor = E_ARROWCOLOR;
189    edge->backarrowcolor = E_BACKARROWCOLOR;    e->backarrowcolor = E_BACKARROWCOLOR;
190    
191    edge->arrowsize = E_ARROWSIZE;    e->arrowsize = E_ARROWSIZE;
192    edge->backarrowsize = E_BACKARROWSIZE;    e->backarrowsize = E_BACKARROWSIZE;
193    edge->arrowstyle = E_ARROWSTYLE;    e->arrowstyle = E_ARROWSTYLE;
194    
195    edge->backarrowstyle = E_BACKARROWSTYLE;    e->backarrowstyle = E_BACKARROWSTYLE;
196    
197    edge->priority = E_PRIORITY;    e->priority = E_PRIORITY;
198    
199    edge->anchor = E_ANCHOR;    e->anchor = E_ANCHOR;
200    
201    edge->horizontal_order = E_HORIZONTAL_ORDER;    e->horizontal_order = E_HORIZONTAL_ORDER;
202    
203    edge->next = E_NEXT;    e->next = E_NEXT;
204  }  }
205    
206  /*----------------------------------------------.  /*----------------------------------------------.
# Line 207  new_edge (edge_t *edge) Line 209  new_edge (edge_t *edge)
209  `----------------------------------------------*/  `----------------------------------------------*/
210    
211  static const char *  static const char *
212  get_color_str (enum color_e c)  get_color_str (enum color c)
213  {  {
214    switch (c)    switch (c)
215      {      {
# Line 248  get_color_str (enum color_e c) Line 250  get_color_str (enum color_e c)
250  }  }
251    
252  static const char *  static const char *
253  get_textmode_str (enum textmode_e t)  get_textmode_str (enum textmode t)
254  {  {
255    switch (t)    switch (t)
256      {      {
# Line 260  get_textmode_str (enum textmode_e t) Line 262  get_textmode_str (enum textmode_e t)
262  }  }
263    
264  static const char *  static const char *
265  get_shape_str (enum shape_e s)  get_shape_str (enum shape s)
266  {  {
267    switch (s)    switch (s)
268      {      {
# Line 273  get_shape_str (enum shape_e s) Line 275  get_shape_str (enum shape_e s)
275  }  }
276    
277  static const char *  static const char *
278  get_layoutalgorithm_str (enum layoutalgorithm_e l)  get_layoutalgorithm_str (enum layoutalgorithm l)
279  {  {
280    switch (l)    switch (l)
281      {      {
# Line 296  get_layoutalgorithm_str (enum layoutalgo Line 298  get_layoutalgorithm_str (enum layoutalgo
298  }  }
299    
300  static const char *  static const char *
301  get_decision_str (enum decision_e d)  get_decision_str (enum decision d)
302  {  {
303    switch (d)    switch (d)
304      {      {
# Line 307  get_decision_str (enum decision_e d) Line 309  get_decision_str (enum decision_e d)
309  }  }
310    
311  static const char *  static const char *
312  get_orientation_str (enum orientation_e o)  get_orientation_str (enum orientation o)
313  {  {
314    switch (o)    switch (o)
315      {      {
# Line 320  get_orientation_str (enum orientation_e Line 322  get_orientation_str (enum orientation_e
322  }  }
323    
324  static const char *  static const char *
325  get_node_alignement_str (enum alignement_e a)  get_node_alignment_str (enum alignment a)
326  {  {
327    switch (a)    switch (a)
328      {      {
# Line 332  get_node_alignement_str (enum alignement Line 334  get_node_alignement_str (enum alignement
334  }  }
335    
336  static const char *  static const char *
337  get_arrow_mode_str (enum arrow_mode_e a)  get_arrow_mode_str (enum arrow_mode a)
338  {  {
339    switch (a)    switch (a)
340      {      {
# Line 343  get_arrow_mode_str (enum arrow_mode_e a) Line 345  get_arrow_mode_str (enum arrow_mode_e a)
345  }  }
346    
347  static const char *  static const char *
348  get_crossing_type_str (enum crossing_type_e c)  get_crossing_type_str (enum crossing_type c)
349  {  {
350    switch (c)    switch (c)
351      {      {
# Line 356  get_crossing_type_str (enum crossing_typ Line 358  get_crossing_type_str (enum crossing_typ
358  }  }
359    
360  static const char *  static const char *
361  get_view_str (enum view_e v)  get_view_str (enum view v)
362  {  {
363    switch (v)    switch (v)
364      {      {
# Line 370  get_view_str (enum view_e v) Line 372  get_view_str (enum view_e v)
372  }  }
373    
374  static const char *  static const char *
375  get_linestyle_str (enum linestyle_e l)  get_linestyle_str (enum linestyle l)
376  {  {
377    switch (l)    switch (l)
378      {      {
# Line 383  get_linestyle_str (enum linestyle_e l) Line 385  get_linestyle_str (enum linestyle_e l)
385  }  }
386    
387  static const char *  static const char *
388  get_arrowstyle_str (enum arrowstyle_e a)  get_arrowstyle_str (enum arrowstyle a)
389  {  {
390    switch (a)    switch (a)
391      {      {
# Line 394  get_arrowstyle_str (enum arrowstyle_e a) Line 396  get_arrowstyle_str (enum arrowstyle_e a)
396      }      }
397  }  }
398    
399  /*----------------------------.  /*------------------------------.
400  | Add functions.              |  | Add functions.                |
401  | Edge and Nodes int a graph. |  | Edge and nodes into a graph.  |
402  `----------------------------*/  `------------------------------*/
403    
404  void  void
405  add_node (graph_t *graph, node_t *node)  add_node (graph *g, node *n)
406  {  {
407    node->next = graph->node_list;    n->next = g->node_list;
408    graph->node_list = node;    g->node_list = n;
409  }  }
410    
411  void  void
412  add_edge (graph_t *graph, edge_t *edge)  add_edge (graph *g, edge *e)
413  {  {
414    edge->next = graph->edge_list;    e->next = g->edge_list;
415    graph->edge_list = edge;    g->edge_list = e;
416  }  }
417    
418  void  void
419  add_classname (graph_t *g, int val, const char *name)  add_classname (graph *g, int val, const char *name)
420  {  {
421    struct classname_s *classname;    struct classname *classname;
422    
423    classname = XMALLOC (struct classname_s, 1);    classname = XMALLOC (struct classname, 1);
424    classname->no = val;    classname->no = val;
425    classname->name = name;    classname->name = name;
426    classname->next = g->classname;    classname->next = g->classname;
# Line 426  add_classname (graph_t *g, int val, cons Line 428  add_classname (graph_t *g, int val, cons
428  }  }
429    
430  void  void
431  add_infoname (graph_t *g, int integer, const char *string)  add_infoname (graph *g, int integer, const char *str)
432  {  {
433    struct infoname_s *infoname;    struct infoname *infoname;
434    
435    infoname = XMALLOC (struct infoname_s, 1);    infoname = XMALLOC (struct infoname, 1);
436    infoname->integer = integer;    infoname->integer = integer;
437    infoname->string = string;    infoname->chars = str;
438    infoname->next = g->infoname;    infoname->next = g->infoname;
439    g->infoname = infoname;    g->infoname = infoname;
440  }  }
441    
442  /* Build a colorentry struct and add it to the list.  */  /* Build a colorentry struct and add it to the list.  */
443  void  void
444  add_colorentry (graph_t *g, int color_idx, int red_cp,  add_colorentry (graph *g, int color_idx, int red_cp,
445                  int green_cp, int blue_cp)                  int green_cp, int blue_cp)
446  {  {
447    struct colorentry_s *ce;    struct colorentry *ce;
448    
449    ce = XMALLOC (struct colorentry_s, 1);    ce = XMALLOC (struct colorentry, 1);
450    ce->color_index = color_idx;    ce->color_index = color_idx;
451    ce->red_cp = red_cp;    ce->red_cp = red_cp;
452    ce->green_cp = green_cp;    ce->green_cp = green_cp;
# Line 458  add_colorentry (graph_t *g, int color_id Line 460  add_colorentry (graph_t *g, int color_id
460  `-------------------------------------*/  `-------------------------------------*/
461    
462  void  void
463  open_edge(edge_t *edge, FILE *fout)  open_edge (edge *e, FILE *fout)
464  {  {
465    switch (edge->type)    switch (e->type)
466      {      {
467      case normal_edge:      case normal_edge:
468        fputs ("\tedge: {\n", fout);        fputs ("\tedge: {\n", fout);
# Line 480  open_edge(edge_t *edge, FILE *fout) Line 482  open_edge(edge_t *edge, FILE *fout)
482  }  }
483    
484  void  void
485  close_edge(FILE *fout)  close_edge (FILE *fout)
486  {  {
487    fputs ("\t}\n", fout);    fputs ("\t}\n", fout);
488  }  }
489    
490  void  void
491  open_node(FILE *fout)  open_node (FILE *fout)
492  {  {
493    fputs ("\tnode: {\n", fout);    fputs ("\tnode: {\n", fout);
494  }  }
495    
496  void  void
497  close_node(FILE *fout)  close_node (FILE *fout)
498  {  {
499    fputs ("\t}\n", fout);    fputs ("\t}\n", fout);
500  }  }
501    
502  void  void
503  open_graph(FILE *fout)  open_graph (FILE *fout)
504  {  {
505    fputs ("graph: {\n", fout);    fputs ("graph: {\n", fout);
506  }  }
507    
508  void  void
509  close_graph(graph_t *graph, FILE *fout)  close_graph (graph *g, FILE *fout)
510  {  {
511    fputc ('\n', fout);    fputc ('\n', fout);
512    
513    /* FIXME: Unallocate nodes and edges if required.  */    /* FIXME: Unallocate nodes and edges if required.  */
514    {    {
515      node_t *node;      node *n;
516    
517      for (node = graph->node_list; node; node = node->next)      for (n = g->node_list; n; n = n->next)
518        {        {
519          open_node (fout);          open_node (fout);
520          output_node (node, fout);          output_node (n, fout);
521          close_node (fout);          close_node (fout);
522        }        }
523    }    }
# Line 523  close_graph(graph_t *graph, FILE *fout) Line 525  close_graph(graph_t *graph, FILE *fout)
525    fputc ('\n', fout);    fputc ('\n', fout);
526    
527    {    {
528      edge_t *edge;      edge *e;
529    
530      for (edge = graph->edge_list; edge; edge = edge->next)      for (e = g->edge_list; e; e = e->next)
531        {        {
532          open_edge (edge, fout);          open_edge (e, fout);
533          output_edge (edge, fout);          output_edge (e, fout);
534          close_edge (fout);          close_edge (fout);
535        }        }
536    }    }
# Line 541  close_graph(graph_t *graph, FILE *fout) Line 543  close_graph(graph_t *graph, FILE *fout)
543  `-------------------------------------------*/  `-------------------------------------------*/
544    
545  void  void
546  output_node (node_t *node, FILE *fout)  output_node (node *n, FILE *fout)
547  {  {
548    if (node->title != N_TITLE)    if (n->title != N_TITLE)
549      fprintf (fout, "\t\ttitle:\t%s\n", quote (node->title));      fprintf (fout, "\t\ttitle:\t%s\n", quote (n->title));
550    if (node->label != N_LABEL)    if (n->label != N_LABEL)
551      fprintf (fout, "\t\tlabel:\t%s\n", quote (node->label));      fprintf (fout, "\t\tlabel:\t%s\n", quote (n->label));
552    
553    if ((node->locx != N_LOCX) && (node->locy != N_LOCY))    if ((n->locx != N_LOCX) && (n->locy != N_LOCY))
554      fprintf (fout, "\t\tloc { x: %d  y: %d }\t\n", node->locx, node->locy);      fprintf (fout, "\t\tloc { x: %d  y: %d }\t\n", n->locx, n->locy);
555    
556    if (node->vertical_order != N_VERTICAL_ORDER)    if (n->vertical_order != N_VERTICAL_ORDER)
557      fprintf (fout, "\t\tvertical_order:\t%d\n", node->vertical_order);      fprintf (fout, "\t\tvertical_order:\t%d\n", n->vertical_order);
558    if (node->horizontal_order != N_HORIZONTAL_ORDER)    if (n->horizontal_order != N_HORIZONTAL_ORDER)
559      fprintf (fout, "\t\thorizontal_order:\t%d\n", node->horizontal_order);      fprintf (fout, "\t\thorizontal_order:\t%d\n", n->horizontal_order);
560    
561    if (node->width != N_WIDTH)    if (n->width != N_WIDTH)
562      fprintf (fout, "\t\twidth:\t%d\n", node->width);      fprintf (fout, "\t\twidth:\t%d\n", n->width);
563    if (node->height != N_HEIGHT)    if (n->height != N_HEIGHT)
564      fprintf (fout, "\t\theight:\t%d\n", node->height);      fprintf (fout, "\t\theight:\t%d\n", n->height);
565    
566    if (node->shrink != N_SHRINK)    if (n->shrink != N_SHRINK)
567      fprintf (fout, "\t\tshrink:\t%d\n", node->shrink);      fprintf (fout, "\t\tshrink:\t%d\n", n->shrink);
568    if (node->stretch != N_STRETCH)    if (n->expand != N_EXPAND)
569      fprintf (fout, "\t\tstretch:\t%d\n", node->stretch);      fprintf (fout, "\t\texpand:\t%d\n", n->expand);
570    
571    if (node->folding != N_FOLDING)    if (n->folding != N_FOLDING)
572      fprintf (fout, "\t\tfolding:\t%d\n", node->folding);      fprintf (fout, "\t\tfolding:\t%d\n", n->folding);
573    
574    if (node->textmode != N_TEXTMODE)    if (n->textmode != N_TEXTMODE)
575      fprintf (fout, "\t\ttextmode:\t%s\n",      fprintf (fout, "\t\ttextmode:\t%s\n",
576               get_textmode_str (node->textmode));               get_textmode_str (n->textmode));
577    
578    if (node->shape != N_SHAPE)    if (n->shape != N_SHAPE)
579      fprintf (fout, "\t\tshape:\t%s\n", get_shape_str (node->shape));      fprintf (fout, "\t\tshape:\t%s\n", get_shape_str (n->shape));
580    
581    if (node->borderwidth != N_BORDERWIDTH)    if (n->borderwidth != N_BORDERWIDTH)
582      fprintf (fout, "\t\tborderwidth:\t%d\n", node->borderwidth);      fprintf (fout, "\t\tborderwidth:\t%d\n", n->borderwidth);
583    
584    if (node->color != N_COLOR)    if (n->color != N_COLOR)
585      fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (node->color));      fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (n->color));
586    if (node->textcolor != N_TEXTCOLOR)    if (n->textcolor != N_TEXTCOLOR)
587      fprintf (fout, "\t\ttextcolor:\t%s\n",      fprintf (fout, "\t\ttextcolor:\t%s\n",
588               get_color_str (node->textcolor));               get_color_str (n->textcolor));
589    if (node->bordercolor != N_BORDERCOLOR)    if (n->bordercolor != N_BORDERCOLOR)
590      fprintf (fout, "\t\tbordercolor:\t%s\n",      fprintf (fout, "\t\tbordercolor:\t%s\n",
591               get_color_str (node->bordercolor));               get_color_str (n->bordercolor));
592    
593    {    {
594      int i;      int i;
595      for (i = 0; i < 3; ++i)      for (i = 0; i < 3; ++i)
596        if (node->infos[i])        if (n->infos[i])
597          fprintf (fout, "\t\tinfo%d:\t%s\n",          fprintf (fout, "\t\tinfo%d:\t%s\n",
598                   i, quote (node->infos[i]));                   i, quote (n->infos[i]));
599    }    }
600  }  }
601    
602  void  void
603  output_edge (edge_t *edge, FILE *fout)  output_edge (edge *e, FILE *fout)
604  {  {
605    /* FIXME: SOURCENAME and TARGETNAME are mandatory    /* FIXME: SOURCENAME and TARGETNAME are mandatory
606       so it has to be fatal not to give these informations.  */       so it has to be fatal not to give these informations.  */
607    if (edge->sourcename != E_SOURCENAME)    if (e->sourcename != E_SOURCENAME)
608      fprintf (fout, "\t\tsourcename:\t%s\n", quote (edge->sourcename));      fprintf (fout, "\t\tsourcename:\t%s\n", quote (e->sourcename));
609    if (edge->targetname != E_TARGETNAME)    if (e->targetname != E_TARGETNAME)
610      fprintf (fout, "\t\ttargetname:\t%s\n", quote (edge->targetname));      fprintf (fout, "\t\ttargetname:\t%s\n", quote (e->targetname));
611    
612    if (edge->label != E_LABEL)    if (e->label != E_LABEL)
613      fprintf (fout, "\t\tlabel:\t%s\n", quote (edge->label));      fprintf (fout, "\t\tlabel:\t%s\n", quote (e->label));
614    
615    if (edge->linestyle != E_LINESTYLE)    if (e->linestyle != E_LINESTYLE)
616      fprintf (fout, "\t\tlinestyle:\t%s\n",      fprintf (fout, "\t\tlinestyle:\t%s\n",
617               quote (get_linestyle_str(edge->linestyle)));               quote (get_linestyle_str (e->linestyle)));
618    
619    if (edge->thickness != E_THICKNESS)    if (e->thickness != E_THICKNESS)
620      fprintf (fout, "\t\tthickness:\t%d\n", edge->thickness);      fprintf (fout, "\t\tthickness:\t%d\n", e->thickness);
621    if (edge->class != E_CLASS)    if (e->class != E_CLASS)
622      fprintf (fout, "\t\tclass:\t%d\n", edge->class);      fprintf (fout, "\t\tclass:\t%d\n", e->class);
623    
624    if (edge->color != E_COLOR)    if (e->color != E_COLOR)
625      fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (edge->color));      fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (e->color));
626    if (edge->color != E_TEXTCOLOR)    if (e->color != E_TEXTCOLOR)
627      fprintf (fout, "\t\ttextcolor:\t%s\n",      fprintf (fout, "\t\ttextcolor:\t%s\n",
628               get_color_str (edge->textcolor));               get_color_str (e->textcolor));
629    if (edge->arrowcolor != E_ARROWCOLOR)    if (e->arrowcolor != E_ARROWCOLOR)
630      fprintf (fout, "\t\tarrowcolor:\t%s\n",      fprintf (fout, "\t\tarrowcolor:\t%s\n",
631               get_color_str (edge->arrowcolor));               get_color_str (e->arrowcolor));
632    if (edge->backarrowcolor != E_BACKARROWCOLOR)    if (e->backarrowcolor != E_BACKARROWCOLOR)
633      fprintf (fout, "\t\tbackarrowcolor:\t%s\n",      fprintf (fout, "\t\tbackarrowcolor:\t%s\n",
634               get_color_str (edge->backarrowcolor));               get_color_str (e->backarrowcolor));
635    
636    if (edge->arrowsize != E_ARROWSIZE)    if (e->arrowsize != E_ARROWSIZE)
637      fprintf (fout, "\t\tarrowsize:\t%d\n", edge->arrowsize);      fprintf (fout, "\t\tarrowsize:\t%d\n", e->arrowsize);
638    if (edge->backarrowsize != E_BACKARROWSIZE)    if (e->backarrowsize != E_BACKARROWSIZE)
639      fprintf (fout, "\t\tbackarrowsize:\t%d\n", edge->backarrowsize);      fprintf (fout, "\t\tbackarrowsize:\t%d\n", e->backarrowsize);
640    
641    if (edge->arrowstyle != E_ARROWSTYLE)    if (e->arrowstyle != E_ARROWSTYLE)
642      fprintf (fout, "\t\tarrowstyle:\t%s\n",      fprintf (fout, "\t\tarrowstyle:\t%s\n",
643               get_arrowstyle_str(edge->arrowstyle));               get_arrowstyle_str (e->arrowstyle));
644    if (edge->backarrowstyle != E_BACKARROWSTYLE)    if (e->backarrowstyle != E_BACKARROWSTYLE)
645      fprintf (fout, "\t\tbackarrowstyle:\t%s\n",      fprintf (fout, "\t\tbackarrowstyle:\t%s\n",
646               get_arrowstyle_str(edge->backarrowstyle));               get_arrowstyle_str (e->backarrowstyle));
647    
648    if (edge->priority != E_PRIORITY)    if (e->priority != E_PRIORITY)
649      fprintf (fout, "\t\tpriority:\t%d\n", edge->priority);      fprintf (fout, "\t\tpriority:\t%d\n", e->priority);
650    if (edge->anchor != E_ANCHOR)    if (e->anchor != E_ANCHOR)
651      fprintf (fout, "\t\tanchor:\t%d\n", edge->anchor);      fprintf (fout, "\t\tanchor:\t%d\n", e->anchor);
652    if (edge->horizontal_order != E_HORIZONTAL_ORDER)    if (e->horizontal_order != E_HORIZONTAL_ORDER)
653      fprintf (fout, "\t\thorizontal_order:\t%d\n", edge->horizontal_order);      fprintf (fout, "\t\thorizontal_order:\t%d\n", e->horizontal_order);
654  }  }
655    
656  void  void
657  output_graph (graph_t *graph, FILE *fout)  output_graph (graph *g, FILE *fout)
658  {  {
659    if (graph->title)    if (g->title)
660      fprintf (fout, "\ttitle:\t%s\n", quote (graph->title));      fprintf (fout, "\ttitle:\t%s\n", quote (g->title));
661    if (graph->label)    if (g->label)
662      fprintf (fout, "\tlabel:\t%s\n", quote (graph->label));      fprintf (fout, "\tlabel:\t%s\n", quote (g->label));
663    
664    {    {
665      int i;      int i;
666      for (i = 0; i < 3; ++i)      for (i = 0; i < 3; ++i)
667        if (graph->infos[i])        if (g->infos[i])
668          fprintf (fout, "\tinfo%d:\t%s\n", i, quote (graph->infos[i]));          fprintf (fout, "\tinfo%d:\t%s\n", i, quote (g->infos[i]));
669    }    }
670    
671    if (graph->color != G_COLOR)    if (g->color != G_COLOR)
672      fprintf (fout, "\tcolor:\t%s\n", get_color_str (graph->color));      fprintf (fout, "\tcolor:\t%s\n", get_color_str (g->color));
673    if (graph->textcolor != G_TEXTCOLOR)    if (g->textcolor != G_TEXTCOLOR)
674      fprintf (fout, "\ttextcolor:\t%s\n", get_color_str (graph->textcolor));      fprintf (fout, "\ttextcolor:\t%s\n", get_color_str (g->textcolor));
675    if (graph->bordercolor != G_BORDERCOLOR)    if (g->bordercolor != G_BORDERCOLOR)
676      fprintf (fout, "\tbordercolor:\t%s\n",      fprintf (fout, "\tbordercolor:\t%s\n",
677               get_color_str (graph->bordercolor));               get_color_str (g->bordercolor));
678    
679    if (graph->width != G_WIDTH)    if (g->width != G_WIDTH)
680      fprintf (fout, "\twidth:\t%d\n", graph->width);      fprintf (fout, "\twidth:\t%d\n", g->width);
681    if (graph->height != G_HEIGHT)    if (g->height != G_HEIGHT)
682      fprintf (fout, "\theight:\t%d\n", graph->height);      fprintf (fout, "\theight:\t%d\n", g->height);
683    if (graph->borderwidth != G_BORDERWIDTH)    if (g->borderwidth != G_BORDERWIDTH)
684      fprintf (fout, "\tborderwidth:\t%d\n", graph->borderwidth);      fprintf (fout, "\tborderwidth:\t%d\n", g->borderwidth);
685    
686    if (graph->x != G_X)    if (g->x != G_X)
687      fprintf (fout, "\tx:\t%d\n", graph->x);      fprintf (fout, "\tx:\t%d\n", g->x);
688    if (graph->y != G_Y)    if (g->y != G_Y)
689      fprintf (fout, "\ty:\t%d\n", graph->y);      fprintf (fout, "\ty:\t%d\n", g->y);
690    
691    if (graph->folding != G_FOLDING)    if (g->folding != G_FOLDING)
692      fprintf (fout, "\tfolding:\t%d\n", graph->folding);      fprintf (fout, "\tfolding:\t%d\n", g->folding);
693    
694    if (graph->shrink != G_SHRINK)    if (g->shrink != G_SHRINK)
695      fprintf (fout, "\tshrink:\t%d\n", graph->shrink);      fprintf (fout, "\tshrink:\t%d\n", g->shrink);
696    if (graph->stretch != G_STRETCH)    if (g->expand != G_EXPAND)
697      fprintf (fout, "\tstretch:\t%d\n", graph->stretch);      fprintf (fout, "\texpand:\t%d\n", g->expand);
698    
699    if (graph->textmode != G_TEXTMODE)    if (g->textmode != G_TEXTMODE)
700      fprintf (fout, "\ttextmode:\t%s\n",      fprintf (fout, "\ttextmode:\t%s\n",
701               get_textmode_str (graph->textmode));               get_textmode_str (g->textmode));
702    
703    if (graph->shape != G_SHAPE)    if (g->shape != G_SHAPE)
704      fprintf (fout, "\tshape:\t%s\n", get_shape_str (graph->shape));      fprintf (fout, "\tshape:\t%s\n", get_shape_str (g->shape));
705    
706    if (graph->vertical_order != G_VERTICAL_ORDER)    if (g->vertical_order != G_VERTICAL_ORDER)
707      fprintf (fout, "\tvertical_order:\t%d\n", graph->vertical_order);      fprintf (fout, "\tvertical_order:\t%d\n", g->vertical_order);
708    if (graph->horizontal_order != G_HORIZONTAL_ORDER)    if (g->horizontal_order != G_HORIZONTAL_ORDER)
709      fprintf (fout, "\thorizontal_order:\t%d\n", graph->horizontal_order);      fprintf (fout, "\thorizontal_order:\t%d\n", g->horizontal_order);
710    
711    if (graph->xmax != G_XMAX)    if (g->xmax != G_XMAX)
712      fprintf (fout, "\txmax:\t%d\n", graph->xmax);      fprintf (fout, "\txmax:\t%d\n", g->xmax);
713    if (graph->ymax != G_YMAX)    if (g->ymax != G_YMAX)
714      fprintf (fout, "\tymax:\t%d\n", graph->ymax);      fprintf (fout, "\tymax:\t%d\n", g->ymax);
715    
716    if (graph->xbase != G_XBASE)    if (g->xbase != G_XBASE)
717      fprintf (fout, "\txbase:\t%d\n", graph->xbase);      fprintf (fout, "\txbase:\t%d\n", g->xbase);
718    if (graph->ybase != G_YBASE)    if (g->ybase != G_YBASE)
719      fprintf (fout, "\tybase:\t%d\n", graph->ybase);      fprintf (fout, "\tybase:\t%d\n", g->ybase);
720    
721    if (graph->xspace != G_XSPACE)    if (g->xspace != G_XSPACE)
722      fprintf (fout, "\txspace:\t%d\n", graph->xspace);      fprintf (fout, "\txspace:\t%d\n", g->xspace);
723    if (graph->yspace != G_YSPACE)    if (g->yspace != G_YSPACE)
724      fprintf (fout, "\tyspace:\t%d\n", graph->yspace);      fprintf (fout, "\tyspace:\t%d\n", g->yspace);
725    if (graph->xlspace != G_XLSPACE)    if (g->xlspace != G_XLSPACE)
726      fprintf (fout, "\txlspace:\t%d\n", graph->xlspace);      fprintf (fout, "\txlspace:\t%d\n", g->xlspace);
727    
728    if (graph->xraster != G_XRASTER)    if (g->xraster != G_XRASTER)
729      fprintf (fout, "\txraster:\t%d\n", graph->xraster);      fprintf (fout, "\txraster:\t%d\n", g->xraster);
730    if (graph->yraster != G_YRASTER)    if (g->yraster != G_YRASTER)
731      fprintf (fout, "\tyraster:\t%d\n", graph->yraster);      fprintf (fout, "\tyraster:\t%d\n", g->yraster);
732    if (graph->xlraster != G_XLRASTER)    if (g->xlraster != G_XLRASTER)
733      fprintf (fout, "\txlraster:\t%d\n", graph->xlraster);      fprintf (fout, "\txlraster:\t%d\n", g->xlraster);
734    
735    if (graph->hidden != G_HIDDEN)    if (g->hidden != G_HIDDEN)
736      fprintf (fout, "\thidden:\t%d\n", graph->hidden);      fprintf (fout, "\thidden:\t%d\n", g->hidden);
737    
738    /* FIXME: Unallocate struct list if required.    /* FIXME: Unallocate struct list if required.
739       Maybe with a little function.  */       Maybe with a little function.  */
740    if (graph->classname != G_CLASSNAME)    if (g->classname != G_CLASSNAME)
741      {      {
742        struct classname_s *ite;        struct classname *ite;
743    
744        for (ite = graph->classname; ite; ite = ite->next)        for (ite = g->classname; ite; ite = ite->next)
745          fprintf (fout, "\tclassname %d :\t%s\n", ite->no, ite->name);          fprintf (fout, "\tclassname %d :\t%s\n", ite->no, ite->name);
746      }      }
747    
748    if (graph->infoname != G_INFONAME)    if (g->infoname != G_INFONAME)
749      {      {
750        struct infoname_s *ite;        struct infoname *ite;
751    
752        for (ite = graph->infoname; ite; ite = ite->next)        for (ite = g->infoname; ite; ite = ite->next)
753          fprintf (fout, "\tinfoname %d :\t%s\n", ite->integer, ite->string);          fprintf (fout, "\tinfoname %d :\t%s\n", ite->integer, ite->chars);
754      }      }
755    
756    if (graph->colorentry != G_COLORENTRY)    if (g->colorentry != G_COLORENTRY)
757      {      {
758        struct colorentry_s *ite;        struct colorentry *ite;
759    
760        for (ite = graph->colorentry; ite; ite = ite->next)        for (ite = g->colorentry; ite; ite = ite->next)
761          {          {
762            fprintf (fout, "\tcolorentry %d :\t%d %d %d\n",            fprintf (fout, "\tcolorentry %d :\t%d %d %d\n",
763                     ite->color_index,                     ite->color_index,
# Line 765  output_graph (graph_t *graph, FILE *fout Line 767  output_graph (graph_t *graph, FILE *fout
767          }          }
768      }      }
769    
770    if (graph->layoutalgorithm != G_LAYOUTALGORITHM)    if (g->layoutalgorithm != G_LAYOUTALGORITHM)
771      fprintf (fout, "\tlayoutalgorithm:\t%s\n",      fprintf (fout, "\tlayoutalgorithm:\t%s\n",
772               get_layoutalgorithm_str(graph->layoutalgorithm));               get_layoutalgorithm_str (g->layoutalgorithm));
773    
774    if (graph->layout_downfactor != G_LAYOUT_DOWNFACTOR)    if (g->layout_downfactor != G_LAYOUT_DOWNFACTOR)
775      fprintf (fout, "\tlayout_downfactor:\t%d\n", graph->layout_downfactor);      fprintf (fout, "\tlayout_downfactor:\t%d\n", g->layout_downfactor);
776    if (graph->layout_upfactor != G_LAYOUT_UPFACTOR)    if (g->layout_upfactor != G_LAYOUT_UPFACTOR)
777      fprintf (fout, "\tlayout_upfactor:\t%d\n", graph->layout_upfactor);      fprintf (fout, "\tlayout_upfactor:\t%d\n", g->layout_upfactor);
778    if (graph->layout_nearfactor != G_LAYOUT_NEARFACTOR)    if (g->layout_nearfactor != G_LAYOUT_NEARFACTOR)
779      fprintf (fout, "\tlayout_nearfactor:\t%d\n", graph->layout_nearfactor);      fprintf (fout, "\tlayout_nearfactor:\t%d\n", g->layout_nearfactor);
780    if (graph->layout_splinefactor != G_LAYOUT_SPLINEFACTOR)    if (g->layout_splinefactor != G_LAYOUT_SPLINEFACTOR)
781      fprintf (fout, "\tlayout_splinefactor:\t%d\n",      fprintf (fout, "\tlayout_splinefactor:\t%d\n",
782               graph->layout_splinefactor);               g->layout_splinefactor);
783    
784    if (graph->late_edge_labels != G_LATE_EDGE_LABELS)    if (g->late_edge_labels != G_LATE_EDGE_LABELS)
785      fprintf (fout, "\tlate_edge_labels:\t%s\n",      fprintf (fout, "\tlate_edge_labels:\t%s\n",
786               get_decision_str(graph->late_edge_labels));               get_decision_str (g->late_edge_labels));
787    if (graph->display_edge_labels != G_DISPLAY_EDGE_LABELS)    if (g->display_edge_labels != G_DISPLAY_EDGE_LABELS)
788      fprintf (fout, "\tdisplay_edge_labels:\t%s\n",      fprintf (fout, "\tdisplay_edge_labels:\t%s\n",
789               get_decision_str(graph->display_edge_labels));               get_decision_str (g->display_edge_labels));
790    if (graph->dirty_edge_labels != G_DIRTY_EDGE_LABELS)    if (g->dirty_edge_labels != G_DIRTY_EDGE_LABELS)
791      fprintf (fout, "\tdirty_edge_labels:\t%s\n",      fprintf (fout, "\tdirty_edge_labels:\t%s\n",
792               get_decision_str(graph->dirty_edge_labels));               get_decision_str (g->dirty_edge_labels));
793    if (graph->finetuning != G_FINETUNING)    if (g->finetuning != G_FINETUNING)
794      fprintf (fout, "\tfinetuning:\t%s\n",      fprintf (fout, "\tfinetuning:\t%s\n",
795               get_decision_str(graph->finetuning));               get_decision_str (g->finetuning));
796    if (graph->ignore_singles != G_IGNORE_SINGLES)    if (g->ignore_singles != G_IGNORE_SINGLES)
797      fprintf (fout, "\tignore_singles:\t%s\n",      fprintf (fout, "\tignore_singles:\t%s\n",
798               get_decision_str(graph->ignore_singles));               get_decision_str (g->ignore_singles));
799    if (graph->straight_phase != G_STRAIGHT_PHASE)    if (g->long_straight_phase != G_LONG_STRAIGHT_PHASE)
800      fprintf (fout, "\tstraight_phase:\t%s\n",      fprintf (fout, "\tlong_straight_phase:\t%s\n",
801               get_decision_str(graph->straight_phase));               get_decision_str (g->long_straight_phase));
802    if (graph->priority_phase != G_PRIORITY_PHASE)    if (g->priority_phase != G_PRIORITY_PHASE)
803      fprintf (fout, "\tpriority_phase:\t%s\n",      fprintf (fout, "\tpriority_phase:\t%s\n",
804               get_decision_str(graph->priority_phase));               get_decision_str (g->priority_phase));
805    if (graph->manhattan_edges != G_MANHATTAN_EDGES)    if (g->manhattan_edges != G_MANHATTAN_EDGES)
806      fprintf (fout,      fprintf (fout,
807               "\tmanhattan_edges:\t%s\n",               "\tmanhattan_edges:\t%s\n",
808               get_decision_str(graph->manhattan_edges));               get_decision_str (g->manhattan_edges));
809    if (graph->smanhattan_edges != G_SMANHATTAN_EDGES)    if (g->smanhattan_edges != G_SMANHATTAN_EDGES)
810      fprintf (fout,      fprintf (fout,
811               "\tsmanhattan_edges:\t%s\n",               "\tsmanhattan_edges:\t%s\n",
812               get_decision_str(graph->smanhattan_edges));               get_decision_str (g->smanhattan_edges));
813    if (graph->near_edges != G_NEAR_EDGES)    if (g->near_edges != G_NEAR_EDGES)
814      fprintf (fout, "\tnear_edges:\t%s\n",      fprintf (fout, "\tnear_edges:\t%s\n",
815               get_decision_str(graph->near_edges));               get_decision_str (g->near_edges));
816    
817    if (graph->orientation != G_ORIENTATION)    if (g->orientation != G_ORIENTATION)
818      fprintf (fout, "\torientation:\t%s\n",      fprintf (fout, "\torientation:\t%s\n",
819               get_orientation_str(graph->orientation));               get_orientation_str (g->orientation));
820    
821    if (graph->node_alignement != G_NODE_ALIGNEMENT)    if (g->node_alignment != G_NODE_ALIGNMENT)
822      fprintf (fout, "\tnode_alignement:\t%s\n",      fprintf (fout, "\tnode_alignment:\t%s\n",
823               get_node_alignement_str(graph->node_alignement));               get_node_alignment_str (g->node_alignment));
824    
825    if (graph->port_sharing != G_PORT_SHARING)    if (g->port_sharing != G_PORT_SHARING)
826      fprintf (fout, "\tport_sharing:\t%s\n",      fprintf (fout, "\tport_sharing:\t%s\n",
827               get_decision_str(graph->port_sharing));               get_decision_str (g->port_sharing));
828    
829    if (graph->arrow_mode != G_ARROW_MODE)    if (g->arrow_mode != G_ARROW_MODE)
830      fprintf (fout, "\tarrow_mode:\t%s\n",      fprintf (fout, "\tarrow_mode:\t%s\n",
831               get_arrow_mode_str(graph->arrow_mode));               get_arrow_mode_str (g->arrow_mode));
832    
833    if (graph->treefactor != G_TREEFACTOR)    if (g->treefactor != G_TREEFACTOR)
834      fprintf (fout, "\ttreefactor:\t%f\n", graph->treefactor);      fprintf (fout, "\ttreefactor:\t%f\n", g->treefactor);
835    if (graph->spreadlevel != G_SPREADLEVEL)    if (g->spreadlevel != G_SPREADLEVEL)
836      fprintf (fout, "\tspreadlevel:\t%d\n", graph->spreadlevel);      fprintf (fout, "\tspreadlevel:\t%d\n", g->spreadlevel);
837    
838    if (graph->crossing_weight != G_CROSSING_WEIGHT)    if (g->crossing_weight != G_CROSSING_WEIGHT)
839      fprintf (fout, "\tcrossing_weight:\t%s\n",      fprintf (fout, "\tcrossing_weight:\t%s\n",
840               get_crossing_type_str(graph->crossing_weight));               get_crossing_type_str (g->crossing_weight));
841    if (graph->crossing_phase2 != G_CROSSING_PHASE2)    if (g->crossing_phase2 != G_CROSSING_PHASE2)
842      fprintf (fout, "\tcrossing_phase2:\t%s\n",      fprintf (fout, "\tcrossing_phase2:\t%s\n",
843               get_decision_str(graph->crossing_phase2));               get_decision_str (g->crossing_phase2));
844    if (graph->crossing_optimization != G_CROSSING_OPTIMIZATION)    if (g->crossing_optimization != G_CROSSING_OPTIMIZATION)
845      fprintf (fout, "\tcrossing_optimization:\t%s\n",      fprintf (fout, "\tcrossing_optimization:\t%s\n",
846               get_decision_str(graph->crossing_optimization));               get_decision_str (g->crossing_optimization));
847    
848    if (graph->view != G_VIEW)    if (g->view != G_VIEW)
849      fprintf (fout, "\tview:\t%s\n", get_view_str(graph->view));      fprintf (fout, "\tview:\t%s\n", get_view_str (g->view));
850    
851    if (graph->edges != G_EDGES)    if (g->edges != G_EDGES)
852      fprintf (fout, "\tedges:\t%s\n", get_decision_str(graph->edges));      fprintf (fout, "\tedges:\t%s\n", get_decision_str (g->edges));
853    
854    if (graph->nodes != G_NODES)    if (g->nodes != G_NODES)
855      fprintf (fout,"\tnodes:\t%s\n", get_decision_str(graph->nodes));      fprintf (fout,"\tnodes:\t%s\n", get_decision_str (g->nodes));
856    
857    if (graph->splines != G_SPLINES)    if (g->splines != G_SPLINES)
858      fprintf (fout, "\tsplines:\t%s\n", get_decision_str(graph->splines));      fprintf (fout, "\tsplines:\t%s\n", get_decision_str (g->splines));
859    
860    if (graph->bmax != G_BMAX)    if (g->bmax != G_BMAX)
861      fprintf (fout, "\tbmax:\t%d\n", graph->bmax);      fprintf (fout, "\tbmax:\t%d\n", g->bmax);
862    if (graph->cmin != G_CMIN)    if (g->cmin != G_CMIN)
863      fprintf (fout, "\tcmin:\t%d\n", graph->cmin);      fprintf (fout, "\tcmin:\t%d\n", g->cmin);
864    if (graph->cmax != G_CMAX)    if (g->cmax != G_CMAX)
865      fprintf (fout, "\tcmax:\t%d\n", graph->cmax);      fprintf (fout, "\tcmax:\t%d\n", g->cmax);
866    if (graph->pmin != G_PMIN)    if (g->pmin != G_PMIN)
867      fprintf (fout, "\tpmin:\t%d\n", graph->pmin);      fprintf (fout, "\tpmin:\t%d\n", g->pmin);
868    if (graph->pmax != G_PMAX)    if (g->pmax != G_PMAX)
869      fprintf (fout, "\tpmax:\t%d\n", graph->pmax);      fprintf (fout, "\tpmax:\t%d\n", g->pmax);
870    if (graph->rmin != G_RMIN)    if (g->rmin != G_RMIN)
871      fprintf (fout, "\trmin:\t%d\n", graph->rmin);      fprintf (fout, "\trmin:\t%d\n", g->rmin);
872    if (graph->rmax != G_RMAX)    if (g->rmax != G_RMAX)
873      fprintf (fout, "\trmax:\t%d\n", graph->rmax);      fprintf (fout, "\trmax:\t%d\n", g->rmax);
874    if (graph->smax != G_SMAX)    if (g->smax != G_SMAX)
875      fprintf (fout, "\tsmax:\t%d\n", graph->smax);      fprintf (fout, "\tsmax:\t%d\n", g->smax);
876  }  }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

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