/* Definitions for Graphviz output of state machines genetated by Bison. Copyright (C) 2001, 2002, 2005, 2006 Free Software Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. Bison is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. Bison is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef GRAPHVIZ_H_ # define GRAPHVIZ_H_ #include /** Graph orientations supported by GraphViz. */ enum graph_direction { top_to_bottom, bottom_to_top, left_to_right, right_to_left }; /** Some node shapes supported by GraphViz. */ enum shape { box, ellipse, circle, doublecircle }; /** Some basic colors from the X11 color scheme. */ enum color { white, black, blue, red, green, lightgrey }; /** Some arrow types supported by GraphViz. */ enum arrow_type { normal, empty, vee }; enum decision { yes, no }; struct node_attributes { const char *label; enum shape shape; enum color fillcolor; enum color textcolor; enum color bordercolor; }; struct edge_attributes { const char *label; double weight; enum color color; enum color textcolor; enum arrow_type arrowstyle; }; struct graph_attributes { enum graph_direction orientation; enum decision splines; enum decision center; enum decision landscape; }; struct edge { const char *sourcename; const char *targetname; struct edge_attributes attrs; }; struct node { const char *title; struct node_attributes attrs; }; struct graph { const char *title; /** General properties of a graph. */ struct graph_attributes graph_attributes; /** General node and edge attributes that apply to the entire graph. */ struct node_attributes node_attributes; struct edge_attributes edge_attributes; }; typedef struct graph graph; typedef struct node node; typedef struct edge edge; void new_graph(graph *g); void new_node(node *n); void new_edge(edge *e); void open_node(FILE *fout); void output_node(node *n, FILE *fout); void close_node(FILE *fout); void open_edge(FILE *fout); void output_edge(edge *e, FILE *fout); void close_edge(FILE *fout); /** Start a DOT graph description */ void open_graph(FILE *fout); /** output a graph description */ void output_graph(graph *g, FILE *fout); /** Close a graph description */ void close_graph(FILE *fout); #endif