mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 10:43:02 +00:00
* src/vcg.c: Remove includes of complain.h' and xalloc.h'.
(get_xxxx_str): Use assert () instead of complain (). Remove return invokations in default cases. (get_decision_str): Modify default behaviour. Remove second argument. Echo modifications on calls. (output_graph): Fix.
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
|
2001-08-16 Marc Autret <autret_m@epita.fr>
|
||||||
|
|
||||||
|
* src/vcg.c: Remove includes of `complain.h' and `xalloc.h'.
|
||||||
|
(get_xxxx_str): Use assert () instead of complain ().
|
||||||
|
Remove return invokations in default cases.
|
||||||
|
(get_decision_str): Modify default behaviour. Remove second argument.
|
||||||
|
Echo modifications on calls.
|
||||||
|
(output_graph): Fix.
|
||||||
|
|
||||||
2001-08-16 Marc Autret <autret_m@epita.fr>
|
2001-08-16 Marc Autret <autret_m@epita.fr>
|
||||||
|
|
||||||
* src/getargs.c (usage): Update with ``-g, --graph''.
|
* src/getargs.c (usage): Update with ``-g, --graph''.
|
||||||
|
|||||||
86
src/vcg.c
86
src/vcg.c
@@ -21,8 +21,6 @@
|
|||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "vcg.h"
|
#include "vcg.h"
|
||||||
#include "vcg_defaults.h"
|
#include "vcg_defaults.h"
|
||||||
#include "xalloc.h"
|
|
||||||
#include "complain.h"
|
|
||||||
|
|
||||||
/* Initialize a graph with the default values. */
|
/* Initialize a graph with the default values. */
|
||||||
void
|
void
|
||||||
@@ -231,8 +229,7 @@ get_color_str (enum color_e c)
|
|||||||
case orchid: return "orchid";
|
case orchid: return "orchid";
|
||||||
case black: return "black";
|
case black: return "black";
|
||||||
default:
|
default:
|
||||||
complain (_("vcg graph: no such color."));
|
assert (!"Not a default color.");
|
||||||
return get_color_str(G_COLOR);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -246,8 +243,7 @@ get_textmode_str (enum textmode_e t)
|
|||||||
case left_justify: return "left_justify";
|
case left_justify: return "left_justify";
|
||||||
case right_justify: return "right_justify";
|
case right_justify: return "right_justify";
|
||||||
default:
|
default:
|
||||||
complain (_("vcg graph: no such text mode"));
|
assert (!"Not a text mode.");
|
||||||
return get_textmode_str(G_TEXTMODE);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -262,8 +258,7 @@ get_shape_str (enum shape_e s)
|
|||||||
case ellipse: return "ellipse";
|
case ellipse: return "ellipse";
|
||||||
case triangle: return "triangle";
|
case triangle: return "triangle";
|
||||||
default:
|
default:
|
||||||
complain (_("vcg graph: no such shape"));
|
assert (!"Not a shape.");
|
||||||
return get_shape_str(G_SHAPE);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -288,21 +283,20 @@ get_layoutalgorithm_str (enum layoutalgorithm_e l)
|
|||||||
case dfs: return "dfs";
|
case dfs: return "dfs";
|
||||||
case tree: return "tree";
|
case tree: return "tree";
|
||||||
default:
|
default:
|
||||||
return "normal";
|
assert (!"Not a layout algorithm.");
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
get_decision_str (enum decision_e d, enum decision_e defaults)
|
get_decision_str (enum decision_e d)
|
||||||
{
|
{
|
||||||
switch (d)
|
switch (d)
|
||||||
{
|
{
|
||||||
case no: return "no";
|
case no: return "no";
|
||||||
case yes: return "yes";
|
case yes: return "yes";
|
||||||
default:
|
default:
|
||||||
complain (_("vcg graph: no such decision"));
|
assert (!"Either yes nor no.");
|
||||||
return get_decision_str(defaults, 0);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -317,8 +311,7 @@ get_orientation_str (enum orientation_e o)
|
|||||||
case left_to_right: return "left_to_right";
|
case left_to_right: return "left_to_right";
|
||||||
case right_to_left: return "right_to_left";
|
case right_to_left: return "right_to_left";
|
||||||
default:
|
default:
|
||||||
complain (_("vcg graph: no such an orientation"));
|
assert (!"Not an orientation.");
|
||||||
return get_orientation_str(G_ORIENTATION);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -332,8 +325,7 @@ get_node_alignement_str (enum alignement_e a)
|
|||||||
case top: return "top";
|
case top: return "top";
|
||||||
case bottom: return "bottom";
|
case bottom: return "bottom";
|
||||||
default:
|
default:
|
||||||
complain (_("vcg graph: no such an alignement"));
|
assert (!"Not an alignement.");
|
||||||
return get_node_alignement_str(G_NODE_ALIGNEMENT);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -346,8 +338,7 @@ get_arrow_mode_str (enum arrow_mode_e a)
|
|||||||
case fixed: return "fixed";
|
case fixed: return "fixed";
|
||||||
case free_a: return "free";
|
case free_a: return "free";
|
||||||
default:
|
default:
|
||||||
complain (_("vcg graph: no such an arrow mode"));
|
assert (!"Not an arrow mode.");
|
||||||
return get_arrow_mode_str(G_ARROW_MODE);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -362,8 +353,7 @@ get_crossing_type_str (enum crossing_type_e c)
|
|||||||
case barymedian: return "barymedian";
|
case barymedian: return "barymedian";
|
||||||
case medianbary: return "medianbary";
|
case medianbary: return "medianbary";
|
||||||
default:
|
default:
|
||||||
complain (_("vcg graph: no such crossing_type"));
|
assert (!"Not a crossing type.");
|
||||||
return get_crossing_type_str(G_CROSSING_WEIGHT);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -379,8 +369,7 @@ get_view_str (enum view_e v)
|
|||||||
case fcfish: return "fcfish";
|
case fcfish: return "fcfish";
|
||||||
case fpfish: return "fpfish";
|
case fpfish: return "fpfish";
|
||||||
default:
|
default:
|
||||||
complain (_("vcg graph: no such view"));
|
assert (!"Not a view.");
|
||||||
return get_view_str(G_VIEW);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -395,8 +384,7 @@ get_linestyle_str (enum linestyle_e l)
|
|||||||
case dotted: return "dotted";
|
case dotted: return "dotted";
|
||||||
case invisible: return "invisible";
|
case invisible: return "invisible";
|
||||||
default:
|
default:
|
||||||
complain (_("vcg graph: no such linestyle"));
|
assert (!"Not a line style.");
|
||||||
return get_linestyle_str(E_LINESTYLE);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -410,8 +398,7 @@ get_arrowstyle_str (enum arrowstyle_e a)
|
|||||||
case line: return "line";
|
case line: return "line";
|
||||||
case none: return "none";
|
case none: return "none";
|
||||||
default:
|
default:
|
||||||
complain (_("vcg graph: no such an arrowstyle"));
|
assert (!"Not an arrow style.");
|
||||||
return get_arrowstyle_str(E_ARROWSTYLE);
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -732,54 +719,48 @@ output_graph (graph_t *graph, struct obstack *os)
|
|||||||
|
|
||||||
if (graph->late_edge_labels != G_LATE_EDGE_LABELS)
|
if (graph->late_edge_labels != G_LATE_EDGE_LABELS)
|
||||||
obstack_fgrow1 (os, "\tlate_edge_labels:\t%s\n",
|
obstack_fgrow1 (os, "\tlate_edge_labels:\t%s\n",
|
||||||
get_decision_str(graph->late_edge_labels,
|
get_decision_str(graph->late_edge_labels));
|
||||||
G_LATE_EDGE_LABELS));
|
|
||||||
if (graph->display_edge_labels != G_DISPLAY_EDGE_LABELS)
|
if (graph->display_edge_labels != G_DISPLAY_EDGE_LABELS)
|
||||||
obstack_fgrow1 (os, "\tdisplay_edge_labels:\t%s\n",
|
obstack_fgrow1 (os, "\tdisplay_edge_labels:\t%s\n",
|
||||||
get_decision_str(graph->display_edge_labels,
|
get_decision_str(graph->display_edge_labels));
|
||||||
G_DISPLAY_EDGE_LABELS));
|
|
||||||
if (graph->dirty_edge_labels != G_DIRTY_EDGE_LABELS)
|
if (graph->dirty_edge_labels != G_DIRTY_EDGE_LABELS)
|
||||||
obstack_fgrow1 (os, "\tdirty_edge_labels:\t%s\n",
|
obstack_fgrow1 (os, "\tdirty_edge_labels:\t%s\n",
|
||||||
get_decision_str(graph->dirty_edge_labels,
|
get_decision_str(graph->dirty_edge_labels));
|
||||||
G_DIRTY_EDGE_LABELS));
|
|
||||||
if (graph->finetuning != G_FINETUNING)
|
if (graph->finetuning != G_FINETUNING)
|
||||||
obstack_fgrow1 (os, "\tfinetuning:\t%s\n",
|
obstack_fgrow1 (os, "\tfinetuning:\t%s\n",
|
||||||
get_decision_str(graph->finetuning, G_FINETUNING));
|
get_decision_str(graph->finetuning));
|
||||||
if (graph->ignore_singles != G_IGNORE_SINGLES)
|
if (graph->ignore_singles != G_IGNORE_SINGLES)
|
||||||
obstack_fgrow1 (os, "\tignore_singles:\t%s\n",
|
obstack_fgrow1 (os, "\tignore_singles:\t%s\n",
|
||||||
get_decision_str(graph->ignore_singles, G_IGNORE_SINGLES));
|
get_decision_str(graph->ignore_singles));
|
||||||
if (graph->straight_phase != G_STRAIGHT_PHASE)
|
if (graph->straight_phase != G_STRAIGHT_PHASE)
|
||||||
obstack_fgrow1 (os, "\tstraight_phase:\t%s\n",
|
obstack_fgrow1 (os, "\tstraight_phase:\t%s\n",
|
||||||
get_decision_str(graph->straight_phase, G_STRAIGHT_PHASE));
|
get_decision_str(graph->straight_phase));
|
||||||
if (graph->priority_phase != G_PRIORITY_PHASE)
|
if (graph->priority_phase != G_PRIORITY_PHASE)
|
||||||
obstack_fgrow1 (os, "\tpriority_phase:\t%s\n",
|
obstack_fgrow1 (os, "\tpriority_phase:\t%s\n",
|
||||||
get_decision_str(graph->priority_phase, G_PRIORITY_PHASE));
|
get_decision_str(graph->priority_phase));
|
||||||
if (graph->manhattan_edges != G_MANHATTAN_EDGES)
|
if (graph->manhattan_edges != G_MANHATTAN_EDGES)
|
||||||
obstack_fgrow1 (os,
|
obstack_fgrow1 (os,
|
||||||
"\tmanhattan_edges:\t%s\n",
|
"\tmanhattan_edges:\t%s\n",
|
||||||
get_decision_str(graph->manhattan_edges,
|
get_decision_str(graph->manhattan_edges));
|
||||||
G_MANHATTAN_EDGES));
|
|
||||||
if (graph->smanhattan_edges != G_SMANHATTAN_EDGES)
|
if (graph->smanhattan_edges != G_SMANHATTAN_EDGES)
|
||||||
obstack_fgrow1 (os,
|
obstack_fgrow1 (os,
|
||||||
"\tsmanhattan_edges:\t%s\n",
|
"\tsmanhattan_edges:\t%s\n",
|
||||||
get_decision_str(graph->smanhattan_edges,
|
get_decision_str(graph->smanhattan_edges));
|
||||||
G_SMANHATTAN_EDGES));
|
|
||||||
if (graph->near_edges != G_NEAR_EDGES)
|
if (graph->near_edges != G_NEAR_EDGES)
|
||||||
obstack_fgrow1 (os, "\tnear_edges:\t%s\n",
|
obstack_fgrow1 (os, "\tnear_edges:\t%s\n",
|
||||||
get_decision_str(graph->near_edges, G_NEAR_EDGES));
|
get_decision_str(graph->near_edges));
|
||||||
|
|
||||||
if (graph->orientation != G_ORIENTATION)
|
if (graph->orientation != G_ORIENTATION)
|
||||||
obstack_fgrow1 (os, "\torientation:\t%s\n",
|
obstack_fgrow1 (os, "\torientation:\t%s\n",
|
||||||
get_decision_str(graph->orientation, G_ORIENTATION));
|
get_orientation_str(graph->orientation));
|
||||||
|
|
||||||
if (graph->node_alignement != G_NODE_ALIGNEMENT)
|
if (graph->node_alignement != G_NODE_ALIGNEMENT)
|
||||||
obstack_fgrow1 (os, "\tnode_alignement:\t%s\n",
|
obstack_fgrow1 (os, "\tnode_alignement:\t%s\n",
|
||||||
get_decision_str(graph->node_alignement,
|
get_node_alignement_str(graph->node_alignement));
|
||||||
G_NODE_ALIGNEMENT));
|
|
||||||
|
|
||||||
if (graph->port_sharing != G_PORT_SHARING)
|
if (graph->port_sharing != G_PORT_SHARING)
|
||||||
obstack_fgrow1 (os, "\tport_sharing:\t%s\n",
|
obstack_fgrow1 (os, "\tport_sharing:\t%s\n",
|
||||||
get_decision_str(graph->port_sharing, G_PORT_SHARING));
|
get_decision_str(graph->port_sharing));
|
||||||
|
|
||||||
if (graph->arrow_mode != G_ARROW_MODE)
|
if (graph->arrow_mode != G_ARROW_MODE)
|
||||||
obstack_fgrow1 (os, "\tarrow_mode:\t%s\n",
|
obstack_fgrow1 (os, "\tarrow_mode:\t%s\n",
|
||||||
@@ -795,27 +776,22 @@ output_graph (graph_t *graph, struct obstack *os)
|
|||||||
get_crossing_type_str(graph->crossing_weight));
|
get_crossing_type_str(graph->crossing_weight));
|
||||||
if (graph->crossing_phase2 != G_CROSSING_PHASE2)
|
if (graph->crossing_phase2 != G_CROSSING_PHASE2)
|
||||||
obstack_fgrow1 (os, "\tcrossing_phase2:\t%s\n",
|
obstack_fgrow1 (os, "\tcrossing_phase2:\t%s\n",
|
||||||
get_decision_str(graph->crossing_phase2,
|
get_decision_str(graph->crossing_phase2));
|
||||||
G_CROSSING_PHASE2));
|
|
||||||
if (graph->crossing_optimization != G_CROSSING_OPTIMIZATION)
|
if (graph->crossing_optimization != G_CROSSING_OPTIMIZATION)
|
||||||
obstack_fgrow1 (os, "\tcrossing_optimization:\t%s\n",
|
obstack_fgrow1 (os, "\tcrossing_optimization:\t%s\n",
|
||||||
get_decision_str(graph->crossing_optimization,
|
get_decision_str(graph->crossing_optimization));
|
||||||
G_CROSSING_OPTIMIZATION));
|
|
||||||
|
|
||||||
if (graph->view != G_VIEW)
|
if (graph->view != G_VIEW)
|
||||||
obstack_fgrow1 (os, "\tview:\t%s\n", get_view_str(graph->view));
|
obstack_fgrow1 (os, "\tview:\t%s\n", get_view_str(graph->view));
|
||||||
|
|
||||||
if (graph->edges != G_EDGES)
|
if (graph->edges != G_EDGES)
|
||||||
obstack_fgrow1 (os, "\tedges:\t%s\n", get_decision_str(graph->edges,
|
obstack_fgrow1 (os, "\tedges:\t%s\n", get_decision_str(graph->edges));
|
||||||
G_EDGES));
|
|
||||||
|
|
||||||
if (graph->nodes != G_NODES)
|
if (graph->nodes != G_NODES)
|
||||||
obstack_fgrow1 (os,"\tnodes:\t%s\n",
|
obstack_fgrow1 (os,"\tnodes:\t%s\n", get_decision_str(graph->nodes));
|
||||||
get_decision_str(graph->nodes, G_NODES));
|
|
||||||
|
|
||||||
if (graph->splines != G_SPLINES)
|
if (graph->splines != G_SPLINES)
|
||||||
obstack_fgrow1 (os, "\tsplines:\t%s\n",
|
obstack_fgrow1 (os, "\tsplines:\t%s\n", get_decision_str(graph->splines));
|
||||||
get_decision_str(graph->splines, G_SPLINES));
|
|
||||||
|
|
||||||
if (graph->bmax != G_BMAX)
|
if (graph->bmax != G_BMAX)
|
||||||
obstack_fgrow1 (os, "\tbmax:\t%d\n", graph->bmax);
|
obstack_fgrow1 (os, "\tbmax:\t%d\n", graph->bmax);
|
||||||
|
|||||||
Reference in New Issue
Block a user