**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
return atoi(val.c_str());
}
+// see 'minor hack' at the end of parse_vector() below
+// making this 'static' to give it file local scope
+// stops it working (where working means working around
+// bug #1509627)
+Vector &canvas_parser_vector_id(Vector &vector)
+{
+ return vector;
+}
+
Vector
CanvasParser::parse_vector(xmlpp::Element *element)
{
else
error_unexpected_element(child,child->get_name());
}
- return vect;
+ // Minor hack - gcc 4.1.2 and earlier think that we're not using
+ // 'vect' and optimize it out at -O2 and higher. This convinces
+ // them that we are really using it.
+ return canvas_parser_vector_id(vect);
+ // When the bug is fixed, we can just do this instead:
+ // return vect;
}
Color
return value_node;
}
- // If ValueBase::ident_type() recognises the name, then we know it's a ValueBase
+ // If ValueBase::ident_type() recognizes the name, then we know it's a ValueBase
if(element->get_name()!="canvas" && ValueBase::ident_type(element->get_name()))
{
ValueBase data=parse_value(element,canvas);
continue;
}
- // If we recognise the element name as a
+ // If we recognize the element name as a
// ValueBase, then treat is at one
if(/*(*iter)->get_name()!="canvas" && */ValueBase::ident_type((*iter)->get_name()) && !dynamic_cast<xmlpp::Element*>(*iter)->get_attribute("guid"))
{
// If we don't have any name, warn
if(list.empty())
- warning(child,_("blank \"name\" entitity"));
+ warning(child,_("blank \"name\" entity"));
string tmp;
for(xmlpp::Element::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter)
// If we don't have any description, warn
if(list.empty())
- warning(child,_("blank \"desc\" entitity"));
+ warning(child,_("blank \"desc\" entity"));
string tmp;
for(xmlpp::Element::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter)
// If we don't have any description, warn
if(list.empty())
- warning(child,_("blank \"author\" entitity"));
+ warning(child,_("blank \"author\" entity"));
string tmp;
for(xmlpp::Element::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter)
if(canvas->value_node_list().placeholder_count())
{
- error(element,strprintf(_("Canvas %s has undefined ValueNodes"),canvas->get_id().c_str()));
+ String nodes;
+ for (ValueNodeList::const_iterator iter = canvas->value_node_list().begin(); iter != canvas->value_node_list().end(); iter++)
+ if(PlaceholderValueNode::Handle::cast_dynamic(*iter))
+ {
+ if (nodes != "") nodes += ", ";
+ nodes += "'" + (*iter)->get_id() + "'";
+ }
+ error(element,strprintf(_("Canvas '%s' has undefined %s: %s"),
+ canvas->get_id().c_str(),
+ canvas->value_node_list().placeholder_count() == 1 ? _("ValueNode") : _("ValueNodes"),
+ nodes.c_str()));
}
return canvas;