mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* NEWS: The -g and --graph options now output graphs in Graphviz
DOT format, not VCG format. * doc/bison.1: Likewise. * doc/bison.texinfo (Understanding, Bison Options): Likewise. * TODO: Remove Graphviz entry. * src/Makefile.am (bison_SOURCES): Add graphviz.c and graphviz.h; remove vcg.c, vcg.h, vcg_defaults.h. * src/vcg.c, src/vcg.h, src/vcg_defaults.h: Remove. * src/graphviz.c, src/graphviz.h: New files. * src/files.c (compute_output_file_names): Output .dot, not .vcg. * src/files.h: Make comment more generic. * src/main.c (main): Likewise. * src/print_graph.h: Likewise. * src/getargs.c (usage): Make usage description more generic. * src/print_graph.c: Include graphviz.h rather than vcg.h. (static_graph, fgraph): Remove. All uses changed to pass arguments instead of sharing a static var. (print_core, print_actions, print_state, print_graph): Output graphviz format rather than VCG format. * tests/.cvsignore: Remove *.vcg; add *.dot. * tests/output.at: Expect *.dot files, not *.vcg files.
This commit is contained in:
22
ChangeLog
22
ChangeLog
@@ -1,5 +1,27 @@
|
||||
2006-10-12 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* NEWS: The -g and --graph options now output graphs in Graphviz
|
||||
DOT format, not VCG format.
|
||||
* doc/bison.1: Likewise.
|
||||
* doc/bison.texinfo (Understanding, Bison Options): Likewise.
|
||||
* TODO: Remove Graphviz entry.
|
||||
* src/Makefile.am (bison_SOURCES): Add graphviz.c and graphviz.h;
|
||||
remove vcg.c, vcg.h, vcg_defaults.h.
|
||||
* src/vcg.c, src/vcg.h, src/vcg_defaults.h: Remove.
|
||||
* src/graphviz.c, src/graphviz.h: New files.
|
||||
* src/files.c (compute_output_file_names): Output .dot, not .vcg.
|
||||
* src/files.h: Make comment more generic.
|
||||
* src/main.c (main): Likewise.
|
||||
* src/print_graph.h: Likewise.
|
||||
* src/getargs.c (usage): Make usage description more generic.
|
||||
* src/print_graph.c: Include graphviz.h rather than vcg.h.
|
||||
(static_graph, fgraph): Remove. All uses changed to pass
|
||||
arguments instead of sharing a static var.
|
||||
(print_core, print_actions, print_state, print_graph):
|
||||
Output graphviz format rather than VCG format.
|
||||
* tests/.cvsignore: Remove *.vcg; add *.dot.
|
||||
* tests/output.at: Expect *.dot files, not *.vcg files.
|
||||
|
||||
* data/Makefile.am (dist_pkgdata_DATA): Add bison.m4; this
|
||||
accommodates the 2006-10-08 change.
|
||||
|
||||
|
||||
5
NEWS
5
NEWS
@@ -1,6 +1,11 @@
|
||||
Bison News
|
||||
----------
|
||||
|
||||
Changes in version 2.3a+ (????-??-??):
|
||||
|
||||
* The -g and --graph options now output graphs in Graphviz DOT format,
|
||||
not VCG format.
|
||||
|
||||
Changes in version 2.3a, 2006-09-13:
|
||||
|
||||
* Instead of %union, you can define and use your own union type
|
||||
|
||||
5
TODO
5
TODO
@@ -310,9 +310,8 @@ at the proper place to bison.simple. Ditto for YYACT_PROLOGUE.
|
||||
I was wondering what you think about adding YYACT_PROLOGUE/EPILOGUE
|
||||
to bison. If you're interested, I'll work on a patch.
|
||||
|
||||
* Move to Graphviz
|
||||
Well, VCG seems really dead. Move to Graphviz instead. Also, equip
|
||||
the parser with a means to create the (visual) parse tree.
|
||||
* Better graphics
|
||||
Equip the parser with a means to create the (visual) parse tree.
|
||||
|
||||
-----
|
||||
|
||||
|
||||
@@ -164,11 +164,11 @@ the name of the output filename.
|
||||
.BI \-g
|
||||
.br
|
||||
.ns
|
||||
Output a VCG definition of the LALR(1) grammar automaton computed by
|
||||
Output a graph of the grammar automaton computed by
|
||||
Bison. If the grammar file is
|
||||
.BR foo.y
|
||||
, the VCG output file will be
|
||||
.BR foo.vcg .
|
||||
, the output file will be
|
||||
.BR foo.dot .
|
||||
.TP
|
||||
.BI \-\-graph= graph-file
|
||||
The behavior of
|
||||
|
||||
@@ -6374,8 +6374,7 @@ As documented elsewhere (@pxref{Algorithm, ,The Bison Parser Algorithm})
|
||||
Bison parsers are @dfn{shift/reduce automata}. In some cases (much more
|
||||
frequent than one would hope), looking at this automaton is required to
|
||||
tune or simply fix a parser. Bison provides two different
|
||||
representation of it, either textually or graphically (as a @acronym{VCG}
|
||||
file).
|
||||
representation of it, either textually or graphically (as a DOT file).
|
||||
|
||||
The textual file is generated when the options @option{--report} or
|
||||
@option{--verbose} are specified, see @xref{Invocation, , Invoking
|
||||
@@ -7073,10 +7072,11 @@ The other output files' names are constructed from @var{file} as
|
||||
described under the @samp{-v} and @samp{-d} options.
|
||||
|
||||
@item -g
|
||||
Output a @acronym{VCG} definition of the @acronym{LALR}(1) grammar
|
||||
automaton computed by Bison. If the grammar file is @file{foo.y}, the
|
||||
@acronym{VCG} output file will
|
||||
be @file{foo.vcg}.
|
||||
Output a graphical representation of the @acronym{LALR}(1) grammar
|
||||
automaton computed by Bison, in @uref{http://www.graphviz.org/, Graphviz}
|
||||
@uref{http://www.graphviz.org/doc/info/lang.html, @acronym{DOT}} format.
|
||||
If the grammar file is @file{foo.y}, the output file will
|
||||
be @file{foo.dot}.
|
||||
|
||||
@item --graph=@var{graph-file}
|
||||
The behavior of @var{--graph} is the same than @samp{-g}. The only
|
||||
@@ -8931,9 +8931,9 @@ grammatically indivisible. The piece of text it represents is a token.
|
||||
@c LocalWords: strncmp intval tindex lvalp locp llocp typealt YYBACKUP
|
||||
@c LocalWords: YYEMPTY YYEOF YYRECOVERING yyclearin GE def UMINUS maybeword
|
||||
@c LocalWords: Johnstone Shamsa Sadaf Hussain Tomita TR uref YYMAXDEPTH
|
||||
@c LocalWords: YYINITDEPTH stmnts ref stmnt initdcl maybeasm VCG notype
|
||||
@c LocalWords: YYINITDEPTH stmnts ref stmnt initdcl maybeasm notype
|
||||
@c LocalWords: hexflag STR exdent itemset asis DYYDEBUG YYFPRINTF args
|
||||
@c LocalWords: infile ypp yxx outfile itemx vcg tex leaderfill
|
||||
@c LocalWords: infile ypp yxx outfile itemx tex leaderfill
|
||||
@c LocalWords: hbox hss hfill tt ly yyin fopen fclose ofirst gcc ll
|
||||
@c LocalWords: yyrestart nbar yytext fst snd osplit ntwo strdup AST
|
||||
@c LocalWords: YYSTACK DVI fdl printindex
|
||||
|
||||
@@ -65,8 +65,7 @@ bison_SOURCES = \
|
||||
system.h \
|
||||
tables.h tables.c \
|
||||
uniqstr.c uniqstr.h \
|
||||
vcg.c vcg.h \
|
||||
vcg_defaults.h
|
||||
graphviz.c graphviz.h
|
||||
|
||||
EXTRA_bison_SOURCES = scan-code.l scan-skel.l scan-gram.l
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ compute_output_file_names (void)
|
||||
if (graph_flag)
|
||||
{
|
||||
if (! spec_graph_file)
|
||||
spec_graph_file = concat2 (all_but_tab_ext, ".vcg");
|
||||
spec_graph_file = concat2 (all_but_tab_ext, ".dot");
|
||||
name[names++] = spec_graph_file;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/* File names and variables for bison,
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
Copyright (C) 1984, 1989, 2000, 2001, 2002, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -38,7 +40,7 @@ extern char const *spec_file_prefix;
|
||||
/* --verbose. */
|
||||
extern char const *spec_verbose_file;
|
||||
|
||||
/* File name specified for the output VCG graph. */
|
||||
/* File name specified for the output graph. */
|
||||
extern char const *spec_graph_file;
|
||||
|
||||
/* File name specified with --defines. */
|
||||
|
||||
@@ -274,7 +274,7 @@ Output:\n\
|
||||
-v, --verbose same as `--report=state'\n\
|
||||
-b, --file-prefix=PREFIX specify a PREFIX for output files\n\
|
||||
-o, --output=FILE leave output to FILE\n\
|
||||
-g, --graph also produce a VCG description of the automaton\n\
|
||||
-g, --graph also output a graph of the automaton\n\
|
||||
\n\
|
||||
"), stdout);
|
||||
|
||||
|
||||
66
src/graphviz.c
Normal file
66
src/graphviz.c
Normal file
@@ -0,0 +1,66 @@
|
||||
/* Output Graphviz specification of a state machine generated by Bison.
|
||||
|
||||
Copyright (C) 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. */
|
||||
|
||||
/* Written by Paul Eggert and Satya Kiran Popuri. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <quotearg.h>
|
||||
|
||||
#include "graphviz.h"
|
||||
|
||||
/* Return an unambiguous printable representation for NAME, suitable
|
||||
for C strings. Use slot 2 since the user may use slots 0 and 1. */
|
||||
|
||||
static char const *
|
||||
quote (char const *name)
|
||||
{
|
||||
return quotearg_n_style (2, c_quoting_style, name);
|
||||
}
|
||||
|
||||
void
|
||||
start_graph (FILE *fout)
|
||||
{
|
||||
fputs ("digraph Automaton{\n", fout);
|
||||
}
|
||||
|
||||
void
|
||||
output_node (int id, char const *label, FILE *fout)
|
||||
{
|
||||
fprintf (fout, "%d[label=%s]\n", id, quote (label));
|
||||
}
|
||||
|
||||
void
|
||||
output_edge (int source, int destination, char const *label,
|
||||
char const *style, FILE *fout)
|
||||
{
|
||||
fprintf (fout, "%d->%d[style=%s", source, destination, style);
|
||||
if (label)
|
||||
fprintf (fout, " label=%s", quote (label));
|
||||
fputs ("]\n", fout);
|
||||
}
|
||||
|
||||
void
|
||||
finish_graph (FILE *fout)
|
||||
{
|
||||
fputs ("}\n", fout);
|
||||
}
|
||||
7
src/graphviz.h
Normal file
7
src/graphviz.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
void start_graph (FILE *fout);
|
||||
void output_node (int id, char const *label, FILE *fout);
|
||||
void output_edge (int source, int destination, char const *label,
|
||||
char const *style, FILE *fout);
|
||||
void finish_graph (FILE *fout);
|
||||
@@ -137,7 +137,7 @@ main (int argc, char *argv[])
|
||||
timevar_pop (TV_REPORT);
|
||||
}
|
||||
|
||||
/* Output the VCG graph. */
|
||||
/* Output the graph. */
|
||||
if (graph_flag)
|
||||
{
|
||||
timevar_push (TV_GRAPH);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/* Output a VCG description on generated parser, for Bison,
|
||||
/* Output a graph of the generated parser, for Bison.
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
@@ -31,15 +32,12 @@
|
||||
#include "files.h"
|
||||
#include "getargs.h"
|
||||
#include "gram.h"
|
||||
#include "graphviz.h"
|
||||
#include "lalr.h"
|
||||
#include "print_graph.h"
|
||||
#include "reader.h"
|
||||
#include "state.h"
|
||||
#include "symtab.h"
|
||||
#include "vcg.h"
|
||||
|
||||
static graph static_graph;
|
||||
static FILE *fgraph = NULL;
|
||||
|
||||
|
||||
/*----------------------------.
|
||||
@@ -61,7 +59,7 @@ print_core (struct obstack *oout, state *s)
|
||||
snritems = nritemset;
|
||||
}
|
||||
|
||||
obstack_fgrow1 (oout, "state %2d\n", s->number);
|
||||
obstack_fgrow1 (oout, "%d", s->number);
|
||||
for (i = 0; i < snritems; i++)
|
||||
{
|
||||
item_number *sp;
|
||||
@@ -75,10 +73,7 @@ print_core (struct obstack *oout, state *s)
|
||||
|
||||
r = item_number_as_rule_number (*sp);
|
||||
|
||||
if (i)
|
||||
obstack_1grow (oout, '\n');
|
||||
obstack_fgrow1 (oout, " %s -> ",
|
||||
rules[r].lhs->tag);
|
||||
obstack_fgrow1 (oout, "\n%s -> ", rules[r].lhs->tag);
|
||||
|
||||
for (sp = rules[r].rhs; sp < sp1; sp++)
|
||||
obstack_fgrow1 (oout, "%s ", symbols[*sp]->tag);
|
||||
@@ -120,17 +115,13 @@ print_core (struct obstack *oout, state *s)
|
||||
`---------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
print_actions (state *s, const char *node_name)
|
||||
print_actions (state const *s, FILE *fgraph)
|
||||
{
|
||||
int i;
|
||||
|
||||
transitions *trans = s->transitions;
|
||||
reductions *reds = s->reductions;
|
||||
transitions const *trans = s->transitions;
|
||||
|
||||
static char buff[10];
|
||||
edge e;
|
||||
|
||||
if (!trans->num && !reds)
|
||||
if (!trans->num && !s->reductions)
|
||||
return;
|
||||
|
||||
for (i = 0; i < trans->num; i++)
|
||||
@@ -139,23 +130,18 @@ print_actions (state *s, const char *node_name)
|
||||
state *s1 = trans->states[i];
|
||||
symbol_number sym = s1->accessing_symbol;
|
||||
|
||||
new_edge (&e);
|
||||
/* Shifts are solid, gotos are dashed, and error is dotted. */
|
||||
char const *style =
|
||||
(TRANSITION_IS_ERROR (trans, i) ? "dotted"
|
||||
: TRANSITION_IS_SHIFT (trans, i) ? "solid"
|
||||
: "dashed");
|
||||
|
||||
if (s->number > s1->number)
|
||||
e.type = back_edge;
|
||||
open_edge (&e, fgraph);
|
||||
/* The edge source is the current node. */
|
||||
e.sourcename = node_name;
|
||||
sprintf (buff, "%d", s1->number);
|
||||
e.targetname = buff;
|
||||
/* Shifts are blue, gotos are green, and error is red. */
|
||||
if (TRANSITION_IS_ERROR (trans, i))
|
||||
e.color = red;
|
||||
else
|
||||
e.color = TRANSITION_IS_SHIFT (trans, i) ? blue : green;
|
||||
e.label = symbols[sym]->tag;
|
||||
output_edge (&e, fgraph);
|
||||
close_edge (fgraph);
|
||||
if (TRANSITION_IS_ERROR (trans, i)
|
||||
&& strcmp (symbols[sym]->tag, "error") != 0)
|
||||
abort ();
|
||||
output_edge (s->number, s1->number,
|
||||
TRANSITION_IS_ERROR (trans, i) ? NULL : symbols[sym]->tag,
|
||||
style, fgraph);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,29 +152,19 @@ print_actions (state *s, const char *node_name)
|
||||
`-------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
print_state (state *s)
|
||||
print_state (state *s, FILE *fgraph)
|
||||
{
|
||||
static char name[10];
|
||||
struct obstack node_obstack;
|
||||
node n;
|
||||
|
||||
/* The labels of the nodes are their the items. */
|
||||
/* A node's label contains its items. */
|
||||
obstack_init (&node_obstack);
|
||||
new_node (&n);
|
||||
sprintf (name, "%d", s->number);
|
||||
n.title = name;
|
||||
print_core (&node_obstack, s);
|
||||
obstack_1grow (&node_obstack, '\0');
|
||||
n.label = obstack_finish (&node_obstack);
|
||||
|
||||
open_node (fgraph);
|
||||
output_node (&n, fgraph);
|
||||
close_node (fgraph);
|
||||
output_node (s->number, obstack_finish (&node_obstack), fgraph);
|
||||
obstack_free (&node_obstack, 0);
|
||||
|
||||
/* Output the edges. */
|
||||
print_actions (s, name);
|
||||
|
||||
obstack_free (&node_obstack, 0);
|
||||
print_actions (s, fgraph);
|
||||
}
|
||||
|
||||
|
||||
@@ -196,32 +172,15 @@ void
|
||||
print_graph (void)
|
||||
{
|
||||
state_number i;
|
||||
|
||||
/* Output file. */
|
||||
fgraph = xfopen (spec_graph_file, "w");
|
||||
|
||||
new_graph (&static_graph);
|
||||
|
||||
static_graph.display_edge_labels = yes;
|
||||
|
||||
static_graph.port_sharing = no;
|
||||
static_graph.finetuning = yes;
|
||||
static_graph.priority_phase = yes;
|
||||
static_graph.splines = yes;
|
||||
|
||||
static_graph.crossing_weight = median;
|
||||
|
||||
/* Output graph options. */
|
||||
open_graph (fgraph);
|
||||
output_graph (&static_graph, fgraph);
|
||||
FILE *fgraph = xfopen (spec_graph_file, "w");
|
||||
start_graph (fgraph);
|
||||
|
||||
/* Output nodes and edges. */
|
||||
new_closure (nritems);
|
||||
for (i = 0; i < nstates; i++)
|
||||
print_state (states[i]);
|
||||
print_state (states[i], fgraph);
|
||||
free_closure ();
|
||||
|
||||
/* Close graph. */
|
||||
close_graph (&static_graph, fgraph);
|
||||
finish_graph (fgraph);
|
||||
xfclose (fgraph);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* Output a VCG description on generated parser, for bison,
|
||||
Copyright 2000 Free Software Foundation, Inc.
|
||||
/* Output a graph of the generated parser, for Bison.
|
||||
|
||||
Copyright 2000, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Bison, the GNU Compiler Compiler.
|
||||
|
||||
|
||||
841
src/vcg.c
841
src/vcg.c
@@ -1,841 +0,0 @@
|
||||
/* VCG description handler for Bison.
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 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. */
|
||||
|
||||
#include <config.h>
|
||||
#include "system.h"
|
||||
|
||||
#include <quotearg.h>
|
||||
|
||||
#include "vcg.h"
|
||||
#include "vcg_defaults.h"
|
||||
|
||||
/* Return an unambiguous printable representated, for NAME, suitable
|
||||
for C strings. Use slot 2 since the user may use slots 0 and 1.
|
||||
*/
|
||||
|
||||
static char const *
|
||||
quote (char const *name)
|
||||
{
|
||||
return quotearg_n_style (2, c_quoting_style, name);
|
||||
}
|
||||
|
||||
|
||||
/* Initialize a graph with the default values. */
|
||||
void
|
||||
new_graph (graph *g)
|
||||
{
|
||||
g->title = G_TITLE;
|
||||
g->label = G_LABEL;
|
||||
|
||||
g->infos[0] = G_INFOS1;
|
||||
g->infos[1] = G_INFOS2;
|
||||
g->infos[2] = G_INFOS3;
|
||||
|
||||
g->color = G_COLOR;
|
||||
g->textcolor = G_TEXTCOLOR;
|
||||
g->bordercolor = G_BORDERCOLOR;
|
||||
|
||||
g->width = G_WIDTH;
|
||||
g->height = G_HEIGHT;
|
||||
g->borderwidth = G_BORDERWIDTH;
|
||||
g->x = G_X;
|
||||
g->y = G_Y;
|
||||
g->folding = G_FOLDING;
|
||||
g->shrink = G_SHRINK;
|
||||
g->stretch = G_STRETCH;
|
||||
|
||||
g->textmode = G_TEXTMODE;
|
||||
g->shape = G_SHAPE;
|
||||
|
||||
g->vertical_order = G_VERTICAL_ORDER;
|
||||
g->horizontal_order = G_HORIZONTAL_ORDER;
|
||||
|
||||
g->xmax = G_XMAX; /* Not output. */
|
||||
g->ymax = G_YMAX; /* Not output. */
|
||||
|
||||
g->xbase = G_XBASE;
|
||||
g->ybase = G_YBASE;
|
||||
|
||||
g->xspace = G_XSPACE;
|
||||
g->yspace = G_YSPACE;
|
||||
g->xlspace = G_XLSPACE; /* Not output. */
|
||||
|
||||
g->xraster = G_XRASTER;
|
||||
g->yraster = G_YRASTER;
|
||||
g->xlraster = G_XLRASTER;
|
||||
|
||||
g->hidden = G_HIDDEN; /* No default value. */
|
||||
|
||||
g->classname = G_CLASSNAME; /* No class name association. */
|
||||
|
||||
g->layout_downfactor = G_LAYOUT_DOWNFACTOR;
|
||||
g->layout_upfactor = G_LAYOUT_UPFACTOR;
|
||||
g->layout_nearfactor = G_LAYOUT_NEARFACTOR;
|
||||
g->layout_splinefactor = G_LAYOUT_SPLINEFACTOR;
|
||||
|
||||
g->late_edge_labels = G_LATE_EDGE_LABELS;
|
||||
g->display_edge_labels = G_DISPLAY_EDGE_LABELS;
|
||||
g->dirty_edge_labels = G_DIRTY_EDGE_LABELS;
|
||||
g->finetuning = G_FINETUNING;
|
||||
g->ignore_singles = G_IGNORE_SINGLES;
|
||||
g->priority_phase = G_PRIORITY_PHASE;
|
||||
g->manhattan_edges = G_MANHATTAN_EDGES;
|
||||
g->smanhattan_edges = G_SMANHATTAN_EDGES;
|
||||
g->near_edges = G_NEAR_EDGES;
|
||||
|
||||
g->orientation = G_ORIENTATION;
|
||||
g->node_alignment = G_NODE_ALIGNMENT;
|
||||
g->port_sharing = G_PORT_SHARING;
|
||||
g->arrow_mode = G_ARROW_MODE;
|
||||
g->treefactor = G_TREEFACTOR;
|
||||
g->spreadlevel = G_SPREADLEVEL;
|
||||
g->crossing_weight = G_CROSSING_WEIGHT;
|
||||
g->crossing_phase2 = G_CROSSING_PHASE2;
|
||||
g->crossing_optimization = G_CROSSING_OPTIMIZATION;
|
||||
g->view = G_VIEW;
|
||||
|
||||
g->edges = G_EDGES;
|
||||
g->nodes = G_NODES;
|
||||
g->splines = G_SPLINES;
|
||||
|
||||
g->bmax = G_BMAX;
|
||||
g->cmin = G_CMIN;
|
||||
g->cmax = G_CMAX;
|
||||
g->pmin = G_PMIN;
|
||||
g->pmax = G_PMAX;
|
||||
g->rmin = G_RMIN;
|
||||
g->rmax = G_RMAX;
|
||||
g->smax = G_SMAX;
|
||||
|
||||
g->node_list = G_NODE_LIST;
|
||||
g->edge_list = G_EDGE_LIST;
|
||||
|
||||
new_edge (&g->edge);
|
||||
new_node (&g->node);
|
||||
}
|
||||
|
||||
/* Initialize a node with the default values. */
|
||||
void
|
||||
new_node (node *n)
|
||||
{
|
||||
n->title = N_TITLE;
|
||||
n->label = N_LABEL;
|
||||
|
||||
n->locx = N_LOCX; /* Default unspcified. */
|
||||
n->locy = N_LOCY; /* Default unspcified. */
|
||||
|
||||
n->vertical_order = N_VERTICAL_ORDER; /* Default unspcified. */
|
||||
n->horizontal_order = N_HORIZONTAL_ORDER; /* Default unspcified. */
|
||||
|
||||
n->width = N_WIDTH; /* We assume that we can't define it now. */
|
||||
n->height = N_HEIGHT; /* Also. */
|
||||
|
||||
n->shrink = N_SHRINK;
|
||||
n->stretch = N_STRETCH;
|
||||
|
||||
n->folding = N_FOLDING; /* No explicit default value. */
|
||||
|
||||
n->shape = N_SHAPE;
|
||||
n->textmode = N_TEXTMODE;
|
||||
n->borderwidth = N_BORDERWIDTH;
|
||||
|
||||
n->color = N_COLOR;
|
||||
n->textcolor = N_TEXTCOLOR;
|
||||
n->bordercolor = N_BORDERCOLOR;
|
||||
|
||||
n->infos[0] = N_INFOS1;
|
||||
n->infos[1] = N_INFOS2;
|
||||
n->infos[2] = N_INFOS3;
|
||||
|
||||
n->next = N_NEXT;
|
||||
}
|
||||
|
||||
/* Initialize an edge with the default values. */
|
||||
void
|
||||
new_edge (edge *e)
|
||||
{
|
||||
e->type = E_EDGE_TYPE;
|
||||
|
||||
e->sourcename = E_SOURCENAME;
|
||||
e->targetname = E_TARGETNAME;
|
||||
e->label = E_LABEL;
|
||||
|
||||
e->linestyle = E_LINESTYLE;
|
||||
e->thickness = E_THICKNESS;
|
||||
|
||||
e->class = E_CLASS;
|
||||
|
||||
e->color = E_COLOR;
|
||||
e->textcolor = E_TEXTCOLOR;
|
||||
e->arrowcolor = E_ARROWCOLOR;
|
||||
e->backarrowcolor = E_BACKARROWCOLOR;
|
||||
|
||||
e->arrowsize = E_ARROWSIZE;
|
||||
e->backarrowsize = E_BACKARROWSIZE;
|
||||
e->arrowstyle = E_ARROWSTYLE;
|
||||
|
||||
e->backarrowstyle = E_BACKARROWSTYLE;
|
||||
|
||||
e->priority = E_PRIORITY;
|
||||
|
||||
e->anchor = E_ANCHOR;
|
||||
|
||||
e->horizontal_order = E_HORIZONTAL_ORDER;
|
||||
|
||||
e->next = E_NEXT;
|
||||
}
|
||||
|
||||
/*----------------------------------------------.
|
||||
| Get functions. |
|
||||
| Return string corresponding to an enum value. |
|
||||
`----------------------------------------------*/
|
||||
|
||||
static const char *
|
||||
get_color_str (enum color color)
|
||||
{
|
||||
switch (color)
|
||||
{
|
||||
default: abort ();
|
||||
case white: return "white";
|
||||
case blue: return "blue";
|
||||
case red: return "red";
|
||||
case green: return "green";
|
||||
case yellow: return "yellow";
|
||||
case magenta: return "magenta";
|
||||
case cyan: return "cyan";
|
||||
case darkgrey: return "darkgrey";
|
||||
case darkblue: return "darkblue";
|
||||
case darkred: return "darkred";
|
||||
case darkgreen: return "darkgreen";
|
||||
case darkyellow: return "darkyellow";
|
||||
case darkmagenta: return "darkmagenta";
|
||||
case darkcyan: return "darkcyan";
|
||||
case gold: return "gold";
|
||||
case lightgrey: return "lightgrey";
|
||||
case lightblue: return "lightblue";
|
||||
case lightred: return "lightred";
|
||||
case lightgreen: return "lightgreen";
|
||||
case lightyellow: return "lightyellow";
|
||||
case lightmagenta: return "lightmagenta";
|
||||
case lightcyan: return "lightcyan";
|
||||
case lilac: return "lilac";
|
||||
case turquoise: return "turquoise";
|
||||
case aquamarine: return "aquamarine";
|
||||
case khaki: return "khaki";
|
||||
case purple: return "purple";
|
||||
case yellowgreen: return "yellowgreen";
|
||||
case pink: return "pink";
|
||||
case orange: return "orange";
|
||||
case orchid: return "orchid";
|
||||
case black: return "black";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_textmode_str (enum textmode textmode)
|
||||
{
|
||||
switch (textmode)
|
||||
{
|
||||
default: abort ();
|
||||
case centered: return "center";
|
||||
case left_justify: return "left_justify";
|
||||
case right_justify: return "right_justify";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_shape_str (enum shape shape)
|
||||
{
|
||||
switch (shape)
|
||||
{
|
||||
default: abort ();
|
||||
case box: return "box";
|
||||
case rhomb: return "rhomb";
|
||||
case ellipse: return "ellipse";
|
||||
case triangle: return "triangle";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_decision_str (enum decision decision)
|
||||
{
|
||||
switch (decision)
|
||||
{
|
||||
default: abort ();
|
||||
case no: return "no";
|
||||
case yes: return "yes";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_orientation_str (enum orientation orientation)
|
||||
{
|
||||
switch (orientation)
|
||||
{
|
||||
default: abort ();
|
||||
case top_to_bottom: return "top_to_bottom";
|
||||
case bottom_to_top: return "bottom_to_top";
|
||||
case left_to_right: return "left_to_right";
|
||||
case right_to_left: return "right_to_left";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_node_alignment_str (enum alignment alignment)
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
default: abort ();
|
||||
case center: return "center";
|
||||
case top: return "top";
|
||||
case bottom: return "bottom";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_arrow_mode_str (enum arrow_mode arrow_mode)
|
||||
{
|
||||
switch (arrow_mode)
|
||||
{
|
||||
default: abort ();
|
||||
case fixed: return "fixed";
|
||||
case free_a: return "free";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_crossing_type_str (enum crossing_type crossing_type)
|
||||
{
|
||||
switch (crossing_type)
|
||||
{
|
||||
default: abort ();
|
||||
case bary: return "bary";
|
||||
case median: return "median";
|
||||
case barymedian: return "barymedian";
|
||||
case medianbary: return "medianbary";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_view_str (enum view view)
|
||||
{
|
||||
/* There is no way with vcg 1.30 to specify a normal view explicitly,
|
||||
so it is an error here if view == normal_view. */
|
||||
switch (view)
|
||||
{
|
||||
default: abort ();
|
||||
case cfish: return "cfish";
|
||||
case pfish: return "pfish";
|
||||
case fcfish: return "fcfish";
|
||||
case fpfish: return "fpfish";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_linestyle_str (enum linestyle linestyle)
|
||||
{
|
||||
switch (linestyle)
|
||||
{
|
||||
default: abort ();
|
||||
case continuous: return "continuous";
|
||||
case dashed: return "dashed";
|
||||
case dotted: return "dotted";
|
||||
case invisible: return "invisible";
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_arrowstyle_str (enum arrowstyle arrowstyle)
|
||||
{
|
||||
switch (arrowstyle)
|
||||
{
|
||||
default: abort ();
|
||||
case solid: return "solid";
|
||||
case line: return "line";
|
||||
case none: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------.
|
||||
| Add functions. |
|
||||
| Edge and nodes into a graph. |
|
||||
`------------------------------*/
|
||||
|
||||
void
|
||||
add_node (graph *g, node *n)
|
||||
{
|
||||
n->next = g->node_list;
|
||||
g->node_list = n;
|
||||
}
|
||||
|
||||
void
|
||||
add_edge (graph *g, edge *e)
|
||||
{
|
||||
e->next = g->edge_list;
|
||||
g->edge_list = e;
|
||||
}
|
||||
|
||||
void
|
||||
add_classname (graph *g, int val, const char *name)
|
||||
{
|
||||
struct classname *classname = xmalloc (sizeof *classname);
|
||||
classname->no = val;
|
||||
classname->name = name;
|
||||
classname->next = g->classname;
|
||||
g->classname = classname;
|
||||
}
|
||||
|
||||
void
|
||||
add_infoname (graph *g, int integer, const char *str)
|
||||
{
|
||||
struct infoname *infoname = xmalloc (sizeof *infoname);
|
||||
infoname->integer = integer;
|
||||
infoname->chars = str;
|
||||
infoname->next = g->infoname;
|
||||
g->infoname = infoname;
|
||||
}
|
||||
|
||||
/* Build a colorentry struct and add it to the list. */
|
||||
void
|
||||
add_colorentry (graph *g, int color_idx, int red_cp,
|
||||
int green_cp, int blue_cp)
|
||||
{
|
||||
struct colorentry *ce = xmalloc (sizeof *ce);
|
||||
ce->color_index = color_idx;
|
||||
ce->red_cp = red_cp;
|
||||
ce->green_cp = green_cp;
|
||||
ce->blue_cp = blue_cp;
|
||||
ce->next = g->colorentry;
|
||||
g->colorentry = ce;
|
||||
}
|
||||
|
||||
/*-------------------------------------.
|
||||
| Open and close functions (formatted) |
|
||||
`-------------------------------------*/
|
||||
|
||||
void
|
||||
open_edge (edge *e, FILE *fout)
|
||||
{
|
||||
switch (e->type)
|
||||
{
|
||||
case normal_edge:
|
||||
fputs ("\tedge: {\n", fout);
|
||||
break;
|
||||
case back_edge:
|
||||
fputs ("\tbackedge: {\n", fout);
|
||||
break;
|
||||
case near_edge:
|
||||
fputs ("\tnearedge: {\n", fout);
|
||||
break;
|
||||
case bent_near_edge:
|
||||
fputs ("\tbentnearedge: {\n", fout);
|
||||
break;
|
||||
default:
|
||||
fputs ("\tedge: {\n", fout);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
close_edge (FILE *fout)
|
||||
{
|
||||
fputs ("\t}\n", fout);
|
||||
}
|
||||
|
||||
void
|
||||
open_node (FILE *fout)
|
||||
{
|
||||
fputs ("\tnode: {\n", fout);
|
||||
}
|
||||
|
||||
void
|
||||
close_node (FILE *fout)
|
||||
{
|
||||
fputs ("\t}\n", fout);
|
||||
}
|
||||
|
||||
void
|
||||
open_graph (FILE *fout)
|
||||
{
|
||||
fputs ("graph: {\n", fout);
|
||||
}
|
||||
|
||||
void
|
||||
close_graph (graph *g, FILE *fout)
|
||||
{
|
||||
fputc ('\n', fout);
|
||||
|
||||
/* FIXME: Unallocate nodes and edges if required. */
|
||||
{
|
||||
node *n;
|
||||
|
||||
for (n = g->node_list; n; n = n->next)
|
||||
{
|
||||
open_node (fout);
|
||||
output_node (n, fout);
|
||||
close_node (fout);
|
||||
}
|
||||
}
|
||||
|
||||
fputc ('\n', fout);
|
||||
|
||||
{
|
||||
edge *e;
|
||||
|
||||
for (e = g->edge_list; e; e = e->next)
|
||||
{
|
||||
open_edge (e, fout);
|
||||
output_edge (e, fout);
|
||||
close_edge (fout);
|
||||
}
|
||||
}
|
||||
|
||||
fputs ("}\n", fout);
|
||||
}
|
||||
|
||||
/*-------------------------------------------.
|
||||
| Output functions (formatted) in file FOUT |
|
||||
`-------------------------------------------*/
|
||||
|
||||
void
|
||||
output_node (node *n, FILE *fout)
|
||||
{
|
||||
if (n->title != N_TITLE)
|
||||
fprintf (fout, "\t\ttitle:\t%s\n", quote (n->title));
|
||||
if (n->label != N_LABEL)
|
||||
fprintf (fout, "\t\tlabel:\t%s\n", quote (n->label));
|
||||
|
||||
if ((n->locx != N_LOCX) && (n->locy != N_LOCY))
|
||||
fprintf (fout, "\t\tloc { x: %d y: %d }\t\n", n->locx, n->locy);
|
||||
|
||||
if (n->vertical_order != N_VERTICAL_ORDER)
|
||||
fprintf (fout, "\t\tvertical_order:\t%d\n", n->vertical_order);
|
||||
if (n->horizontal_order != N_HORIZONTAL_ORDER)
|
||||
fprintf (fout, "\t\thorizontal_order:\t%d\n", n->horizontal_order);
|
||||
|
||||
if (n->width != N_WIDTH)
|
||||
fprintf (fout, "\t\twidth:\t%d\n", n->width);
|
||||
if (n->height != N_HEIGHT)
|
||||
fprintf (fout, "\t\theight:\t%d\n", n->height);
|
||||
|
||||
if (n->shrink != N_SHRINK)
|
||||
fprintf (fout, "\t\tshrink:\t%d\n", n->shrink);
|
||||
if (n->stretch != N_STRETCH)
|
||||
fprintf (fout, "\t\tstretch:\t%d\n", n->stretch);
|
||||
|
||||
if (n->folding != N_FOLDING)
|
||||
fprintf (fout, "\t\tfolding:\t%d\n", n->folding);
|
||||
|
||||
if (n->textmode != N_TEXTMODE)
|
||||
fprintf (fout, "\t\ttextmode:\t%s\n",
|
||||
get_textmode_str (n->textmode));
|
||||
|
||||
if (n->shape != N_SHAPE)
|
||||
fprintf (fout, "\t\tshape:\t%s\n", get_shape_str (n->shape));
|
||||
|
||||
if (n->borderwidth != N_BORDERWIDTH)
|
||||
fprintf (fout, "\t\tborderwidth:\t%d\n", n->borderwidth);
|
||||
|
||||
if (n->color != N_COLOR)
|
||||
fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (n->color));
|
||||
if (n->textcolor != N_TEXTCOLOR)
|
||||
fprintf (fout, "\t\ttextcolor:\t%s\n",
|
||||
get_color_str (n->textcolor));
|
||||
if (n->bordercolor != N_BORDERCOLOR)
|
||||
fprintf (fout, "\t\tbordercolor:\t%s\n",
|
||||
get_color_str (n->bordercolor));
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 3; ++i)
|
||||
if (n->infos[i])
|
||||
fprintf (fout, "\t\tinfo%d:\t%s\n",
|
||||
i, quote (n->infos[i]));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
output_edge (edge *e, FILE *fout)
|
||||
{
|
||||
/* FIXME: SOURCENAME and TARGETNAME are mandatory
|
||||
so it has to be fatal not to give these informations. */
|
||||
if (e->sourcename != E_SOURCENAME)
|
||||
fprintf (fout, "\t\tsourcename:\t%s\n", quote (e->sourcename));
|
||||
if (e->targetname != E_TARGETNAME)
|
||||
fprintf (fout, "\t\ttargetname:\t%s\n", quote (e->targetname));
|
||||
|
||||
if (e->label != E_LABEL)
|
||||
fprintf (fout, "\t\tlabel:\t%s\n", quote (e->label));
|
||||
|
||||
if (e->linestyle != E_LINESTYLE)
|
||||
fprintf (fout, "\t\tlinestyle:\t%s\n", get_linestyle_str (e->linestyle));
|
||||
|
||||
if (e->thickness != E_THICKNESS)
|
||||
fprintf (fout, "\t\tthickness:\t%d\n", e->thickness);
|
||||
if (e->class != E_CLASS)
|
||||
fprintf (fout, "\t\tclass:\t%d\n", e->class);
|
||||
|
||||
if (e->color != E_COLOR)
|
||||
fprintf (fout, "\t\tcolor:\t%s\n", get_color_str (e->color));
|
||||
if (e->color != E_TEXTCOLOR)
|
||||
fprintf (fout, "\t\ttextcolor:\t%s\n",
|
||||
get_color_str (e->textcolor));
|
||||
if (e->arrowcolor != E_ARROWCOLOR)
|
||||
fprintf (fout, "\t\tarrowcolor:\t%s\n",
|
||||
get_color_str (e->arrowcolor));
|
||||
if (e->backarrowcolor != E_BACKARROWCOLOR)
|
||||
fprintf (fout, "\t\tbackarrowcolor:\t%s\n",
|
||||
get_color_str (e->backarrowcolor));
|
||||
|
||||
if (e->arrowsize != E_ARROWSIZE)
|
||||
fprintf (fout, "\t\tarrowsize:\t%d\n", e->arrowsize);
|
||||
if (e->backarrowsize != E_BACKARROWSIZE)
|
||||
fprintf (fout, "\t\tbackarrowsize:\t%d\n", e->backarrowsize);
|
||||
|
||||
if (e->arrowstyle != E_ARROWSTYLE)
|
||||
fprintf (fout, "\t\tarrowstyle:\t%s\n",
|
||||
get_arrowstyle_str (e->arrowstyle));
|
||||
if (e->backarrowstyle != E_BACKARROWSTYLE)
|
||||
fprintf (fout, "\t\tbackarrowstyle:\t%s\n",
|
||||
get_arrowstyle_str (e->backarrowstyle));
|
||||
|
||||
if (e->priority != E_PRIORITY)
|
||||
fprintf (fout, "\t\tpriority:\t%d\n", e->priority);
|
||||
if (e->anchor != E_ANCHOR)
|
||||
fprintf (fout, "\t\tanchor:\t%d\n", e->anchor);
|
||||
if (e->horizontal_order != E_HORIZONTAL_ORDER)
|
||||
fprintf (fout, "\t\thorizontal_order:\t%d\n", e->horizontal_order);
|
||||
}
|
||||
|
||||
void
|
||||
output_graph (graph *g, FILE *fout)
|
||||
{
|
||||
if (g->title)
|
||||
fprintf (fout, "\ttitle:\t%s\n", quote (g->title));
|
||||
if (g->label)
|
||||
fprintf (fout, "\tlabel:\t%s\n", quote (g->label));
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 3; ++i)
|
||||
if (g->infos[i])
|
||||
fprintf (fout, "\tinfo%d:\t%s\n", i, quote (g->infos[i]));
|
||||
}
|
||||
|
||||
if (g->color != G_COLOR)
|
||||
fprintf (fout, "\tcolor:\t%s\n", get_color_str (g->color));
|
||||
if (g->textcolor != G_TEXTCOLOR)
|
||||
fprintf (fout, "\ttextcolor:\t%s\n", get_color_str (g->textcolor));
|
||||
if (g->bordercolor != G_BORDERCOLOR)
|
||||
fprintf (fout, "\tbordercolor:\t%s\n",
|
||||
get_color_str (g->bordercolor));
|
||||
|
||||
if (g->width != G_WIDTH)
|
||||
fprintf (fout, "\twidth:\t%d\n", g->width);
|
||||
if (g->height != G_HEIGHT)
|
||||
fprintf (fout, "\theight:\t%d\n", g->height);
|
||||
if (g->borderwidth != G_BORDERWIDTH)
|
||||
fprintf (fout, "\tborderwidth:\t%d\n", g->borderwidth);
|
||||
|
||||
if (g->x != G_X)
|
||||
fprintf (fout, "\tx:\t%d\n", g->x);
|
||||
if (g->y != G_Y)
|
||||
fprintf (fout, "\ty:\t%d\n", g->y);
|
||||
|
||||
if (g->folding != G_FOLDING)
|
||||
fprintf (fout, "\tfolding:\t%d\n", g->folding);
|
||||
|
||||
if (g->shrink != G_SHRINK)
|
||||
fprintf (fout, "\tshrink:\t%d\n", g->shrink);
|
||||
if (g->stretch != G_STRETCH)
|
||||
fprintf (fout, "\tstretch:\t%d\n", g->stretch);
|
||||
|
||||
if (g->textmode != G_TEXTMODE)
|
||||
fprintf (fout, "\ttextmode:\t%s\n",
|
||||
get_textmode_str (g->textmode));
|
||||
|
||||
if (g->shape != G_SHAPE)
|
||||
fprintf (fout, "\tshape:\t%s\n", get_shape_str (g->shape));
|
||||
|
||||
if (g->vertical_order != G_VERTICAL_ORDER)
|
||||
fprintf (fout, "\tvertical_order:\t%d\n", g->vertical_order);
|
||||
if (g->horizontal_order != G_HORIZONTAL_ORDER)
|
||||
fprintf (fout, "\thorizontal_order:\t%d\n", g->horizontal_order);
|
||||
|
||||
if (g->xmax != G_XMAX)
|
||||
fprintf (fout, "\txmax:\t%d\n", g->xmax);
|
||||
if (g->ymax != G_YMAX)
|
||||
fprintf (fout, "\tymax:\t%d\n", g->ymax);
|
||||
|
||||
if (g->xbase != G_XBASE)
|
||||
fprintf (fout, "\txbase:\t%d\n", g->xbase);
|
||||
if (g->ybase != G_YBASE)
|
||||
fprintf (fout, "\tybase:\t%d\n", g->ybase);
|
||||
|
||||
if (g->xspace != G_XSPACE)
|
||||
fprintf (fout, "\txspace:\t%d\n", g->xspace);
|
||||
if (g->yspace != G_YSPACE)
|
||||
fprintf (fout, "\tyspace:\t%d\n", g->yspace);
|
||||
if (g->xlspace != G_XLSPACE)
|
||||
fprintf (fout, "\txlspace:\t%d\n", g->xlspace);
|
||||
|
||||
if (g->xraster != G_XRASTER)
|
||||
fprintf (fout, "\txraster:\t%d\n", g->xraster);
|
||||
if (g->yraster != G_YRASTER)
|
||||
fprintf (fout, "\tyraster:\t%d\n", g->yraster);
|
||||
if (g->xlraster != G_XLRASTER)
|
||||
fprintf (fout, "\txlraster:\t%d\n", g->xlraster);
|
||||
|
||||
if (g->hidden != G_HIDDEN)
|
||||
fprintf (fout, "\thidden:\t%d\n", g->hidden);
|
||||
|
||||
/* FIXME: Unallocate struct list if required.
|
||||
Maybe with a little function. */
|
||||
if (g->classname != G_CLASSNAME)
|
||||
{
|
||||
struct classname *ite;
|
||||
|
||||
for (ite = g->classname; ite; ite = ite->next)
|
||||
fprintf (fout, "\tclassname %d :\t%s\n", ite->no, ite->name);
|
||||
}
|
||||
|
||||
if (g->infoname != G_INFONAME)
|
||||
{
|
||||
struct infoname *ite;
|
||||
|
||||
for (ite = g->infoname; ite; ite = ite->next)
|
||||
fprintf (fout, "\tinfoname %d :\t%s\n", ite->integer, ite->chars);
|
||||
}
|
||||
|
||||
if (g->colorentry != G_COLORENTRY)
|
||||
{
|
||||
struct colorentry *ite;
|
||||
|
||||
for (ite = g->colorentry; ite; ite = ite->next)
|
||||
{
|
||||
fprintf (fout, "\tcolorentry %d :\t%d %d %d\n",
|
||||
ite->color_index,
|
||||
ite->red_cp,
|
||||
ite->green_cp,
|
||||
ite->blue_cp);
|
||||
}
|
||||
}
|
||||
|
||||
if (g->layout_downfactor != G_LAYOUT_DOWNFACTOR)
|
||||
fprintf (fout, "\tlayout_downfactor:\t%d\n", g->layout_downfactor);
|
||||
if (g->layout_upfactor != G_LAYOUT_UPFACTOR)
|
||||
fprintf (fout, "\tlayout_upfactor:\t%d\n", g->layout_upfactor);
|
||||
if (g->layout_nearfactor != G_LAYOUT_NEARFACTOR)
|
||||
fprintf (fout, "\tlayout_nearfactor:\t%d\n", g->layout_nearfactor);
|
||||
if (g->layout_splinefactor != G_LAYOUT_SPLINEFACTOR)
|
||||
fprintf (fout, "\tlayout_splinefactor:\t%d\n",
|
||||
g->layout_splinefactor);
|
||||
|
||||
if (g->late_edge_labels != G_LATE_EDGE_LABELS)
|
||||
fprintf (fout, "\tlate_edge_labels:\t%s\n",
|
||||
get_decision_str (g->late_edge_labels));
|
||||
if (g->display_edge_labels != G_DISPLAY_EDGE_LABELS)
|
||||
fprintf (fout, "\tdisplay_edge_labels:\t%s\n",
|
||||
get_decision_str (g->display_edge_labels));
|
||||
if (g->dirty_edge_labels != G_DIRTY_EDGE_LABELS)
|
||||
fprintf (fout, "\tdirty_edge_labels:\t%s\n",
|
||||
get_decision_str (g->dirty_edge_labels));
|
||||
if (g->finetuning != G_FINETUNING)
|
||||
fprintf (fout, "\tfinetuning:\t%s\n",
|
||||
get_decision_str (g->finetuning));
|
||||
if (g->ignore_singles != G_IGNORE_SINGLES)
|
||||
fprintf (fout, "\tignore_singles:\t%s\n",
|
||||
get_decision_str (g->ignore_singles));
|
||||
if (g->priority_phase != G_PRIORITY_PHASE)
|
||||
fprintf (fout, "\tpriority_phase:\t%s\n",
|
||||
get_decision_str (g->priority_phase));
|
||||
if (g->manhattan_edges != G_MANHATTAN_EDGES)
|
||||
fprintf (fout,
|
||||
"\tmanhattan_edges:\t%s\n",
|
||||
get_decision_str (g->manhattan_edges));
|
||||
if (g->smanhattan_edges != G_SMANHATTAN_EDGES)
|
||||
fprintf (fout,
|
||||
"\tsmanhattan_edges:\t%s\n",
|
||||
get_decision_str (g->smanhattan_edges));
|
||||
if (g->near_edges != G_NEAR_EDGES)
|
||||
fprintf (fout, "\tnear_edges:\t%s\n",
|
||||
get_decision_str (g->near_edges));
|
||||
|
||||
if (g->orientation != G_ORIENTATION)
|
||||
fprintf (fout, "\torientation:\t%s\n",
|
||||
get_orientation_str (g->orientation));
|
||||
|
||||
if (g->node_alignment != G_NODE_ALIGNMENT)
|
||||
fprintf (fout, "\tnode_alignment:\t%s\n",
|
||||
get_node_alignment_str (g->node_alignment));
|
||||
|
||||
if (g->port_sharing != G_PORT_SHARING)
|
||||
fprintf (fout, "\tport_sharing:\t%s\n",
|
||||
get_decision_str (g->port_sharing));
|
||||
|
||||
if (g->arrow_mode != G_ARROW_MODE)
|
||||
fprintf (fout, "\tarrow_mode:\t%s\n",
|
||||
get_arrow_mode_str (g->arrow_mode));
|
||||
|
||||
if (g->treefactor != G_TREEFACTOR)
|
||||
fprintf (fout, "\ttreefactor:\t%f\n", g->treefactor);
|
||||
if (g->spreadlevel != G_SPREADLEVEL)
|
||||
fprintf (fout, "\tspreadlevel:\t%d\n", g->spreadlevel);
|
||||
|
||||
if (g->crossing_weight != G_CROSSING_WEIGHT)
|
||||
fprintf (fout, "\tcrossing_weight:\t%s\n",
|
||||
get_crossing_type_str (g->crossing_weight));
|
||||
if (g->crossing_phase2 != G_CROSSING_PHASE2)
|
||||
fprintf (fout, "\tcrossing_phase2:\t%s\n",
|
||||
get_decision_str (g->crossing_phase2));
|
||||
if (g->crossing_optimization != G_CROSSING_OPTIMIZATION)
|
||||
fprintf (fout, "\tcrossing_optimization:\t%s\n",
|
||||
get_decision_str (g->crossing_optimization));
|
||||
|
||||
if (g->view != normal_view)
|
||||
fprintf (fout, "\tview:\t%s\n", get_view_str (g->view));
|
||||
|
||||
if (g->edges != G_EDGES)
|
||||
fprintf (fout, "\tedges:\t%s\n", get_decision_str (g->edges));
|
||||
|
||||
if (g->nodes != G_NODES)
|
||||
fprintf (fout,"\tnodes:\t%s\n", get_decision_str (g->nodes));
|
||||
|
||||
if (g->splines != G_SPLINES)
|
||||
fprintf (fout, "\tsplines:\t%s\n", get_decision_str (g->splines));
|
||||
|
||||
if (g->bmax != G_BMAX)
|
||||
fprintf (fout, "\tbmax:\t%d\n", g->bmax);
|
||||
if (g->cmin != G_CMIN)
|
||||
fprintf (fout, "\tcmin:\t%d\n", g->cmin);
|
||||
if (g->cmax != G_CMAX)
|
||||
fprintf (fout, "\tcmax:\t%d\n", g->cmax);
|
||||
if (g->pmin != G_PMIN)
|
||||
fprintf (fout, "\tpmin:\t%d\n", g->pmin);
|
||||
if (g->pmax != G_PMAX)
|
||||
fprintf (fout, "\tpmax:\t%d\n", g->pmax);
|
||||
if (g->rmin != G_RMIN)
|
||||
fprintf (fout, "\trmin:\t%d\n", g->rmin);
|
||||
if (g->rmax != G_RMAX)
|
||||
fprintf (fout, "\trmax:\t%d\n", g->rmax);
|
||||
if (g->smax != G_SMAX)
|
||||
fprintf (fout, "\tsmax:\t%d\n", g->smax);
|
||||
}
|
||||
963
src/vcg.h
963
src/vcg.h
@@ -1,963 +0,0 @@
|
||||
/* VCG description handler for Bison.
|
||||
|
||||
Copyright (C) 2001, 2002, 2005 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 VCG_H_
|
||||
# define VCG_H_
|
||||
|
||||
/* VCG color map. The 32 prime predefined colors. */
|
||||
enum color
|
||||
{
|
||||
white = 0,
|
||||
blue,
|
||||
red,
|
||||
green = 3,
|
||||
yellow,
|
||||
magenta,
|
||||
cyan = 6,
|
||||
darkgrey,
|
||||
darkblue,
|
||||
darkred = 9,
|
||||
darkgreen,
|
||||
darkyellow,
|
||||
darkmagenta = 12,
|
||||
darkcyan,
|
||||
gold,
|
||||
lightgrey = 15,
|
||||
lightblue,
|
||||
lightred,
|
||||
lightgreen = 18,
|
||||
lightyellow,
|
||||
lightmagenta,
|
||||
lightcyan = 21,
|
||||
lilac,
|
||||
turquoise,
|
||||
aquamarine = 24,
|
||||
khaki,
|
||||
purple,
|
||||
yellowgreen = 27,
|
||||
pink,
|
||||
orange,
|
||||
orchid,
|
||||
black = 31
|
||||
};
|
||||
|
||||
/* VCG textmode. Specify the adjustement of the text within the border of a summary node. */
|
||||
enum textmode
|
||||
{
|
||||
centered,
|
||||
left_justify,
|
||||
right_justify
|
||||
};
|
||||
|
||||
/* VCG shapes. Used for nodes shapes. */
|
||||
enum shape
|
||||
{
|
||||
box,
|
||||
rhomb,
|
||||
ellipse,
|
||||
triangle
|
||||
};
|
||||
|
||||
/* Structure for colorentries. */
|
||||
struct colorentry
|
||||
{
|
||||
int color_index;
|
||||
int red_cp;
|
||||
int green_cp;
|
||||
int blue_cp;
|
||||
struct colorentry *next;
|
||||
};
|
||||
|
||||
/* Structure to construct lists of classnames. */
|
||||
struct classname
|
||||
{
|
||||
int no; /* Class number */
|
||||
const char *name; /* Name associated to the class no. */
|
||||
struct classname *next; /* next name class association. */
|
||||
};
|
||||
|
||||
/* Structure is in infoname. */
|
||||
struct infoname
|
||||
{
|
||||
int integer;
|
||||
char const *chars;
|
||||
struct infoname *next;
|
||||
};
|
||||
|
||||
/* VCG decision yes/no. */
|
||||
enum decision
|
||||
{
|
||||
yes,
|
||||
no
|
||||
};
|
||||
|
||||
/* VCG graph orientation. */
|
||||
enum orientation
|
||||
{
|
||||
top_to_bottom,
|
||||
bottom_to_top,
|
||||
left_to_right,
|
||||
right_to_left
|
||||
};
|
||||
|
||||
/* VCG alignment for node alignement. */
|
||||
enum alignment
|
||||
{
|
||||
center,
|
||||
top,
|
||||
bottom
|
||||
};
|
||||
|
||||
/* VCG arrow mode. */
|
||||
enum arrow_mode
|
||||
{
|
||||
fixed,
|
||||
free_a
|
||||
};
|
||||
|
||||
/* VCG crossing weight type. */
|
||||
enum crossing_type
|
||||
{
|
||||
bary,
|
||||
median,
|
||||
barymedian,
|
||||
medianbary
|
||||
};
|
||||
|
||||
/* VCG views. */
|
||||
enum view
|
||||
{
|
||||
normal_view,
|
||||
cfish,
|
||||
pfish,
|
||||
fcfish,
|
||||
fpfish
|
||||
};
|
||||
|
||||
/*------------------------------------------------------.
|
||||
| Node attributs list. structure that describes a node. |
|
||||
`------------------------------------------------------*/
|
||||
|
||||
struct node
|
||||
{
|
||||
/* Title the unique string identifying the node. This attribute is
|
||||
mandatory. */
|
||||
const char *title;
|
||||
|
||||
/* Label the text displayed inside the node. If no label is specified
|
||||
then the title of the node will be used. Note that this text may
|
||||
contain control characters like NEWLINE that influences the size of
|
||||
the node. */
|
||||
const char *label;
|
||||
|
||||
/* loc is the location as x, y position relatively to the system of
|
||||
coordinates of the graph. Locations are specified in the form
|
||||
loc: - x: xpos y: ypos "". The locations of nodes are only valid,
|
||||
if the whole graph is fully specified with locations and no part is
|
||||
folded. The layout algorithm of the tool calculates appropriate x, y
|
||||
positions, if at least one node that must be drawn (i.e., is not
|
||||
hidden by folding or edge classes) does not have fixed specified
|
||||
locations.
|
||||
Default is none. */
|
||||
int locx;
|
||||
int locy;
|
||||
|
||||
/* vertical order is the level position (rank) of the node. We can also
|
||||
specify level: int. Level specifications are only valid, if the
|
||||
layout is calculated, i.e. if at least one node does not have a
|
||||
fixed location specification. The layout algorithm partitioned all
|
||||
nodes into levels 0...maxlevel. Nodes at the level 0 are on the
|
||||
upper corner. The algorithm is able to calculate appropriate levels
|
||||
for the nodes automatically, if no fixed levels are given.
|
||||
Specifications of levels are additional constraints, that may be
|
||||
ignored, if they are in conflict with near edge specifications.
|
||||
Default values are unspecified. */
|
||||
int vertical_order;
|
||||
|
||||
/* horizontal order is the horizontal position of the 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.
|
||||
Default is unspecified. */
|
||||
int horizontal_order;
|
||||
|
||||
/* width, height is the width and height of a node including the border.
|
||||
If no value (in pixels) is given then width and height are
|
||||
calculated from the size of the label.
|
||||
Default are width and height of the label. */
|
||||
int width;
|
||||
int height;
|
||||
|
||||
/* shrink, stretch gives the shrinking and stretching factor of the
|
||||
node. The values of the attributes width, height, borderwidth and
|
||||
the size of the label text is scaled by ((stretch=shrink) \Lambda
|
||||
100) percent. Note that the actual scale value is determined by the
|
||||
scale value of a node relatively to a scale value of the graph,
|
||||
i.e. if (stretch,shrink) = (2,1) for the graph and (stretch,shrink)
|
||||
= (2,1) for the node of the graph, then the node is scaled by the
|
||||
factor 4 compared to the normal size. The scale value can also be
|
||||
specified by scaling: float.
|
||||
Default are 1,1. */
|
||||
int shrink;
|
||||
int stretch;
|
||||
|
||||
/* folding specifies the default folding of the nodes. The folding k
|
||||
(with k ? 0) means that the graph part that is reachable via edges
|
||||
of a class less or equal to k is folded and displayed as one node.
|
||||
There are commands to unfold such summary nodes, see section 5. If
|
||||
no folding is specified for a node, then the node may be folded if
|
||||
it is in the region of another node that starts the folding. If
|
||||
folding 0 is specified, then the node is never folded. In this case
|
||||
the folding stops at the predecessors of this node, if it is
|
||||
reachable from another folding node. The summary node inherits some
|
||||
attributes from the original node which starts the folding (all
|
||||
color attributes, textmode and label, but not the location). A
|
||||
folded region may contain folded regions with smaller folding class
|
||||
values (nested foldings). If there is more than one node that start
|
||||
the folding of the same region (this implies that the folding class
|
||||
values are equal) then the attributes are inherited by one of these
|
||||
nodes nondeterministically. If foldnode attributes are specified,
|
||||
then the summary node attributes are inherited from these attributes.
|
||||
Default is none. */
|
||||
int folding;
|
||||
|
||||
/* shape specifies the visual appearance of a node: box, rhomb, ellipse,
|
||||
and triangle. The drawing of ellipses is much slower than the drawing
|
||||
of the other shapes.
|
||||
Default is box. */
|
||||
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 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
|
||||
node is white. For the possibilities, see the attribute color for
|
||||
graphs.
|
||||
Default is 2. */
|
||||
int borderwidth;
|
||||
|
||||
/* node color.
|
||||
Default is white or transparent, */
|
||||
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 textcolor;
|
||||
|
||||
/* info2, info3 can be selected from the menu. The corresponding text
|
||||
labels can be shown by mouse clicks on nodes.
|
||||
Default are null strings. */
|
||||
const char *infos[3];
|
||||
|
||||
/* Node border color.
|
||||
Default is textcolor. */
|
||||
enum color bordercolor;
|
||||
|
||||
/* Next node node... */
|
||||
struct node *next;
|
||||
};
|
||||
|
||||
/* typedef alias. */
|
||||
typedef struct node node;
|
||||
|
||||
/*-------------------------------------------------------.
|
||||
| Edge attributs list. Structure that describes an edge. |
|
||||
`-------------------------------------------------------*/
|
||||
|
||||
/* VCG Edge type. */
|
||||
enum edge_type
|
||||
{
|
||||
normal_edge,
|
||||
back_edge,
|
||||
near_edge,
|
||||
bent_near_edge
|
||||
};
|
||||
|
||||
/* Structs enum definitions for edges. */
|
||||
enum linestyle
|
||||
{
|
||||
continuous,
|
||||
dashed,
|
||||
dotted,
|
||||
invisible
|
||||
};
|
||||
|
||||
enum arrowstyle
|
||||
{
|
||||
solid,
|
||||
line,
|
||||
none
|
||||
};
|
||||
|
||||
/* The struct edge itself. */
|
||||
struct edge
|
||||
{
|
||||
|
||||
/* Edge type.
|
||||
Default is normal edge. */
|
||||
enum edge_type type;
|
||||
|
||||
/* Sourcename is the title of the source node of the edge.
|
||||
Default: none. */
|
||||
const char *sourcename; /* Mandatory. */
|
||||
|
||||
/* Targetname is the title of the target node of the edge.
|
||||
Default: none. */
|
||||
const char *targetname; /* Mandatory. */
|
||||
|
||||
/* Label specifies the label of the edge. It is drawn if
|
||||
display.edge.labels is set to yes.
|
||||
Default: no label. */
|
||||
const char *label;
|
||||
|
||||
/* Linestyle specifies the style the edge is drawn. Possibilities are:
|
||||
ffl continuous a solid line is drawn ( -- ) ffl dashed the edge
|
||||
consists of single dashes ( - - - ) ffl dotted the edge is made of
|
||||
single dots ( \Delta \Delta \Delta ) ffl invisible the edge is not
|
||||
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 linestyle;
|
||||
|
||||
/* Thickness is the thickness of an edge.
|
||||
Default is 2. */
|
||||
int thickness;
|
||||
|
||||
/* Class specifies the folding class of the edge. Nodes reachable by
|
||||
edges of a class less or equal to a constant k specify folding
|
||||
regions of k. See the node attribute folding and the folding commands.
|
||||
Default is 1. */
|
||||
int class;
|
||||
|
||||
/* color is the color of the edge.
|
||||
Default is black. */
|
||||
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
|
||||
head. priority The positions of the nodes are mainly determined by
|
||||
the incoming and outgoing edges. One can think of rubberbands instead
|
||||
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 textcolor;
|
||||
|
||||
/* Arrow color.
|
||||
Default is color. */
|
||||
enum color arrowcolor;
|
||||
|
||||
/* BackArrow color.
|
||||
Default is color. */
|
||||
enum color backarrowcolor;
|
||||
|
||||
/* arrowsize, backarrowsize The arrow head is a right-angled, isosceles
|
||||
triangle and the cathetuses have length arrowsize.
|
||||
Default is 10. */
|
||||
int arrowsize;
|
||||
|
||||
/* Backarrow size
|
||||
Default is 0. */
|
||||
int backarrowsize;
|
||||
|
||||
/* arrowstyle, backarrowstyle Each edge has two arrow heads: the one
|
||||
appears at the target node (the normal arrow head), the other appears
|
||||
at the source node (the backarrow head). Normal edges only have the
|
||||
normal solid arrow head, while the backarrow head is not drawn, i.e.
|
||||
it is none. Arrowstyle is the style of the normal arrow head, and
|
||||
backarrowstyle is the style of the backarrow head. Styles are none,
|
||||
i.e. no arrow head, solid, and line.
|
||||
Default is solid. */
|
||||
enum arrowstyle arrowstyle;
|
||||
|
||||
/* Default is none. */
|
||||
enum arrowstyle backarrowstyle;
|
||||
|
||||
/* Default is 1. */
|
||||
int priority;
|
||||
|
||||
/* Anchor. An anchor point describes the vertical position in a node
|
||||
where an edge goes out. This is useful, if node labels are several
|
||||
lines long, and outgoing edges are related to label lines. (E.g.,
|
||||
this allows a nice visualization of structs containing pointers as
|
||||
fields.).
|
||||
Default is none. */
|
||||
int anchor;
|
||||
|
||||
/* Horizontal order is the horizontal position the edge. This is of
|
||||
interest only if the edge crosses several levels because it specifies
|
||||
the point where the edge crosses the level. within a level. The nodes
|
||||
which are specified with horizontal positions are ordered according
|
||||
to these positions within a level. The horizontal position of a long
|
||||
edge that crosses the level specifies between which two node of that
|
||||
level the edge has to be drawn. Other edges 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.
|
||||
Default is unspcified. */
|
||||
int horizontal_order;
|
||||
|
||||
/*
|
||||
** Next edge node...
|
||||
*/
|
||||
struct edge *next;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
** typedef alias.
|
||||
*/
|
||||
typedef struct edge edge;
|
||||
|
||||
/*--------------------------------------------------------.
|
||||
| Graph attributs list. Structure that describes a graph. |
|
||||
`--------------------------------------------------------*/
|
||||
|
||||
struct graph
|
||||
{
|
||||
/* Graph title or name.
|
||||
Title specifies the name (a string) associated with the graph. The
|
||||
default name of a subgraph is the name of the outer graph, and the
|
||||
name of the outmost graph is the name of the specification input
|
||||
file. The name of a graph is used to identify this graph, e.g., if
|
||||
we want to express that an edge points to a subgraph. Such edges
|
||||
point to the root of the graph, i.e. the first node of the graph or
|
||||
the root of the first subgraph in the graph, if the subgraph is
|
||||
visualized explicitly.
|
||||
By default, it's the name of the vcg graph file description. */
|
||||
const char *title;
|
||||
|
||||
/* Graph label.
|
||||
Label the text displayed inside the node, when the graph is folded
|
||||
to a node. If no label is specified then the title of the graph will
|
||||
be used. Note that this text may contain control characters like
|
||||
NEWLINE that influences the size of the node.
|
||||
By default, it takes the title value */
|
||||
const char *label;
|
||||
|
||||
/* Any informations.
|
||||
Info1, info2, info3 combines additional text labels with a node or a
|
||||
folded graph. info1, info2, info3 can be selected from the menu
|
||||
interactively. The corresponding text labels can be shown by mouse
|
||||
clicks on nodes.
|
||||
Default values are empty strings (here NULL pointers) */
|
||||
const char *infos[3];
|
||||
|
||||
/* Background color and summary node colors
|
||||
Color specifies the background color for the outermost graph, or the
|
||||
color of the summary node for subgraphs. Colors are given in the enum
|
||||
declared above. If more than these default colors are needed, a
|
||||
color map with maximal 256 entries can be used. The first 32 entries
|
||||
correspond to the colors just listed. A color of the color map can
|
||||
selected by the color map index, an integer, for instance red has
|
||||
index 2, green has index 3, etc.
|
||||
Default is white for background and white or transparent for summary
|
||||
nodes. */
|
||||
enum color color;
|
||||
|
||||
/* 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 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.
|
||||
Default value is 100. */
|
||||
int width;
|
||||
int height;
|
||||
|
||||
/* Specify the thickness if summary node's border in pixels.
|
||||
default value is 2. */
|
||||
int borderwidth;
|
||||
|
||||
/* x, y are the x-position and y-position of the graph's window in
|
||||
pixels, relatively to the root screen, if it is the outermost graph.
|
||||
The origin of the window is upper, left hand. For inner subgraphs,
|
||||
it is the position of the folded summary node. The position can also
|
||||
be specified in the form loc: fx:int y:intg.
|
||||
The default value is 0. */
|
||||
int x;
|
||||
int y;
|
||||
|
||||
/* 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.
|
||||
Default value is 0 */
|
||||
int folding;
|
||||
|
||||
/* Shrink, stretch gives the shrinking and stretching factor for the
|
||||
graph's representation (default is 1, 1). ((stretch=shrink) \Lambda
|
||||
100) is the scaling of the graph in percentage, e.g.,
|
||||
(stretch,shrink) = (1,1) or (2,2) or (3,3) : : : is normal size,
|
||||
(stretch,shrink) = (1,2) is half size, (stretch,shrink) = (2,1) is
|
||||
double size. For subgraphs, it is also the scaling factor of the
|
||||
summary node. The scaling factor can also be specified by scaling:
|
||||
float (here, scaling 1.0 means normal size). */
|
||||
int shrink;
|
||||
int stretch;
|
||||
|
||||
/* textmode specifies the adjustment of the text within the border of a
|
||||
summary node. The possibilities are center, left.justify and
|
||||
right.justify.
|
||||
Default value is center.*/
|
||||
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,
|
||||
rhomb, ellipse, and triangle. 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. 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.
|
||||
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
|
||||
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
|
||||
the child nodes at a node, but not the order of the whole level. */
|
||||
int horizontal_order;
|
||||
|
||||
/* xmax, ymax specify the maximal size of the virtual window that is
|
||||
used to display the graph. This is usually larger than the displayed
|
||||
part, thus the width and height of the displayed part cannot be
|
||||
greater than xmax and ymax. Only those parts of the graph are drawn
|
||||
that are inside the virtual window. The virtual window can be moved
|
||||
over the potential infinite system of coordinates by special
|
||||
positioning commands.
|
||||
Defaults are 90 and 90. */
|
||||
int xmax;
|
||||
int ymax;
|
||||
|
||||
/* xy-base: specify the upper left corner coordinates of the graph
|
||||
relatively to the root window.
|
||||
Defaults are 5, 5. */
|
||||
int xbase;
|
||||
int ybase;
|
||||
|
||||
/* xspace, yspace the minimum horizontal and vertical distance between
|
||||
nodes. xlspace is the horizontal distance between lines at the
|
||||
points where they cross the levels. (At these points, dummy nodes
|
||||
are used. In fact, this is the horizontal distance between dummy
|
||||
nodes.) It is recommended to set xlspace to a larger value, if
|
||||
splines are used to draw edges, to prevent sharp bendings.
|
||||
Default are 20 and 70. */
|
||||
int xspace;
|
||||
int yspace;
|
||||
|
||||
/* The horizontal space between lines at the point where they cross
|
||||
the levels.
|
||||
defaults value is 1/2 xspace (polygone) and 4/5 xspace (splines)*/
|
||||
int xlspace;
|
||||
|
||||
/* xraster, yraster specifies the raster distance for the position of
|
||||
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.
|
||||
defaults are 1,1. */
|
||||
int xraster;
|
||||
int yraster;
|
||||
|
||||
/* xlraster is the horizontal raster for the positions of the line
|
||||
control points (the dummy nodes). It should be a divisor of xraster.
|
||||
defaults is 1. */
|
||||
int xlraster;
|
||||
|
||||
/* hidden specifies the classes of edges that are hidden.
|
||||
Edges that are within such a class are not laid out nor drawn.
|
||||
Nodes that are only reachable (forward or backward) by edges of an
|
||||
hidden class are not drawn. However, nodes that are not reachable
|
||||
at all are drawn. (But see attribute ignore.singles.) Specification
|
||||
of classes of hidden edges allows to hide parts of a graph, e.g.,
|
||||
annotations of a syntax tree. This attribute is only allowed at the
|
||||
outermost level. More than one settings are possible to specify
|
||||
exactly the set of classes that are hidden. Note the important
|
||||
difference between hiding of edges and the edge line style invisible.
|
||||
Hidden edges are not existent in the layout. Edges with line style
|
||||
invisible are existent in the layout; they need space and may
|
||||
produce crossings and influence the layout, but you cannot see
|
||||
them.
|
||||
No default value. */
|
||||
int hidden;
|
||||
|
||||
/* Classname allows to introduce names for the edge classes. The names
|
||||
are used in the menus. infoname allows to introduce names for the
|
||||
additional text labels. The names are used in the menus.
|
||||
defaults are 1,2,3...
|
||||
By default, no class names. */
|
||||
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.
|
||||
The default value is NULL. */
|
||||
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 *colorentry;
|
||||
|
||||
/* Layout downfactor, layout upfactor, layout nearfactor The layout
|
||||
algorithm partitions the set of edges into edges pointing upward,
|
||||
edges pointing downward, and edges pointing sidewards. The last type
|
||||
of edges is also called near edges. If the layout.downfactor is
|
||||
large compared to the layout.upfactor and the layout.nearfactor,
|
||||
then the positions of the nodes is mainly determined by the edges
|
||||
pointing downwards. If the layout.upfactor is large compared to the
|
||||
layout.downfactor and the layout.nearfactor, then the positions of
|
||||
the nodes is mainly determined by the edges pointing upwards. If the
|
||||
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.
|
||||
Default is normal. */
|
||||
int layout_downfactor;
|
||||
int layout_upfactor;
|
||||
int layout_nearfactor;
|
||||
/* Layout splinefactor determines the bending at splines. The factor
|
||||
100 indicates a very sharp bending, a factor 1 indicates a very flat
|
||||
bending. Useful values are 30 : : : 80. */
|
||||
int layout_splinefactor;
|
||||
|
||||
/* Late edge labels yes means that the graph is first partitioned and
|
||||
then, labels are introduced. The default algorithm first creates
|
||||
labels and then partitions the graph, which yield a more compact
|
||||
layout, but may have more crossings.
|
||||
Default is no. */
|
||||
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 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 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 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 ignore_singles;
|
||||
|
||||
/* priority phase yes replaces the normal pendulum method by a
|
||||
specialized method: It forces straight long edges with 90 degree,
|
||||
just as the straight phase. In fact, the straight phase is a fine
|
||||
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 priority_phase;
|
||||
|
||||
/* manhattan edges yes switches the orthogonal layout on. Orthogonal
|
||||
layout (or manhattan layout) means that all edges consist of line
|
||||
segments with gradient 0 or 90 degree. Vertical edge segments might
|
||||
by shared by several edges, while horizontal edge segments are never
|
||||
shared. This results in very aesthetical layouts just for flowcharts.
|
||||
If the orthogonal layout is used, then the priority phase and
|
||||
straight phase should be used. Thus, these both phases are switched
|
||||
on, too, unless priority layout and straight line tuning are
|
||||
switched off explicitly.
|
||||
Default is no. */
|
||||
enum decision manhattan_edges;
|
||||
|
||||
/* Smanhattan edges yes switches a specialized orthogonal layout on:
|
||||
Here, all horizontal edge segments between two levels share the same
|
||||
horizontal line, i.e. not only vertical edge segments are shared,
|
||||
but horizontal edge segments are shared by several edges, too. This
|
||||
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 smanhattan_edges;
|
||||
|
||||
/* Near edges no suppresses near edges and bent near edges in the
|
||||
graph layout.
|
||||
Default is yes. */
|
||||
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
|
||||
orientation is top.to.bottom. All explanations here are given
|
||||
relatively to the normal orientation, i.e., e.g., if the orientation
|
||||
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 orientation;
|
||||
|
||||
/* Node alignment specified the vertical alignment of nodes at the
|
||||
horizontal reference line of the levels. If top is specified, the
|
||||
tops of all nodes of a level have the same y-coordinate; on bottom,
|
||||
the bottoms have the same y-coordinate, on center the nodes are
|
||||
centered at the levels.
|
||||
Default is center. */
|
||||
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,
|
||||
and the arrow head of all these edges has the same visual appearance
|
||||
(color, size, etc.), then these edges may share a port at a node,
|
||||
i.e. only one arrow head is draw, and all edges are incoming into
|
||||
this arrow head. This allows to have many edges adjacent to one node
|
||||
without getting confused by too many arrow heads. If no port sharing
|
||||
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 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
|
||||
used. If the arrow mode is free, then each arrow head is rotated
|
||||
individually to each edge. But this can yield to a black spot, where
|
||||
nothing is recognizable, if port sharing is used, since all these
|
||||
qdifferently rotated arrow heads are drawn at the same place. If the
|
||||
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 arrow_mode;
|
||||
|
||||
/* Treefactor The algorithm tree for downward laid out trees tries to
|
||||
produce a medium dense, balanced tree-like layout. If the tree
|
||||
factor is greater than 0.5, the tree edges are spread, i.e. they
|
||||
get a larger gradient. This may improve the readability of the tree.
|
||||
Note: it is not obvious whether spreading results in a more dense or
|
||||
wide layout. For a tree, there is a tree factor such that the whole
|
||||
tree is minimal wide.
|
||||
Default is 0.5. */
|
||||
float treefactor;
|
||||
|
||||
/* Spreadlevel This parameter only influences the algorithm tree, too.
|
||||
For large, balanced trees, spreading of the uppermost nodes would
|
||||
enlarge the width of the tree too much, such that the tree does not
|
||||
fit anymore in a window. Thus, the spreadlevel specifies the minimal
|
||||
level (rank) where nodes are spread. Nodes of levels upper than
|
||||
spreadlevel are not spread.
|
||||
Default is 1. */
|
||||
int spreadlevel;
|
||||
|
||||
/* Crossing weight specifies the weight that is used for the crossing
|
||||
reduction: bary (default), median, barymedian or medianbary. We
|
||||
cannot give a general recommendation, which is the best method. For
|
||||
graphs with very large average degree of edges (number of incoming
|
||||
and outgoing edges at a node), the weight bary is the fastest
|
||||
method. With the weights barymedian and medianbary, equal weights of
|
||||
different nodes are not very probable, thus the crossing reduction
|
||||
phase 2 might be very fast.
|
||||
Default is bary. */
|
||||
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 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 crossing_optimization;
|
||||
|
||||
/* View allows to select the fisheye views. Because
|
||||
of the fixed size of the window that shows the graph, we normally
|
||||
can only see a small amount of a large graph. If we shrink the graph
|
||||
such that it fits into the window, we cannot recognize any detail
|
||||
anymore. Fisheye views are coordinate transformations: the view onto
|
||||
the graph is distort, to overcome this usage deficiency. The polar
|
||||
fisheye is easy to explain: assume a projection of the plane that
|
||||
contains the graph picture onto a spheric ball. If we now look onto
|
||||
this ball in 3 D, we have a polar fisheye view. There is a focus
|
||||
point which is magnified such that we see all details. Parts of the
|
||||
plane that are far away from the focus point are demagnified very
|
||||
much. Cartesian fisheye have a similar effect; only the formula for
|
||||
the coordinate transformation is different. Selecting cfish means
|
||||
the cartesian fisheye is used which demagnifies such that the whole
|
||||
graph is visible (self adaptable cartesian fisheye). With fcfish,
|
||||
the cartesian fisheye shows the region of a fixed radius around the
|
||||
focus point (fixed radius cartesian fisheye). This region might be
|
||||
smaller than the whole graph, but the demagnification needed to show
|
||||
this region in the window is also not so large, thus more details
|
||||
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.
|
||||
Default is normal view. */
|
||||
enum view view;
|
||||
|
||||
/* Edges no suppresses the drawing of edges.
|
||||
Default is yes. */
|
||||
enum decision edges;
|
||||
|
||||
/* Nodes no suppresses the drawing of nodes.
|
||||
Default is yes. */
|
||||
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
|
||||
much faster. Note that the spline drawing routine is not fully
|
||||
validated, and is very slow. Its use is mainly to prepare high
|
||||
quality PostScript output for very small graphs.
|
||||
Default is no. */
|
||||
enum decision splines;
|
||||
|
||||
/* Bmax set the maximal number of iterations that are done for the
|
||||
reduction of edge bendings.
|
||||
Default is 100. */
|
||||
int bmax;
|
||||
|
||||
/* Cmin set the minimal number of iterations that are done for the
|
||||
crossing reduction with the crossing weights. The normal method
|
||||
stops if two consecutive checks does not reduce the number of
|
||||
crossings anymore. However, this increasing of the number of
|
||||
crossings might be locally, such that after some more iterations,
|
||||
the crossing number might decrease much more.
|
||||
Default is 0. */
|
||||
int cmin;
|
||||
|
||||
/* Cmax set the maximal number of interactions for crossing reduction.
|
||||
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
|
||||
pendulum method. Similar to the crossing reduction, this method
|
||||
stops if the `imbalancement weight' does not decreases anymore.
|
||||
However, the increasing of the imbalancement weight might be locally,
|
||||
such that after some more iterations, the imbalancement weight might
|
||||
decrease much more.
|
||||
Default is 0. */
|
||||
int pmin;
|
||||
|
||||
/* Pmax set the maximal number of iterations of the pendulum method.
|
||||
This is helpful for speedup the layout process.
|
||||
Default is 100. */
|
||||
int pmax;
|
||||
|
||||
/* Rmin set the minimal number of iterations that is done with the
|
||||
rubberband method. This is similar as for the pendulum method.
|
||||
Default is 0. */
|
||||
int rmin;
|
||||
|
||||
/* Rmax set the maximal number of iterations of the rubberband method.
|
||||
This is helpful for speedup the layout process.
|
||||
Default is 100. */
|
||||
int rmax;
|
||||
|
||||
/* Smax set the maximal number of iterations of the straight line
|
||||
recognition phase (useful only, if the straight line recognition
|
||||
phase is switched on, see attribute straight.phase).
|
||||
Default is 100. */
|
||||
int smax;
|
||||
|
||||
/* Generic values.
|
||||
*/
|
||||
node node;
|
||||
edge edge;
|
||||
|
||||
/* List of nodes declared.
|
||||
Pointer. */
|
||||
node *node_list;
|
||||
|
||||
/* List of edges declared.
|
||||
Pointer. */
|
||||
edge *edge_list;
|
||||
|
||||
};
|
||||
|
||||
/* Graph typedefs. */
|
||||
typedef struct graph graph;
|
||||
|
||||
void new_graph (graph *g);
|
||||
void new_node (node *n);
|
||||
void new_edge (edge *e);
|
||||
|
||||
void add_node (graph *g, node *n);
|
||||
void add_edge (graph *g, edge *e);
|
||||
|
||||
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 (FILE *fout);
|
||||
void output_node (node *n, FILE *fout);
|
||||
void close_node (FILE *fout);
|
||||
|
||||
void open_edge (edge *e, FILE *fout);
|
||||
void output_edge (edge *e, FILE *fout);
|
||||
void close_edge (FILE *fout);
|
||||
|
||||
void open_graph (FILE *fout);
|
||||
void output_graph (graph *g, FILE *fout);
|
||||
void close_graph (graph *g, FILE *fout);
|
||||
|
||||
#endif /* VCG_H_ */
|
||||
@@ -1,181 +0,0 @@
|
||||
/* VCG description handler for Bison.
|
||||
|
||||
Copyright (C) 2001, 2002, 2005 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 VCG_DEFAULTS_H_
|
||||
# define VCG_DEFAULTS_H_
|
||||
|
||||
/* Graph defaults. */
|
||||
# define G_TITLE NULL
|
||||
# define G_LABEL NULL
|
||||
# define G_INFOS1 NULL
|
||||
# define G_INFOS2 NULL
|
||||
# define G_INFOS3 NULL
|
||||
|
||||
# define G_COLOR white
|
||||
# define G_TEXTCOLOR black
|
||||
# define G_BORDERCOLOR G_TEXTCOLOR
|
||||
|
||||
# define G_WIDTH 100
|
||||
# define G_HEIGHT 100
|
||||
# define G_BORDERWIDTH 2
|
||||
|
||||
# define G_X 0
|
||||
# define G_Y 0
|
||||
|
||||
# define G_FOLDING 0
|
||||
|
||||
# define G_SHRINK 1
|
||||
# define G_STRETCH 1
|
||||
|
||||
# define G_TEXTMODE centered
|
||||
# define G_SHAPE box
|
||||
|
||||
# define G_VERTICAL_ORDER 0 /* Unspecified for subgraphs. */
|
||||
# define G_HORIZONTAL_ORDER 0 /* Unspecified for subgraphs. */
|
||||
|
||||
# define G_XMAX 90 /* Not output. */
|
||||
# define G_YMAX 90 /* Not output. */
|
||||
|
||||
# define G_XBASE 5
|
||||
# define G_YBASE 5
|
||||
|
||||
# define G_XSPACE 20
|
||||
# define G_YSPACE 70
|
||||
# define G_XLSPACE (G_XSPACE / 2) /* Not output */
|
||||
|
||||
# define G_XRASTER 1
|
||||
# define G_YRASTER 1
|
||||
# define G_XLRASTER 1
|
||||
|
||||
# define G_HIDDEN (-1) /* No default value. */
|
||||
|
||||
# define G_CLASSNAME NULL /* No class name association. */
|
||||
# define G_INFONAME NULL
|
||||
# define G_COLORENTRY NULL
|
||||
|
||||
# define G_LAYOUTALGORITHM normal
|
||||
# define G_LAYOUT_DOWNFACTOR 1
|
||||
# define G_LAYOUT_UPFACTOR 1
|
||||
# define G_LAYOUT_NEARFACTOR 1
|
||||
# define G_LAYOUT_SPLINEFACTOR 70
|
||||
|
||||
# define G_LATE_EDGE_LABELS no
|
||||
# define G_DISPLAY_EDGE_LABELS no
|
||||
# define G_DIRTY_EDGE_LABELS no
|
||||
# define G_FINETUNING yes
|
||||
# define G_IGNORE_SINGLES no
|
||||
# define G_LONG_STRAIGHT_PHASE no
|
||||
# define G_PRIORITY_PHASE no
|
||||
# define G_MANHATTAN_EDGES no
|
||||
# define G_SMANHATTAN_EDGES no
|
||||
# define G_NEAR_EDGES yes
|
||||
|
||||
# define G_ORIENTATION top_to_bottom
|
||||
# define G_NODE_ALIGNMENT center
|
||||
# define G_PORT_SHARING yes
|
||||
# define G_ARROW_MODE fixed
|
||||
# define G_TREEFACTOR 0.5
|
||||
# define G_SPREADLEVEL 1
|
||||
# define G_CROSSING_WEIGHT bary
|
||||
# define G_CROSSING_PHASE2 yes
|
||||
# define G_CROSSING_OPTIMIZATION yes
|
||||
# define G_VIEW normal_view
|
||||
|
||||
# define G_EDGES yes
|
||||
# define G_NODES yes
|
||||
# define G_SPLINES no
|
||||
|
||||
# define G_BMAX 100
|
||||
# define G_CMIN 0
|
||||
# define G_CMAX (-1) /* Infinity */
|
||||
# define G_PMIN 0
|
||||
# define G_PMAX 100
|
||||
# define G_RMIN 0
|
||||
# define G_RMAX 100
|
||||
# define G_SMAX 100
|
||||
|
||||
# define G_NODE_LIST NULL
|
||||
# define G_EDGE_LIST NULL
|
||||
|
||||
/* Nodes defaults. */
|
||||
# define N_TITLE NULL
|
||||
# define N_LABEL NULL
|
||||
|
||||
# define N_LOCX (-1) /* Default unspcified */
|
||||
# define N_LOCY (-1) /* Default unspcified */
|
||||
|
||||
# define N_VERTICAL_ORDER (-1) /* Default unspcified */
|
||||
# define N_HORIZONTAL_ORDER (-1) /* Default unspcified */
|
||||
|
||||
# define N_WIDTH (-1) /* We assume that we can't define it now. */
|
||||
# define N_HEIGHT (-1) /* also. */
|
||||
|
||||
# define N_SHRINK 1
|
||||
# define N_STRETCH 1
|
||||
|
||||
# define N_FOLDING (-1) /* no explicit default value. */
|
||||
|
||||
# define N_SHAPE box
|
||||
# define N_TEXTMODE centered
|
||||
# define N_BORDERWIDTH 2
|
||||
|
||||
# define N_COLOR white
|
||||
# define N_TEXTCOLOR black
|
||||
# define N_BORDERCOLOR N_TEXTCOLOR
|
||||
|
||||
# define N_INFOS1 NULL
|
||||
# define N_INFOS2 NULL
|
||||
# define N_INFOS3 NULL
|
||||
|
||||
# define N_NEXT NULL
|
||||
|
||||
/* Edge defaults. */
|
||||
# define E_EDGE_TYPE normal_edge
|
||||
|
||||
# define E_SOURCENAME NULL /* Mandatory. */
|
||||
# define E_TARGETNAME NULL /* Mandatory. */
|
||||
# define E_LABEL NULL
|
||||
|
||||
# define E_LINESTYLE continuous
|
||||
# define E_THICKNESS 2
|
||||
|
||||
# define E_CLASS 1
|
||||
|
||||
# define E_COLOR black
|
||||
# define E_TEXTCOLOR E_COLOR
|
||||
# define E_ARROWCOLOR E_COLOR
|
||||
# define E_BACKARROWCOLOR E_COLOR
|
||||
|
||||
# define E_ARROWSIZE 10
|
||||
# define E_BACKARROWSIZE 0
|
||||
|
||||
# define E_ARROWSTYLE solid
|
||||
# define E_BACKARROWSTYLE none
|
||||
|
||||
# define E_PRIORITY 1
|
||||
|
||||
# define E_ANCHOR (-1)
|
||||
|
||||
# define E_HORIZONTAL_ORDER (-1)
|
||||
|
||||
# define E_NEXT NULL
|
||||
|
||||
#endif /* not VCG_DEFAULTS_H_ */
|
||||
@@ -1,4 +1,5 @@
|
||||
*.output *.vcg
|
||||
*.dot
|
||||
*.output
|
||||
atconfig
|
||||
atlocal
|
||||
autom4te.cache
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Checking the output filenames. -*- Autotest -*-
|
||||
# Copyright (C) 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -53,7 +53,7 @@ AT_CHECK_OUTPUT([foo.y], [], [-dv -y],
|
||||
AT_CHECK_OUTPUT([foo.y], [], [-dv -b bar],
|
||||
[bar.output bar.tab.c bar.tab.h])
|
||||
AT_CHECK_OUTPUT([foo.y], [], [-dv -g -o foo.c],
|
||||
[foo.c foo.h foo.output foo.vcg])
|
||||
[foo.c foo.dot foo.h foo.output])
|
||||
|
||||
|
||||
AT_CHECK_OUTPUT([foo.y], [%defines %verbose], [],
|
||||
|
||||
Reference in New Issue
Block a user