X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/342b8b6e2156e923797745af2da2596e3086ccd5..b09a18c50d221b54e6bc94e03deb65ecd52c4288:/src/vcg.h diff --git a/src/vcg.h b/src/vcg.h index 8935cc1b..ed356030 100644 --- a/src/vcg.h +++ b/src/vcg.h @@ -1,5 +1,6 @@ /* VCG description handler for Bison. - Copyright 2001 Free Software Foundation, Inc. + + Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -15,14 +16,14 @@ You should have received a copy of the GNU General Public License along with Bison; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef VCG_H_ # define VCG_H_ /* VCG color map. The 32 prime predefined colors. */ -enum color_e +enum color { white = 0, blue, @@ -59,7 +60,7 @@ enum color_e }; /* VCG textmode. Specify the adjustement of the text within the border of a summary node. */ -enum textmode_e +enum textmode { centered, left_justify, @@ -67,7 +68,7 @@ enum textmode_e }; /* VCG shapes. Used for nodes shapes. */ -enum shape_e +enum shape { box, rhomb, @@ -76,60 +77,40 @@ enum shape_e }; /* Structure for colorentries. */ -struct colorentry_s +struct colorentry { int color_index; int red_cp; int green_cp; int blue_cp; - struct colorentry_s *next; + struct colorentry *next; }; /* Structure to construct lists of classnames. */ -struct classname_s +struct classname { int no; /* Class number */ const char *name; /* Name associated to the class no. */ - struct classname_s *next; /* next name class association. */ + struct classname *next; /* next name class association. */ }; /* Structure is in infoname. */ -struct infoname_s +struct infoname { int integer; - const char *string; - struct infoname_s *next; -}; - -/* Layout Algorithms which can be found in VCG. - Details about each algoithm can be found below. */ -enum layoutalgorithm_e -{ - normal, - maxdepth, - mindepth, - maxdepthslow, - mindepthslow, - maxdegree, - mindegree, - maxindegree, - minindegree, - maxoutdegree, - minoutdegree, - minbackward, - dfs, - tree + char const *chars; + struct infoname *next; }; /* VCG decision yes/no. */ -enum decision_e +enum decision { yes, no }; /* VCG graph orientation. */ -enum orientation_e +enum orientation { top_to_bottom, bottom_to_top, @@ -137,8 +118,8 @@ enum orientation_e right_to_left }; -/* VCG alignement for node alignement. */ -enum alignement_e +/* VCG alignment for node alignement. */ +enum alignment { center, top, @@ -146,14 +127,14 @@ enum alignement_e }; /* VCG arrow mode. */ -enum arrow_mode_e +enum arrow_mode { fixed, free_a }; /* VCG crossing weight type. */ -enum crossing_type_e +enum crossing_type { bary, median, @@ -162,7 +143,7 @@ enum crossing_type_e }; /* VCG views. */ -enum view_e +enum view { normal_view, cfish, @@ -175,7 +156,7 @@ enum view_e | Node attributs list. structure that describes a node. | `------------------------------------------------------*/ -struct node_s +struct node { /* Title the unique string identifying the node. This attribute is mandatory. */ @@ -268,12 +249,12 @@ struct node_s and triangle. The drawing of ellipses is much slower than the drawing of the other shapes. Default is box. */ - enum shape_e shape; + enum shape shape; /* textmode specifies the adjustment of the text within the border of a node. The possibilities are center, left.justify and right.justify. Default is center. */ - enum textmode_e textmode; + enum textmode textmode; /* borderwidth specifies the thickness of the node's border in pixels. color is the background color of the node. If none is given, the @@ -284,13 +265,13 @@ struct node_s /* node color. Default is white or transparent, */ - enum color_e color; + enum color color; /* textcolor is the color for the label text. bordercolor is the color of the border. Default color is the textcolor. info1, info2, info3 combines additional text labels with a node or a folded graph. info1, Default is black. */ - enum color_e textcolor; + enum color textcolor; /* info2, info3 can be selected from the menu. The corresponding text labels can be shown by mouse clicks on nodes. @@ -299,14 +280,14 @@ struct node_s /* Node border color. Default is textcolor. */ - enum color_e bordercolor; + enum color bordercolor; /* Next node node... */ - struct node_s *next; + struct node *next; }; /* typedef alias. */ -typedef struct node_s node_t; +typedef struct node node; /*-------------------------------------------------------. | Edge attributs list. Structure that describes an edge. | @@ -322,7 +303,7 @@ enum edge_type }; /* Structs enum definitions for edges. */ -enum linestyle_e +enum linestyle { continuous, dashed, @@ -330,15 +311,15 @@ enum linestyle_e invisible }; -enum arrowstyle_e +enum arrowstyle { solid, line, none }; -/* The struct edge_s itself. */ -struct edge_s +/* The struct edge itself. */ +struct edge { /* Edge type. @@ -365,7 +346,7 @@ struct edge_s drawn. The attributes of its shape (color, thickness) are ignored. To draw a dashed or dotted line needs more time than solid lines. Default is continuous. */ - enum linestyle_e linestyle; + enum linestyle linestyle; /* Thickness is the thickness of an edge. Default is 2. */ @@ -379,7 +360,7 @@ struct edge_s /* color is the color of the edge. Default is black. */ - enum color_e color; + enum color color; /* textcolor is the color of the label of the edge. arrowcolor, backarrowcolor is the color of the arrow head and of the backarrow @@ -388,15 +369,15 @@ struct edge_s of edges that pull a node into its position. The priority of an edges corresponds to the strength of the rubberband. Default is color. */ - enum color_e textcolor; + enum color textcolor; /* Arrow color. Default is color. */ - enum color_e arrowcolor; + enum color arrowcolor; /* BackArrow color. Default is color. */ - enum color_e backarrowcolor; + enum color backarrowcolor; /* arrowsize, backarrowsize The arrow head is a right-angled, isosceles triangle and the cathetuses have length arrowsize. @@ -415,10 +396,10 @@ struct edge_s backarrowstyle is the style of the backarrow head. Styles are none, i.e. no arrow head, solid, and line. Default is solid. */ - enum arrowstyle_e arrowstyle; + enum arrowstyle arrowstyle; /* Default is none. */ - enum arrowstyle_e backarrowstyle; + enum arrowstyle backarrowstyle; /* Default is 1. */ int priority; @@ -448,20 +429,20 @@ struct edge_s /* ** Next edge node... */ - struct edge_s *next; + struct edge *next; }; /* ** typedef alias. */ -typedef struct edge_s edge_t; +typedef struct edge edge; /*--------------------------------------------------------. | Graph attributs list. Structure that describes a graph. | `--------------------------------------------------------*/ -struct graph_s +struct graph { /* Graph title or name. Title specifies the name (a string) associated with the graph. The @@ -488,7 +469,7 @@ struct graph_s folded graph. info1, info2, info3 can be selected from the menu interactively. The corresponding text labels can be shown by mouse clicks on nodes. - Defalut values are empty strings (here NULL pointers) */ + Default values are empty strings (here NULL pointers) */ const char *infos[3]; /* Background color and summary node colors @@ -501,29 +482,29 @@ struct graph_s index 2, green has index 3, etc. Default is white for background and white or transparent for summary nodes. */ - enum color_e color; + enum color color; /* Textcolor. - need explainations ??? - defalut is black for summary nodes. */ - enum color_e textcolor; + need explanations ??? + default is black for summary nodes. */ + enum color textcolor; /* Bordercolor is the color of the summary node's border. Default color is the textcolor. width, height are width and height of the displayed part of the window of the outermost graph in pixels, or width and height of the summary node of inner subgraphs. - Default is the defalut of the textcolor. */ - enum color_e bordercolor; + Default is the default of the textcolor. */ + enum color bordercolor; /* Width, height are width and height of the displayed part of the window of the outermost graph in pixels, or width and height of the summary node of inner subgraphs. - Defalut value is 100. */ + Default value is 100. */ int width; int height; /* Specify the thickness if summary node's border in pixels. - defalut value is 2. */ + default value is 2. */ int borderwidth; /* x, y are the x-position and y-position of the graph's window in @@ -538,7 +519,7 @@ struct graph_s /* folding of a subgraph is 1, if the subgraph is fused, and 0, if the subgraph is visualized explicitly. There are commands to unfold such summary nodes. - Defalut value is 0 */ + Default value is 0 */ int folding; /* Shrink, stretch gives the shrinking and stretching factor for the @@ -556,7 +537,7 @@ struct graph_s summary node. The possibilities are center, left.justify and right.justify. Default value is center.*/ - enum textmode_e textmode; + enum textmode textmode; /* Shape can be specified for subgraphs only. It is the shape of the subgraph summary node that appears if the subgraph is folded: box, @@ -574,23 +555,23 @@ struct graph_s algorithm for downward laid out trees is used, the horizontal order influences only the order of the child nodes at a node, but not the order of the whole level. - Defalut is box, other: rhomb, ellipse, triangle. */ - enum shape_e shape; + Default is box, other: rhomb, ellipse, triangle. */ + enum shape shape; - /* Vertical order is the level position (rank) of the summary node of an - inner subgraph, if this subgraph is folded. We can also specify - level: int. The level is only recognized, if an automatical layout is + /* Vertical order is the level position (rank) of the summary node of an + inner subgraph, if this subgraph is folded. We can also specify + level: int. The level is only recognized, if an automatical layout is calculated. */ int vertical_order; - /* Horizontal order is the horizontal position of the summary node within - a level. The nodes which are specified with horizontal positions are - ordered according to these positions within the levels. The nodes which - do not have this attribute are inserted into this ordering by the - crossing reduction mechanism. Note that connected components are - handled separately, thus it is not possible to intermix such components - by specifying a horizontal order. If the algorithm for downward laid - out trees is used, the horizontal order influences only the order of + /* Horizontal order is the horizontal position of the summary node within + a level. The nodes which are specified with horizontal positions are + ordered according to these positions within the levels. The nodes which + do not have this attribute are inserted into this ordering by the + crossing reduction mechanism. Note that connected components are + handled separately, thus it is not possible to intermix such components + by specifying a horizontal order. If the algorithm for downward laid + out trees is used, the horizontal order influences only the order of the child nodes at a node, but not the order of the whole level. */ int horizontal_order; @@ -605,7 +586,7 @@ struct graph_s int xmax; int ymax; - /* xy-base: specify the upper left corner coordonates of the graph + /* xy-base: specify the upper left corner coordinates of the graph relatively to the root window. Defaults are 5, 5. */ int xbase; @@ -630,7 +611,7 @@ struct graph_s the nodes. The center of a node is aligned to this raster. xlraster is the horizontal raster for the positions of the line control points (the dummy nodes). It should be a divisor of xraster. - defaluts are 1,1. */ + defaults are 1,1. */ int xraster; int yraster; @@ -661,49 +642,21 @@ struct graph_s additional text labels. The names are used in the menus. defaults are 1,2,3... By default, no class names. */ - struct classname_s *classname; + struct classname *classname; - /* Infoname allows to introduce names for the additional text labels. - The names are used in the menus. - Infoname is given by an integer and a string. + /* Infoname allows to introduce names for the additional text labels. + The names are used in the menus. + Infoname is given by an integer and a string. The default value is NULL. */ - struct infoname_s *infoname; - - /* Colorentry allows to fill the color map. A color is a triplet of integer - values for the red/green/blue-part. Each integer is between 0 (off) and - 255 (on), e.g., 0 0 0 is black and 255 255 255 is white. For instance - colorentry 75 : 70 130 180 sets the map entry 75 to steel blue. This + struct infoname *infoname; + + /* Colorentry allows to fill the color map. A color is a triplet of integer + values for the red/green/blue-part. Each integer is between 0 (off) and + 255 (on), e.g., 0 0 0 is black and 255 255 255 is white. For instance + colorentry 75 : 70 130 180 sets the map entry 75 to steel blue. This color can be used by specifying just the number 75. Default id NULL. */ - struct colorentry_s *colorentry; - - /* layoutalgorithm chooses different graph layout algorithms - Possibilities are maxdepth, mindepth, maxdepthslow, mindepthslow, - maxdegree, mindegree, maxindegree, minindegree, maxoutdegree, - minoutdegree, minbackward, dfs and tree. The default algorithm tries - to give all edges the same orientation and is based on the - calculation of strongly connected components. The algorithms that - are based on depth first search are faster. While the simple dfs - does not enforce additionally constraints, the algorithm maxdepth - tries to increase the depth of the layout and the algorithm mindepth - tries to increase the wide of the layout. These algorithms are fast - heuristics. If they are not appropriate, the algorithms maxdepthslow - or mindepthslow also increase the depth or wide, but they are very - slow. The algorithm maxindegree lays out the nodes by scheduling the - nodes with the maximum of incoming edges first, and minindegree lays - out the nodes by scheduling the nodes with the minimum of incoming - edges first. In the same manner work the algorithms maxoutdegree and - minoutdegree for outgoing edges, and maxdegree and mindegree for the - sum of incoming and outgoing edges. These algorithms may have various - effects, and can sometimes be used as replacements of maxdepthslow - or mindepthslow. - - The algorithm minbackward can be used if the graph is acyclic. - The algorithm tree is a specialized method for downward laid out - trees. It is much faster on such tree-like graphs and results in a - balanced layout. - Default is normal. */ - enum layoutalgorithm_e layoutalgorithm; + struct colorentry *colorentry; /* Layout downfactor, layout upfactor, layout nearfactor The layout algorithm partitions the set of edges into edges pointing upward, @@ -717,7 +670,7 @@ struct graph_s layout.nearfactor is large, then the positions of the nodes is mainly determined by the edges pointing sidewards. These attributes have no effect, if the method for downward laid out trees is used. - Defalut is normal. */ + Default is normal. */ int layout_downfactor; int layout_upfactor; int layout_nearfactor; @@ -731,40 +684,31 @@ struct graph_s labels and then partitions the graph, which yield a more compact layout, but may have more crossings. Default is no. */ - enum decision_e late_edge_labels; + enum decision late_edge_labels; /* Display edge labels yes means display labels and no means don't display edge labels. Default vaule is no. */ - enum decision_e display_edge_labels; + enum decision display_edge_labels; /* Dirty edge labels yes enforces a fast layout of edge labels, which may very ugly because several labels may be drawn at the same place. Dirty edge labels cannot be used if splines are used. Default is no. */ - enum decision_e dirty_edge_labels; + enum decision dirty_edge_labels; /* Finetuning no switches the fine tuning phase of the graph layout algorithm off, while it is on as default. The fine tuning phase tries to give all edges the same length. Default is yes. */ - enum decision_e finetuning; + enum decision finetuning; /* Ignore singles yes hides all nodes which would appear single and unconnected from the remaining graph. Such nodes have no edge at all and are sometimes very ugly. Default is to show all nodes. Default is no. */ - enum decision_e ignore_singles; - - /* Straight phase yes initiates an additional phase that tries to avoid - bendings in long edges. - Long edges are laid out by long straight vertical lines with - gradient 90 degree. Thus, this phase is not very appropriate for - normal layout, but it is recommended, if an orthogonal layout is - selected (see manhattan.edges). - Default is no. */ - enum decision_e straight_phase; + enum decision ignore_singles; /* priority phase yes replaces the normal pendulum method by a specialized method: It forces straight long edges with 90 degree, @@ -772,7 +716,7 @@ struct graph_s tune phase of the priority method. This phase is also recommended, if an orthogonal layout is selected (see manhattan.edges). Default is no. */ - enum decision_e priority_phase; + enum decision priority_phase; /* manhattan edges yes switches the orthogonal layout on. Orthogonal layout (or manhattan layout) means that all edges consist of line @@ -784,7 +728,7 @@ struct graph_s on, too, unless priority layout and straight line tuning are switched off explicitly. Default is no. */ - enum decision_e manhattan_edges; + enum decision manhattan_edges; /* Smanhattan edges yes switches a specialized orthogonal layout on: Here, all horizontal edge segments between two levels share the same @@ -793,12 +737,12 @@ struct graph_s looks nice for trees but might be too confusing in general, because the location of an edge might be ambiguously. Default is no. */ - enum decision_e smanhattan_edges; + enum decision smanhattan_edges; /* Near edges no suppresses near edges and bent near edges in the graph layout. Default is yes. */ - enum decision_e near_edges; + enum decision near_edges; /* Orientation specifies the orientation of the graph: top.to.bottom, bottom.to.top, left.to.right or right.to.left. Note: the normal @@ -807,7 +751,7 @@ struct graph_s is left to right, the attribute xlspace is not the horizontal but the vertical distance between lines, etc. Default is to_to_bottom. */ - enum orientation_e orientation; + enum orientation orientation; /* Node alignment specified the vertical alignment of nodes at the horizontal reference line of the levels. If top is specified, the @@ -815,7 +759,7 @@ struct graph_s the bottoms have the same y-coordinate, on center the nodes are centered at the levels. Default is center. */ - enum alignement_e node_alignement; + enum alignment node_alignment; /* Port sharing no suppresses the sharing of ports of edges at the nodes. Normally, if multiple edges are adjacent to the same node, @@ -827,7 +771,7 @@ struct graph_s is used, each edge has its own port, i.e. its own place where it is adjacent to the node. Default is yes. */ - enum decision_e port_sharing; + enum decision port_sharing; /* Arrow mode fixed (default) should be used, if port sharing is used, because then, only a fixed set of rotations for the arrow heads are @@ -838,7 +782,7 @@ struct graph_s arrow mode is fixed, then the arrow head is rotated only in steps of 45 degree, and only one arrow head occurs at each port. Default is fixed. */ - enum arrow_mode_e arrow_mode; + enum arrow_mode arrow_mode; /* Treefactor The algorithm tree for downward laid out trees tries to produce a medium dense, balanced tree-like layout. If the tree @@ -868,21 +812,21 @@ struct graph_s different nodes are not very probable, thus the crossing reduction phase 2 might be very fast. Default is bary. */ - enum crossing_type_e crossing_weight; + enum crossing_type crossing_weight; /* Crossing phase2 is the most time consuming phase of the crossing reduction. In this phase, the nodes that happen to have equal crossing weights are permuted. By specifying no, this phase is suppressed. Default is yes. */ - enum decision_e crossing_phase2; + enum decision crossing_phase2; /* Crossing optimization is a postprocessing phase after the normal crossing reduction: we try to optimize locally, by exchanging pairs of nodes to reduce the crossings. Although this phase is not very time consuming, it can be suppressed by specifying no. Default is yes. */ - enum decision_e crossing_optimization; + enum decision crossing_optimization; /* View allows to select the fisheye views. Because of the fixed size of the window that shows the graph, we normally @@ -906,16 +850,16 @@ struct graph_s are recognizable. With pfish the self adaptable polar fisheye is selected that shows the whole graph, and with fpfish the fixed radius polar fisheye is selected. - Defalut is normal view. */ - enum view_e view; + Default is normal view. */ + enum view view; /* Edges no suppresses the drawing of edges. Default is yes. */ - enum decision_e edges; + enum decision edges; /* Nodes no suppresses the drawing of nodes. Default is yes. */ - enum decision_e nodes; + enum decision nodes; /* Splines specifies whether splines are used to draw edges (yes or no). As default, polygon segments are used to draw edges, because this is @@ -923,7 +867,7 @@ struct graph_s validated, and is very slow. Its use is mainly to prepare high quality PostScript output for very small graphs. Default is no. */ - enum decision_e splines; + enum decision splines; /* Bmax set the maximal number of iterations that are done for the reduction of edge bendings. @@ -940,8 +884,8 @@ struct graph_s int cmin; /* Cmax set the maximal number of interactions for crossing reduction. - This is helpful for speedup the layout process. - Default is infinite. */ + This is helpful for speeding up the layout process. + Default is -1, which represents infinity. */ int cmax; /* Pmin set the minimal number of iterations that is done with the @@ -976,44 +920,44 @@ struct graph_s /* Generic values. */ - node_t node; - edge_t edge; + node node; + edge edge; /* List of nodes declared. Pointer. */ - node_t *node_list; + node *node_list; /* List of edges declared. Pointer. */ - edge_t *edge_list; + edge *edge_list; }; /* Graph typedefs. */ -typedef struct graph_s graph_t; +typedef struct graph graph; -void new_graph PARAMS ((graph_t *g)); -void new_node PARAMS ((node_t *node)); -void new_edge PARAMS ((edge_t *edge)); +void new_graph (graph *g); +void new_node (node *n); +void new_edge (edge *e); -void add_node PARAMS ((graph_t *graph, node_t *node)); -void add_edge PARAMS ((graph_t *graph, edge_t *edge)); +void add_node (graph *g, node *n); +void add_edge (graph *g, edge *e); -void add_colorentry PARAMS ((graph_t *g, int color_idx, int red_cp, - int green_cp, int blue_cp)); -void add_classname PARAMS ((graph_t *g, int val, const char *name)); -void add_infoname PARAMS ((graph_t *g, int val, const char *name)); +void add_colorentry (graph *g, int color_idx, int red_cp, + int green_cp, int blue_cp); +void add_classname (graph *g, int val, const char *name); +void add_infoname (graph *g, int val, const char *name); -void open_node PARAMS ((FILE *fout)); -void output_node PARAMS ((node_t *node, FILE *fout)); -void close_node PARAMS ((FILE *fout)); +void open_node (FILE *fout); +void output_node (node *n, FILE *fout); +void close_node (FILE *fout); -void open_edge PARAMS ((edge_t *edge, FILE *fout)); -void output_edge PARAMS ((edge_t *edge, FILE *fout)); -void close_edge PARAMS ((FILE *fout)); +void open_edge (edge *e, FILE *fout); +void output_edge (edge *e, FILE *fout); +void close_edge (FILE *fout); -void open_graph PARAMS ((FILE *fout)); -void output_graph PARAMS ((graph_t *graph, FILE *fout)); -void close_graph PARAMS ((graph_t *graph, FILE *fout)); +void open_graph (FILE *fout); +void output_graph (graph *g, FILE *fout); +void close_graph (graph *g, FILE *fout); #endif /* VCG_H_ */