Compare commits

...

8 Commits

Author SHA1 Message Date
nobody c9ff8f2187 This commit was manufactured by cvs2svn to create tag
'Version_1_32_0'.

[SVN r26264]
2004-11-19 19:19:18 +00:00
Douglas Gregor a323b22e4b Graph is always const
[SVN r26187]
2004-11-11 18:28:29 +00:00
Douglas Gregor d021393683 Removed tabs from files
[SVN r25946]
2004-10-29 12:44:13 +00:00
Douglas Gregor a487d2288f Fix edge removal performance bug
[SVN r25880]
2004-10-27 06:21:51 +00:00
Douglas Gregor e47c049d03 build instructions added
[SVN r25879]
2004-10-27 06:21:21 +00:00
John Maddock 7e37579c6b Merged copyright declaration fixups from main trunk
[SVN r25860]
2004-10-25 10:49:26 +00:00
John Maddock 4c437e4fdc Merged newly fixed copyrights
[SVN r25859]
2004-10-25 10:39:14 +00:00
nobody 2fea7e566f This commit was manufactured by cvs2svn to create branch 'RC_1_32_0'.
[SVN r25797]
2004-10-20 08:26:43 +00:00
22 changed files with 616 additions and 613 deletions
+5
View File
@@ -61,6 +61,11 @@ The source for the BGL is available as part of the Boost distribution
which you can <a href="http://sourceforge.net/project/showfiles.php?group_id=7586">
download from here</a>.
<H2>How to Build the BGL</H2>
<b>DON'T!</b> The Boost Graph Library is a header-only library and
does not need to be built to be used. The only exception is the <a
href="read-graphviz.html">GraphViz input parser</a>.
<H2>Genericity in STL</H2>
<P>
+1 -1
View File
@@ -29,7 +29,7 @@
<PRE>
<i>// named parameter version</i>
template &lt;class Graph, class PredMap, class P, class T, class R&gt;
void prim_minimum_spanning_tree(Graph&amp; g, PredMap p_map,
void prim_minimum_spanning_tree(const Graph&amp; g, PredMap p_map,
const bgl_named_params&lt;P, T, R&gt;&amp; params)
<i>// non-named parameter version</i>
+4 -1
View File
@@ -1,4 +1,7 @@
// François Faure, iMAGIS-GRAVIR / UJF, 2001
// (C) Copyright François Faure 2001
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/config.hpp>
+5
View File
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <string>
#include <iostream>
#include <boost/cstdlib.hpp>
+5
View File
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
/*
Fri Aug 15 16:29:47 EDT 1997
+5
View File
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef IOHB_H
#define IOHB_H
+5
View File
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
/*
Sample output:
+5 -2
View File
@@ -383,8 +383,11 @@ namespace boost {
: Base(x), m_property(x.m_property) { }
inline adjacency_list& operator=(const adjacency_list& x) {
Base::operator=(x);
m_property = x.m_property;
// TBD: probably should give the strong guarantee
if (&x != this) {
Base::operator=(x);
m_property = x.m_property;
}
return *this;
}
+22 -10
View File
@@ -1055,26 +1055,34 @@ namespace boost {
{
// Placement of these overloaded remove_edge() functions
// inside the class avoids a VC++ bug.
// O(E/V) or O(log(E/V))
void
remove_edge(typename Config::edge_descriptor e)
{
typedef typename Config::graph_type graph_type;
typedef typename Config::out_edge_iterator out_edge_iterator;
graph_type& g = static_cast<graph_type&>(*this);
typename Config::OutEdgeList& oel = g.out_edge_list(source(e, g));
typename Config::InEdgeList& iel = in_edge_list(g, target(e, g));
typedef typename Config::OutEdgeList::value_type::property_type PType;
PType& p = *(PType*)e.get_property();
detail::remove_directed_edge_dispatch(e, oel, p);
detail::remove_directed_edge_dispatch(e, iel, p);
detail::remove_directed_edge_dispatch(e, g.m_edges, p);
std::pair<out_edge_iterator, out_edge_iterator> rng =
edge_range(source(e, g), target(e, g), g);
rng.first = std::find(rng.first, rng.second, e);
if (rng.first != rng.second)
remove_edge(rng.first);
}
inline void
remove_edge(typename Config::out_edge_iterator iter)
{
this->remove_edge(*iter);
typedef typename Config::graph_type graph_type;
graph_type& g = static_cast<graph_type&>(*this);
typename Config::edge_descriptor e = *iter;
typename Config::OutEdgeList& oel = g.out_edge_list(source(e, g));
typename Config::InEdgeList& iel = in_edge_list(g, target(e, g));
typedef typename Config::OutEdgeList::value_type::property_type PType;
PType& p = *(PType*)e.get_property();
detail::remove_directed_edge_dispatch(*iter, iel, p);
g.m_edges.erase(iter.base()->get_iter());
oel.erase(iter.base());
}
};
@@ -1473,7 +1481,11 @@ namespace boost {
typedef typename Config::out_edge_iterator out_edge_iterator;
typename Config::OutEdgeList& el = g.out_edge_list(u);
typename Config::OutEdgeList::iterator first, last;
tie(first, last) = std::equal_range(el.begin(), el.end(), StoredEdge(v));
typename Config::EdgeContainer fake_edge_container;
tie(first, last) =
std::equal_range(el.begin(), el.end(),
StoredEdge(v, fake_edge_container.end(),
&fake_edge_container));
return std::make_pair(out_edge_iterator(first, u),
out_edge_iterator(last, u));
}
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GRAPH_DETAIL_CONTAINER_TRAITS_H
#define BOOST_GRAPH_DETAIL_CONTAINER_TRAITS_H
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_DETAIL_PROPERTY_HPP
#define BOOST_DETAIL_PROPERTY_HPP
@@ -1,3 +1,8 @@
// (C) Copyright Jeremiah Willcock 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_FENCED_PRIORITY_QUEUE_HPP
#define BOOST_FENCED_PRIORITY_QUEUE_HPP
+5
View File
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PROPERTY_HPP
#define BOOST_PROPERTY_HPP
+5
View File
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_QUEUE_HPP
#define BOOST_QUEUE_HPP
+5
View File
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
/*
* stringtok.hpp -- Breaks a string into tokens. This is an example for lib3.
*
+253 -287
View File
@@ -1,37 +1,27 @@
/* A Bison parser, made by GNU Bison 1.875a. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* Written by Richard Stallman by simplifying the original so called
``semantic'' parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
//=======================================================================
// Copyright 2001 University of Notre Dame.
// Author: Lie-Quan Lee
//
// This file is part of the Boost Graph Library
//
// You should have received a copy of the License Agreement for the
// Boost Graph Library along with the software; see the file LICENSE.
// If not, contact Office of Research, University of Notre Dame, Notre
// Dame, IN 46556.
//
// Permission to modify the code and to distribute modified code is
// granted, provided the text of this NOTICE is retained, a notice that
// the code was modified is included with the above COPYRIGHT NOTICE and
// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
// file is distributed with the modified code.
//
// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
// By way of example, but not limitation, Licensor MAKES NO
// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
// OR OTHER RIGHTS.
//=======================================================================
/* Identify Bison output. */
#define YYBISON 1
@@ -85,30 +75,6 @@
/* Copy the first part of user declarations. */
#line 1 "graphviz_parser.yy"
//=======================================================================
// Copyright 2001 University of Notre Dame.
// Author: Lie-Quan Lee
//
// This file is part of the Boost Graph Library
//
// You should have received a copy of the License Agreement for the
// Boost Graph Library along with the software; see the file LICENSE.
// If not, contact Office of Research, University of Notre Dame, Notre
// Dame, IN 46556.
//
// Permission to modify the code and to distribute modified code is
// granted, provided the text of this NOTICE is retained, a notice that
// the code was modified is included with the above COPYRIGHT NOTICE and
// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
// file is distributed with the modified code.
//
// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
// By way of example, but not limitation, Licensor MAKES NO
// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
// OR OTHER RIGHTS.
//=======================================================================
#include <iostream>
#include <fstream>
@@ -174,7 +140,7 @@
static const std::string& get_graph_name(const Subgraph& g) {
const boost::graph_property<Subgraph, boost::graph_name_t>::type&
name = boost::get_property(g, boost::graph_name);
name = boost::get_property(g, boost::graph_name);
return name;
}
@@ -191,7 +157,7 @@
//set the label of vertex, it could be overwritten later.
boost::property_map<GRAPHVIZ_GRAPH, boost::vertex_attribute_t>::type
va = boost::get(boost::vertex_attribute, g);
va = boost::get(boost::vertex_attribute, g);
va[v]["label"] = name;
//add v into the map so next time we will find it.
@@ -215,85 +181,85 @@
static void set_attribute(GraphvizAttrList& p,
const GraphvizAttrList& attr) {
const GraphvizAttrList& attr) {
GraphvizAttrList::const_iterator i, end;
for ( i=attr.begin(), end=attr.end(); i!=end; ++i)
p[i->first]=i->second;
p[i->first]=i->second;
}
static void set_attribute(Subgraph& g,
AttrState s, bool clear_attribute = true) {
AttrState s, bool clear_attribute = true) {
typedef Subgraph Graph;
switch ( s ) {
case GRAPH_GRAPH_A:
{
boost::graph_property<Graph, boost::graph_graph_attribute_t>::type&
gga = boost::get_property(g, boost::graph_graph_attribute);
set_attribute(gga, attributes);
}
break;
{
boost::graph_property<Graph, boost::graph_graph_attribute_t>::type&
gga = boost::get_property(g, boost::graph_graph_attribute);
set_attribute(gga, attributes);
}
break;
case GRAPH_NODE_A:
{
boost::graph_property<Graph, boost::graph_vertex_attribute_t>::type&
gna = boost::get_property(g, boost::graph_vertex_attribute);
set_attribute(gna, attributes);
}
break;
{
boost::graph_property<Graph, boost::graph_vertex_attribute_t>::type&
gna = boost::get_property(g, boost::graph_vertex_attribute);
set_attribute(gna, attributes);
}
break;
case GRAPH_EDGE_A:
{
boost::graph_property<Graph, boost::graph_edge_attribute_t>::type&
gea = boost::get_property(g, boost::graph_edge_attribute);
set_attribute(gea, attributes);
}
break;
{
boost::graph_property<Graph, boost::graph_edge_attribute_t>::type&
gea = boost::get_property(g, boost::graph_edge_attribute);
set_attribute(gea, attributes);
}
break;
case NODE_A:
{
boost::property_map<Graph, boost::vertex_attribute_t>::type
va = boost::get(boost::vertex_attribute, g); //va[v]
set_attribute(va[current_vertex], attributes);
}
break;
{
boost::property_map<Graph, boost::vertex_attribute_t>::type
va = boost::get(boost::vertex_attribute, g); //va[v]
set_attribute(va[current_vertex], attributes);
}
break;
case EDGE_A:
{
boost::property_map<Graph, boost::edge_attribute_t>::type
ea = boost::get(boost::edge_attribute, g); //ea[e]
set_attribute(ea[current_edge], attributes);
}
break;
{
boost::property_map<Graph, boost::edge_attribute_t>::type
ea = boost::get(boost::edge_attribute, g); //ea[e]
set_attribute(ea[current_edge], attributes);
}
break;
}
if ( clear_attribute )
attributes.clear();
attributes.clear();
}
static void add_edges(const Vertex& u,
const Vertex& v, GRAPHVIZ_GRAPH& g) {
const Vertex& v, GRAPHVIZ_GRAPH& g) {
graphviz::current_edge = boost::add_edge(u, v, g).first;
graphviz::set_attribute(g, EDGE_A, false);
}
static void add_edges(Subgraph* G1, Subgraph* G2,
GRAPHVIZ_GRAPH& g) {
GRAPHVIZ_GRAPH& g) {
boost::graph_traits<Subgraph>::vertex_iterator i, j, m, n;
for ( boost::tie(i, j) = boost::vertices(*G1); i != j; ++i) {
for ( boost::tie(m, n) = boost::vertices(*G2); m != n; ++m) {
graphviz::add_edges(G1->local_to_global(*i),
G2->local_to_global(*m), g);
}
for ( boost::tie(m, n) = boost::vertices(*G2); m != n; ++m) {
graphviz::add_edges(G1->local_to_global(*i),
G2->local_to_global(*m), g);
}
}
}
static void add_edges(Subgraph* G, const Vertex& v, GRAPHVIZ_GRAPH& g) {
boost::graph_traits<Subgraph>::vertex_iterator i, j;
for ( boost::tie(i, j) = boost::vertices(*G); i != j; ++i) {
graphviz::add_edges(G->local_to_global(*i), v, g);
graphviz::add_edges(G->local_to_global(*i), v, g);
}
}
static void add_edges(const Vertex& u, Subgraph* G, GRAPHVIZ_GRAPH& g) {
boost::graph_traits<Subgraph>::vertex_iterator i, j;
for ( boost::tie(i, j) = boost::vertices(*G); i != j; ++i) {
graphviz::add_edges(u, G->local_to_global(*i), g);
graphviz::add_edges(u, G->local_to_global(*i), g);
}
}
@@ -316,7 +282,7 @@
static void set_graph_name(const std::string& name) {
boost::graph_property<Subgraph, boost::graph_name_t>::type&
gea = boost::get_property(*current_graph, boost::graph_name);
gea = boost::get_property(*current_graph, boost::graph_name);
gea = name;
}
@@ -386,7 +352,7 @@ typedef int YYSTYPE;
#if (! defined (yyoverflow) \
&& (! defined (__cplusplus) \
|| (YYSTYPE_IS_TRIVIAL)))
|| (YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -401,7 +367,7 @@ union yyalloc
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
/* Copy COUNT objects from FROM to TO. The source and destination do
@@ -411,13 +377,13 @@ union yyalloc
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
register YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
# define YYCOPY(To, From, Count) \
do \
{ \
register YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (0)
# endif
# endif
@@ -427,15 +393,15 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
# define YYSTACK_RELOCATE(Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
@@ -464,7 +430,7 @@ union yyalloc
#define YYUNDEFTOK 2
#define YYMAXUTOK 264
#define YYTRANSLATE(YYX) \
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
@@ -683,43 +649,43 @@ static const unsigned char yystos[] =
# define YYSIZE_T unsigned int
#endif
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrlab1
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ \
yychar = (Token); \
yylval = (Value); \
yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ \
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ \
yychar = (Token); \
yylval = (Value); \
yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ \
yyerror ("syntax error: cannot back up");\
YYERROR; \
} \
YYERROR; \
} \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#define YYTERROR 1
#define YYERRCODE 256
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
are run). */
@@ -748,27 +714,27 @@ while (0)
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
# define YYDSYMPRINT(Args) \
do { \
if (yydebug) \
yysymprint Args; \
# define YYDSYMPRINT(Args) \
do { \
if (yydebug) \
yysymprint Args; \
} while (0)
# define YYDSYMPRINTF(Title, Token, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yysymprint (stderr, \
Token, Value); \
YYFPRINTF (stderr, "\n"); \
} \
# define YYDSYMPRINTF(Title, Token, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yysymprint (stderr, \
Token, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
/*------------------------------------------------------------------.
@@ -792,10 +758,10 @@ yy_stack_print (bottom, top)
YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (0)
@@ -822,10 +788,10 @@ yy_reduce_print (yyrule)
YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (Rule); \
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (Rule); \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
@@ -841,7 +807,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -1050,7 +1016,7 @@ int yynerrs;
to reallocate them elsewhere. */
/* The state stack. */
short yyssa[YYINITDEPTH];
short yyssa[YYINITDEPTH];
short *yyss = yyssa;
register short *yyssp;
@@ -1079,7 +1045,7 @@ int yynerrs;
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
@@ -1110,25 +1076,25 @@ int yynerrs;
#ifdef yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow ("parser stack overflow",
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow ("parser stack overflow",
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
&yystacksize);
yyss = yyss1;
yyvs = yyvs1;
yyss = yyss1;
yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
@@ -1136,23 +1102,23 @@ int yynerrs;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyoverflowlab;
goto yyoverflowlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
yystacksize = YYMAXDEPTH;
{
short *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyoverflowlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
short *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyoverflowlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
@@ -1162,10 +1128,10 @@ int yynerrs;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
(unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1216,7 +1182,7 @@ yybackup:
if (yyn <= 0)
{
if (yyn == 0 || yyn == YYTABLE_NINF)
goto yyerrlab;
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@@ -1308,7 +1274,7 @@ yyreduce:
#line 291 "graphviz_parser.yy"
{
graphviz::set_attribute(*graphviz::current_graph,
graphviz::attribute_state);
graphviz::attribute_state);
;}
break;
@@ -1348,7 +1314,7 @@ yyreduce:
{
graphviz::set_attribute(
*static_cast<graphviz::Subgraph*>(graphviz::current_graph),
GRAPH_GRAPH_A);
GRAPH_GRAPH_A);
;}
break;
@@ -1358,7 +1324,7 @@ yyreduce:
graphviz::Vertex* temp = static_cast<graphviz::Vertex*>(yyvsp[-1].ptr);
graphviz::current_vertex = *temp;
graphviz::set_attribute(*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM),
NODE_A);
NODE_A);
delete temp;
yyval.i = 0;
;}
@@ -1382,7 +1348,7 @@ yyreduce:
if (result.second) {
graphviz::current_vertex = result.first->second;
if (! graphviz::current_graph->is_root())
boost::add_vertex(graphviz::current_vertex, *graphviz::current_graph);
boost::add_vertex(graphviz::current_vertex, *graphviz::current_graph);
} else
graphviz::current_vertex = graphviz::add_name(*name, *static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM)) ;
graphviz::Vertex* temp = new graphviz::Vertex(graphviz::current_vertex);
@@ -1425,27 +1391,27 @@ yyreduce:
Ptr source = static_cast<Ptr>(yyvsp[-2].ptr);
for (std::vector<Ptr>::iterator it=graphviz::vlist.begin();
it !=graphviz::vlist.end(); ++it) {
it !=graphviz::vlist.end(); ++it) {
if ( source->second ) {
if ( (*it)->second )
graphviz::add_edges(static_cast<graphviz::Subgraph*>(source->first),
static_cast<graphviz::Subgraph*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
else
graphviz::add_edges(static_cast<graphviz::Subgraph*>(source->first),
*static_cast<graphviz::Vertex*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
if ( (*it)->second )
graphviz::add_edges(static_cast<graphviz::Subgraph*>(source->first),
static_cast<graphviz::Subgraph*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
else
graphviz::add_edges(static_cast<graphviz::Subgraph*>(source->first),
*static_cast<graphviz::Vertex*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
} else {
graphviz::Vertex* temp = static_cast<graphviz::Vertex*>(source->first);
if ( (*it)->second )
graphviz::add_edges(*temp,
static_cast<graphviz::Subgraph*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
else
graphviz::add_edges(*temp,
*static_cast<graphviz::Vertex*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
delete temp;
graphviz::Vertex* temp = static_cast<graphviz::Vertex*>(source->first);
if ( (*it)->second )
graphviz::add_edges(*temp,
static_cast<graphviz::Subgraph*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
else
graphviz::add_edges(*temp,
*static_cast<graphviz::Vertex*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
delete temp;
}
delete source;
@@ -1596,50 +1562,50 @@ yyerrlab:
yyn = yypact[yystate];
if (YYPACT_NINF < yyn && yyn < YYLAST)
{
YYSIZE_T yysize = 0;
int yytype = YYTRANSLATE (yychar);
char *yymsg;
int yyx, yycount;
{
YYSIZE_T yysize = 0;
int yytype = YYTRANSLATE (yychar);
char *yymsg;
int yyx, yycount;
yycount = 0;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
yysize += yystrlen ("syntax error, unexpected ") + 1;
yysize += yystrlen (yytname[yytype]);
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
yyp = yystpcpy (yyp, yytname[yytype]);
yycount = 0;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
yysize += yystrlen ("syntax error, unexpected ") + 1;
yysize += yystrlen (yytname[yytype]);
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
yyp = yystpcpy (yyp, yytname[yytype]);
if (yycount < 5)
{
yycount = 0;
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *));
yyx++)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
const char *yyq = ! yycount ? ", expecting " : " or ";
yyp = yystpcpy (yyp, yyq);
yyp = yystpcpy (yyp, yytname[yyx]);
yycount++;
}
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
yyerror ("syntax error; also virtual memory exhausted");
}
if (yycount < 5)
{
yycount = 0;
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *));
yyx++)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
const char *yyq = ! yycount ? ", expecting " : " or ";
yyp = yystpcpy (yyp, yyq);
yyp = yystpcpy (yyp, yytname[yyx]);
yycount++;
}
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
yyerror ("syntax error; also virtual memory exhausted");
}
else
#endif /* YYERROR_VERBOSE */
yyerror ("syntax error");
yyerror ("syntax error");
}
@@ -1647,21 +1613,21 @@ yyerrlab:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
error, discard it. */
/* Return failure if at end of input. */
if (yychar == YYEOF)
{
/* Pop the error token. */
/* Pop the error token. */
YYPOPSTACK;
/* Pop the rest of the stack. */
while (yyss < yyssp)
{
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
yydestruct (yystos[*yyssp], yyvsp);
YYPOPSTACK;
}
YYABORT;
/* Pop the rest of the stack. */
while (yyss < yyssp)
{
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
yydestruct (yystos[*yyssp], yyvsp);
YYPOPSTACK;
}
YYABORT;
}
YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
@@ -1679,25 +1645,25 @@ yyerrlab:
| yyerrlab1 -- error raised explicitly by an action. |
`----------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (yyn != YYPACT_NINF)
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
YYABORT;
YYABORT;
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
yydestruct (yystos[yystate], yyvsp);
+253 -287
View File
@@ -1,37 +1,27 @@
/* A Bison parser, made by GNU Bison 1.875a. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* Written by Richard Stallman by simplifying the original so called
``semantic'' parser. */
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
There are some unavoidable exceptions within include files to
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
//=======================================================================
// Copyright 2001 University of Notre Dame.
// Author: Lie-Quan Lee
//
// This file is part of the Boost Graph Library
//
// You should have received a copy of the License Agreement for the
// Boost Graph Library along with the software; see the file LICENSE.
// If not, contact Office of Research, University of Notre Dame, Notre
// Dame, IN 46556.
//
// Permission to modify the code and to distribute modified code is
// granted, provided the text of this NOTICE is retained, a notice that
// the code was modified is included with the above COPYRIGHT NOTICE and
// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
// file is distributed with the modified code.
//
// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
// By way of example, but not limitation, Licensor MAKES NO
// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
// OR OTHER RIGHTS.
//=======================================================================
/* Identify Bison output. */
#define YYBISON 1
@@ -85,30 +75,6 @@
/* Copy the first part of user declarations. */
#line 1 "graphviz_parser.yy"
//=======================================================================
// Copyright 2001 University of Notre Dame.
// Author: Lie-Quan Lee
//
// This file is part of the Boost Graph Library
//
// You should have received a copy of the License Agreement for the
// Boost Graph Library along with the software; see the file LICENSE.
// If not, contact Office of Research, University of Notre Dame, Notre
// Dame, IN 46556.
//
// Permission to modify the code and to distribute modified code is
// granted, provided the text of this NOTICE is retained, a notice that
// the code was modified is included with the above COPYRIGHT NOTICE and
// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
// file is distributed with the modified code.
//
// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
// By way of example, but not limitation, Licensor MAKES NO
// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
// OR OTHER RIGHTS.
//=======================================================================
#include <iostream>
#include <fstream>
@@ -174,7 +140,7 @@
static const std::string& get_graph_name(const Subgraph& g) {
const boost::graph_property<Subgraph, boost::graph_name_t>::type&
name = boost::get_property(g, boost::graph_name);
name = boost::get_property(g, boost::graph_name);
return name;
}
@@ -191,7 +157,7 @@
//set the label of vertex, it could be overwritten later.
boost::property_map<GRAPHVIZ_GRAPH, boost::vertex_attribute_t>::type
va = boost::get(boost::vertex_attribute, g);
va = boost::get(boost::vertex_attribute, g);
va[v]["label"] = name;
//add v into the map so next time we will find it.
@@ -215,85 +181,85 @@
static void set_attribute(GraphvizAttrList& p,
const GraphvizAttrList& attr) {
const GraphvizAttrList& attr) {
GraphvizAttrList::const_iterator i, end;
for ( i=attr.begin(), end=attr.end(); i!=end; ++i)
p[i->first]=i->second;
p[i->first]=i->second;
}
static void set_attribute(Subgraph& g,
AttrState s, bool clear_attribute = true) {
AttrState s, bool clear_attribute = true) {
typedef Subgraph Graph;
switch ( s ) {
case GRAPH_GRAPH_A:
{
boost::graph_property<Graph, boost::graph_graph_attribute_t>::type&
gga = boost::get_property(g, boost::graph_graph_attribute);
set_attribute(gga, attributes);
}
break;
{
boost::graph_property<Graph, boost::graph_graph_attribute_t>::type&
gga = boost::get_property(g, boost::graph_graph_attribute);
set_attribute(gga, attributes);
}
break;
case GRAPH_NODE_A:
{
boost::graph_property<Graph, boost::graph_vertex_attribute_t>::type&
gna = boost::get_property(g, boost::graph_vertex_attribute);
set_attribute(gna, attributes);
}
break;
{
boost::graph_property<Graph, boost::graph_vertex_attribute_t>::type&
gna = boost::get_property(g, boost::graph_vertex_attribute);
set_attribute(gna, attributes);
}
break;
case GRAPH_EDGE_A:
{
boost::graph_property<Graph, boost::graph_edge_attribute_t>::type&
gea = boost::get_property(g, boost::graph_edge_attribute);
set_attribute(gea, attributes);
}
break;
{
boost::graph_property<Graph, boost::graph_edge_attribute_t>::type&
gea = boost::get_property(g, boost::graph_edge_attribute);
set_attribute(gea, attributes);
}
break;
case NODE_A:
{
boost::property_map<Graph, boost::vertex_attribute_t>::type
va = boost::get(boost::vertex_attribute, g); //va[v]
set_attribute(va[current_vertex], attributes);
}
break;
{
boost::property_map<Graph, boost::vertex_attribute_t>::type
va = boost::get(boost::vertex_attribute, g); //va[v]
set_attribute(va[current_vertex], attributes);
}
break;
case EDGE_A:
{
boost::property_map<Graph, boost::edge_attribute_t>::type
ea = boost::get(boost::edge_attribute, g); //ea[e]
set_attribute(ea[current_edge], attributes);
}
break;
{
boost::property_map<Graph, boost::edge_attribute_t>::type
ea = boost::get(boost::edge_attribute, g); //ea[e]
set_attribute(ea[current_edge], attributes);
}
break;
}
if ( clear_attribute )
attributes.clear();
attributes.clear();
}
static void add_edges(const Vertex& u,
const Vertex& v, GRAPHVIZ_GRAPH& g) {
const Vertex& v, GRAPHVIZ_GRAPH& g) {
graphviz::current_edge = boost::add_edge(u, v, g).first;
graphviz::set_attribute(g, EDGE_A, false);
}
static void add_edges(Subgraph* G1, Subgraph* G2,
GRAPHVIZ_GRAPH& g) {
GRAPHVIZ_GRAPH& g) {
boost::graph_traits<Subgraph>::vertex_iterator i, j, m, n;
for ( boost::tie(i, j) = boost::vertices(*G1); i != j; ++i) {
for ( boost::tie(m, n) = boost::vertices(*G2); m != n; ++m) {
graphviz::add_edges(G1->local_to_global(*i),
G2->local_to_global(*m), g);
}
for ( boost::tie(m, n) = boost::vertices(*G2); m != n; ++m) {
graphviz::add_edges(G1->local_to_global(*i),
G2->local_to_global(*m), g);
}
}
}
static void add_edges(Subgraph* G, const Vertex& v, GRAPHVIZ_GRAPH& g) {
boost::graph_traits<Subgraph>::vertex_iterator i, j;
for ( boost::tie(i, j) = boost::vertices(*G); i != j; ++i) {
graphviz::add_edges(G->local_to_global(*i), v, g);
graphviz::add_edges(G->local_to_global(*i), v, g);
}
}
static void add_edges(const Vertex& u, Subgraph* G, GRAPHVIZ_GRAPH& g) {
boost::graph_traits<Subgraph>::vertex_iterator i, j;
for ( boost::tie(i, j) = boost::vertices(*G); i != j; ++i) {
graphviz::add_edges(u, G->local_to_global(*i), g);
graphviz::add_edges(u, G->local_to_global(*i), g);
}
}
@@ -316,7 +282,7 @@
static void set_graph_name(const std::string& name) {
boost::graph_property<Subgraph, boost::graph_name_t>::type&
gea = boost::get_property(*current_graph, boost::graph_name);
gea = boost::get_property(*current_graph, boost::graph_name);
gea = name;
}
@@ -386,7 +352,7 @@ typedef int YYSTYPE;
#if (! defined (yyoverflow) \
&& (! defined (__cplusplus) \
|| (YYSTYPE_IS_TRIVIAL)))
|| (YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -401,7 +367,7 @@ union yyalloc
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
/* Copy COUNT objects from FROM to TO. The source and destination do
@@ -411,13 +377,13 @@ union yyalloc
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
register YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
# define YYCOPY(To, From, Count) \
do \
{ \
register YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (0)
# endif
# endif
@@ -427,15 +393,15 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
# define YYSTACK_RELOCATE(Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
YYCOPY (&yyptr->Stack, Stack, yysize); \
Stack = &yyptr->Stack; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
@@ -464,7 +430,7 @@ union yyalloc
#define YYUNDEFTOK 2
#define YYMAXUTOK 264
#define YYTRANSLATE(YYX) \
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
@@ -683,43 +649,43 @@ static const unsigned char yystos[] =
# define YYSIZE_T unsigned int
#endif
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrlab1
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ \
yychar = (Token); \
yylval = (Value); \
yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ \
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ \
yychar = (Token); \
yylval = (Value); \
yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ \
yyerror ("syntax error: cannot back up");\
YYERROR; \
} \
YYERROR; \
} \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#define YYTERROR 1
#define YYERRCODE 256
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
are run). */
@@ -748,27 +714,27 @@ while (0)
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
# define YYDSYMPRINT(Args) \
do { \
if (yydebug) \
yysymprint Args; \
# define YYDSYMPRINT(Args) \
do { \
if (yydebug) \
yysymprint Args; \
} while (0)
# define YYDSYMPRINTF(Title, Token, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yysymprint (stderr, \
Token, Value); \
YYFPRINTF (stderr, "\n"); \
} \
# define YYDSYMPRINTF(Title, Token, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yysymprint (stderr, \
Token, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
/*------------------------------------------------------------------.
@@ -792,10 +758,10 @@ yy_stack_print (bottom, top)
YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
# define YY_STACK_PRINT(Bottom, Top) \
do { \
if (yydebug) \
yy_stack_print ((Bottom), (Top)); \
} while (0)
@@ -822,10 +788,10 @@ yy_reduce_print (yyrule)
YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (Rule); \
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (Rule); \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
@@ -841,7 +807,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -1050,7 +1016,7 @@ int yynerrs;
to reallocate them elsewhere. */
/* The state stack. */
short yyssa[YYINITDEPTH];
short yyssa[YYINITDEPTH];
short *yyss = yyssa;
register short *yyssp;
@@ -1079,7 +1045,7 @@ int yynerrs;
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
@@ -1110,25 +1076,25 @@ int yynerrs;
#ifdef yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow ("parser stack overflow",
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow ("parser stack overflow",
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
&yystacksize);
yyss = yyss1;
yyvs = yyvs1;
yyss = yyss1;
yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
@@ -1136,23 +1102,23 @@ int yynerrs;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
goto yyoverflowlab;
goto yyoverflowlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
yystacksize = YYMAXDEPTH;
{
short *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyoverflowlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
short *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyoverflowlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
@@ -1162,10 +1128,10 @@ int yynerrs;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
(unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1216,7 +1182,7 @@ yybackup:
if (yyn <= 0)
{
if (yyn == 0 || yyn == YYTABLE_NINF)
goto yyerrlab;
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@@ -1308,7 +1274,7 @@ yyreduce:
#line 291 "graphviz_parser.yy"
{
graphviz::set_attribute(*graphviz::current_graph,
graphviz::attribute_state);
graphviz::attribute_state);
;}
break;
@@ -1348,7 +1314,7 @@ yyreduce:
{
graphviz::set_attribute(
*static_cast<graphviz::Subgraph*>(graphviz::current_graph),
GRAPH_GRAPH_A);
GRAPH_GRAPH_A);
;}
break;
@@ -1358,7 +1324,7 @@ yyreduce:
graphviz::Vertex* temp = static_cast<graphviz::Vertex*>(yyvsp[-1].ptr);
graphviz::current_vertex = *temp;
graphviz::set_attribute(*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM),
NODE_A);
NODE_A);
delete temp;
yyval.i = 0;
;}
@@ -1382,7 +1348,7 @@ yyreduce:
if (result.second) {
graphviz::current_vertex = result.first->second;
if (! graphviz::current_graph->is_root())
boost::add_vertex(graphviz::current_vertex, *graphviz::current_graph);
boost::add_vertex(graphviz::current_vertex, *graphviz::current_graph);
} else
graphviz::current_vertex = graphviz::add_name(*name, *static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM)) ;
graphviz::Vertex* temp = new graphviz::Vertex(graphviz::current_vertex);
@@ -1425,27 +1391,27 @@ yyreduce:
Ptr source = static_cast<Ptr>(yyvsp[-2].ptr);
for (std::vector<Ptr>::iterator it=graphviz::vlist.begin();
it !=graphviz::vlist.end(); ++it) {
it !=graphviz::vlist.end(); ++it) {
if ( source->second ) {
if ( (*it)->second )
graphviz::add_edges(static_cast<graphviz::Subgraph*>(source->first),
static_cast<graphviz::Subgraph*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
else
graphviz::add_edges(static_cast<graphviz::Subgraph*>(source->first),
*static_cast<graphviz::Vertex*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
if ( (*it)->second )
graphviz::add_edges(static_cast<graphviz::Subgraph*>(source->first),
static_cast<graphviz::Subgraph*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
else
graphviz::add_edges(static_cast<graphviz::Subgraph*>(source->first),
*static_cast<graphviz::Vertex*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
} else {
graphviz::Vertex* temp = static_cast<graphviz::Vertex*>(source->first);
if ( (*it)->second )
graphviz::add_edges(*temp,
static_cast<graphviz::Subgraph*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
else
graphviz::add_edges(*temp,
*static_cast<graphviz::Vertex*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
delete temp;
graphviz::Vertex* temp = static_cast<graphviz::Vertex*>(source->first);
if ( (*it)->second )
graphviz::add_edges(*temp,
static_cast<graphviz::Subgraph*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
else
graphviz::add_edges(*temp,
*static_cast<graphviz::Vertex*>((*it)->first),
*static_cast<GRAPHVIZ_GRAPH*>(YYPARSE_PARAM));
delete temp;
}
delete source;
@@ -1596,50 +1562,50 @@ yyerrlab:
yyn = yypact[yystate];
if (YYPACT_NINF < yyn && yyn < YYLAST)
{
YYSIZE_T yysize = 0;
int yytype = YYTRANSLATE (yychar);
char *yymsg;
int yyx, yycount;
{
YYSIZE_T yysize = 0;
int yytype = YYTRANSLATE (yychar);
char *yymsg;
int yyx, yycount;
yycount = 0;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
yysize += yystrlen ("syntax error, unexpected ") + 1;
yysize += yystrlen (yytname[yytype]);
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
yyp = yystpcpy (yyp, yytname[yytype]);
yycount = 0;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
yysize += yystrlen ("syntax error, unexpected ") + 1;
yysize += yystrlen (yytname[yytype]);
yymsg = (char *) YYSTACK_ALLOC (yysize);
if (yymsg != 0)
{
char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
yyp = yystpcpy (yyp, yytname[yytype]);
if (yycount < 5)
{
yycount = 0;
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *));
yyx++)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
const char *yyq = ! yycount ? ", expecting " : " or ";
yyp = yystpcpy (yyp, yyq);
yyp = yystpcpy (yyp, yytname[yyx]);
yycount++;
}
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
yyerror ("syntax error; also virtual memory exhausted");
}
if (yycount < 5)
{
yycount = 0;
for (yyx = yyn < 0 ? -yyn : 0;
yyx < (int) (sizeof (yytname) / sizeof (char *));
yyx++)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
const char *yyq = ! yycount ? ", expecting " : " or ";
yyp = yystpcpy (yyp, yyq);
yyp = yystpcpy (yyp, yytname[yyx]);
yycount++;
}
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
yyerror ("syntax error; also virtual memory exhausted");
}
else
#endif /* YYERROR_VERBOSE */
yyerror ("syntax error");
yyerror ("syntax error");
}
@@ -1647,21 +1613,21 @@ yyerrlab:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
error, discard it. */
/* Return failure if at end of input. */
if (yychar == YYEOF)
{
/* Pop the error token. */
/* Pop the error token. */
YYPOPSTACK;
/* Pop the rest of the stack. */
while (yyss < yyssp)
{
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
yydestruct (yystos[*yyssp], yyvsp);
YYPOPSTACK;
}
YYABORT;
/* Pop the rest of the stack. */
while (yyss < yyssp)
{
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
yydestruct (yystos[*yyssp], yyvsp);
YYPOPSTACK;
}
YYABORT;
}
YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
@@ -1679,25 +1645,25 @@ yyerrlab:
| yyerrlab1 -- error raised explicitly by an action. |
`----------------------------------------------------*/
yyerrlab1:
yyerrstatus = 3; /* Each real token shifted decrements this. */
yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (yyn != YYPACT_NINF)
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
{
yyn = yytable[yyn];
if (0 < yyn)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
YYABORT;
YYABORT;
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
yydestruct (yystos[yystate], yyvsp);
+5
View File
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GRAPH_YYSTYPE_H
#define BOOST_GRAPH_YYSTYPE_H
+5
View File
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// From Louis Lavery <Louis@devilsChimney.co.uk>
/*Expected Output:-
A: 0 A
+5
View File
@@ -1,3 +1,8 @@
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/cstdlib.hpp>
+4 -25
View File
@@ -1,28 +1,7 @@
//=======================================================================
// Copyright 2001 Indiana University
// Author: Jeremy G. Siek
//
// This file is part of the Boost Graph Library
//
// You should have received a copy of the License Agreement for the
// Boost Graph Library along with the software; see the file LICENSE.
// If not, contact Office of Research, Indiana University, Bloomington,
// IN 47404.
//
// Permission to modify the code and to distribute modified code is
// granted, provided the text of this NOTICE is retained, a notice that
// the code was modified is included with the above COPYRIGHT NOTICE and
// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
// file is distributed with the modified code.
//
// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
// By way of example, but not limitation, Licensor MAKES NO
// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
// OR OTHER RIGHTS.
//=======================================================================
// (C) Copyright Jeremy Siek 2004
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <set>
+4
View File
@@ -1,3 +1,7 @@
// Copyright (C) 2004 Jeremy Siek <jsiek@cs.indiana.edu>
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/depth_first_search.hpp>
#include <boost/graph/transitive_closure.hpp>