[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10337: Minor changes to XMLNode and
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10337: Minor changes to XMLNode and XML tests. |
Date: |
Mon, 24 Nov 2008 14:33:12 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10337
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2008-11-24 14:33:12 +0100
message:
Minor changes to XMLNode and XML tests.
modified:
libcore/asobj/XMLNode_as.cpp
testsuite/actionscript.all/XML.as
------------------------------------------------------------
revno: 10335.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2008-11-24 13:44:38 +0100
message:
Clean up.
modified:
libcore/asobj/XMLNode_as.cpp
------------------------------------------------------------
revno: 10335.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2008-11-24 14:14:17 +0100
message:
Another test.
modified:
testsuite/actionscript.all/XML.as
=== modified file 'libcore/asobj/XMLNode_as.cpp'
--- a/libcore/asobj/XMLNode_as.cpp 2008-11-21 17:03:24 +0000
+++ b/libcore/asobj/XMLNode_as.cpp 2008-11-24 12:44:38 +0000
@@ -47,33 +47,33 @@
bool namespaceMatches(
const PropertyList::SortedPropertyList::value_type& val,
const std::string& ns);
+
+ as_value xmlnode_new(const fn_call& fn);
+ as_value xmlnode_nodename(const fn_call& fn);
+ as_value xmlnode_node_value(const fn_call& fn);
+ as_value xmlnode_nodetype(const fn_call& fn);
+ as_value xmlnode_attributes(const fn_call& fn);
+ as_value xmlnode_appendchild(const fn_call& fn);
+ as_value xmlnode_clonenode(const fn_call& fn);
+ as_value xmlnode_haschildnodes(const fn_call& fn);
+ as_value xmlnode_insertbefore(const fn_call& fn);
+ as_value xmlnode_removenode(const fn_call& fn);
+ as_value xmlnode_tostring(const fn_call& fn);
+ as_value xmlnode_firstchild(const fn_call& fn);
+ as_value xmlnode_lastchild(const fn_call& fn);
+ as_value xmlnode_nextsibling(const fn_call& fn);
+ as_value xmlnode_previoussibling(const fn_call& fn);
+ as_value xmlnode_childNodes(const fn_call& fn);
+ as_value xmlnode_parentNode(const fn_call& fn);
+ as_value xmlnode_getPrefixForNamespace(const fn_call& fn);
+ as_value xmlnode_getNamespaceForPrefix(const fn_call& fn);
+ as_value xmlnode_namespaceURI(const fn_call& fn);
+ as_value xmlnode_localName(const fn_call& fn);
+ as_value xmlnode_prefix(const fn_call& fn);
+
+ void attachXMLNodeInterface(as_object& o);
}
-static as_value xmlnode_new(const fn_call& fn);
-static as_value xmlnode_nodename(const fn_call& fn);
-static as_value xmlnode_node_value(const fn_call& fn);
-static as_value xmlnode_nodetype(const fn_call& fn);
-static as_value xmlnode_attributes(const fn_call& fn);
-static as_value xmlnode_appendchild(const fn_call& fn);
-static as_value xmlnode_clonenode(const fn_call& fn);
-static as_value xmlnode_haschildnodes(const fn_call& fn);
-static as_value xmlnode_insertbefore(const fn_call& fn);
-static as_value xmlnode_removenode(const fn_call& fn);
-static as_value xmlnode_tostring(const fn_call& fn);
-static as_value xmlnode_firstchild(const fn_call& fn);
-static as_value xmlnode_lastchild(const fn_call& fn);
-static as_value xmlnode_nextsibling(const fn_call& fn);
-static as_value xmlnode_previoussibling(const fn_call& fn);
-static as_value xmlnode_childNodes(const fn_call& fn);
-static as_value xmlnode_parentNode(const fn_call& fn);
-static as_value xmlnode_getPrefixForNamespace(const fn_call& fn);
-static as_value xmlnode_getNamespaceForPrefix(const fn_call& fn);
-static as_value xmlnode_namespaceURI(const fn_call& fn);
-static as_value xmlnode_localName(const fn_call& fn);
-static as_value xmlnode_prefix(const fn_call& fn);
-
-as_object* getXMLNodeInterface();
-
XMLNode_as::XMLNode_as()
:
@@ -113,7 +113,8 @@
{
//log_debug("%s: %p", __PRETTY_FUNCTION__, this);
#ifdef DEBUG_MEMORY_ALLOCATION
- log_debug(_("\tDeleting XMLNode data %s with as_value %s at %p"),
this->_name.c_str(), this->as_value.c_str(), this);
+ log_debug(_("\tDeleting XMLNode data %s with as_value %s at %p"),
+ this->_name, this->as_value, this);
#endif
}
@@ -351,7 +352,6 @@
}
-/* static private */
void
XMLNode_as::stringify(const XMLNode_as& xml, std::ostream& xmlout, bool
encode)
{
@@ -360,7 +360,6 @@
const std::string& nodename = xml.nodeName();
NodeType type = xml.nodeType();
-
#ifdef GNASH_DEBUG
log_debug(_("Stringifying node %p with name %s, as_value %s, %u "
"attributes and %u children"), (void*)&xml, nodename,
@@ -392,8 +391,8 @@
}
else
{
- // Will use a closing tag later
- xmlout << ">";
+ // Will use a closing tag later
+ xmlout << ">";
}
}
@@ -422,6 +421,60 @@
}
}
+
+#ifdef GNASH_USE_GC
+void
+XMLNode_as::markReachableResources() const
+{
+ // Mark childs
+ for (Children::const_iterator i=_children.begin(),
+ e=_children.end(); i!=e; ++i)
+ {
+ (*i)->setReachable();
+ }
+
+ // Mark parent
+ if ( _parent ) _parent->setReachable();
+
+ // Mark attributes object
+ if (_attributes) _attributes->setReachable();
+
+ markAsObjectReachable();
+}
+#endif // GNASH_USE_GC
+
+// External, used by getXMLInterface() !
+as_object*
+getXMLNodeInterface()
+{
+ static boost::intrusive_ptr<as_object> o;
+ if ( o == NULL ) {
+ o = new as_object(getObjectInterface());
+ attachXMLNodeInterface(*o);
+ }
+ return o.get();
+}
+
+
+void xmlnode_class_init(as_object& global)
+{
+ // This is the global XMLNode_as "class"
+ static boost::intrusive_ptr<builtin_function> cl;
+
+ if ( cl == NULL )
+ {
+ cl=new builtin_function(&xmlnode_new, getXMLNodeInterface());
+ }
+
+ global.init_member("XMLNode", cl.get());
+
+}
+
+
+// XMLNode interface implementation
+
+namespace {
+
void
attachXMLNodeInterface(as_object& o)
{
@@ -472,19 +525,8 @@
}
-// External, used by getXMLInterface() !
-as_object*
-getXMLNodeInterface()
-{
- static boost::intrusive_ptr<as_object> o;
- if ( o == NULL ) {
- o = new as_object(getObjectInterface());
- attachXMLNodeInterface(*o);
- }
- return o.get();
-}
-static as_value
+as_value
xmlnode_new(const fn_call& fn)
{
@@ -501,7 +543,8 @@
return as_value(xml_obj);
}
-static as_value
+
+as_value
xmlnode_appendchild(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
@@ -532,7 +575,8 @@
}
-static as_value
+
+as_value
xmlnode_clonenode(const fn_call& fn)
{
boost::intrusive_ptr<XMLNode_as> ptr = ensureType<XMLNode_as>(fn.this_ptr);
@@ -544,7 +588,8 @@
return as_value(newnode.get());
}
-static as_value
+
+as_value
xmlnode_insertbefore(const fn_call& fn)
{
boost::intrusive_ptr<XMLNode_as> ptr =
ensureType<XMLNode_as>(fn.this_ptr);
@@ -737,6 +782,7 @@
return as_value(ss.str());
}
+
as_value
xmlnode_haschildnodes(const fn_call& fn)
{
@@ -744,6 +790,7 @@
return as_value(ptr->hasChildNodes());
}
+
as_value
xmlnode_node_value(const fn_call& fn)
{
@@ -763,6 +810,7 @@
return rv;
}
+
as_value
xmlnode_nodename(const fn_call& fn)
{
@@ -770,17 +818,18 @@
as_value rv;
rv.set_null();
- if ( fn.nargs == 0 ) {
+ if (!fn.nargs) {
const std::string& val = ptr->nodeName();
if ( ! val.empty() ) rv = val;
}
else
{
- ptr->nodeNameSet(fn.arg(0).to_string());
+ ptr->nodeNameSet(fn.arg(0).to_string());
}
return rv;
}
+
as_value
xmlnode_nodetype(const fn_call& fn)
{
@@ -799,6 +848,7 @@
return as_value();
}
+
/// Read-only property; evaluates the specified XML object and
/// references the first child in the parent node's child
/// list. This property is null if the node does not have
@@ -822,6 +872,7 @@
return rv;
}
+
/// Read-only property; an XMLNode as_value that references the last
/// child in the node's child list. The XML.lastChild property
/// is null if the node does not have children. This property cannot
@@ -856,6 +907,7 @@
return rv;
}
+
as_value
xmlnode_previoussibling(const fn_call& fn)
{
@@ -870,6 +922,7 @@
return rv;
}
+
as_value
xmlnode_parentNode(const fn_call& fn)
{
@@ -897,49 +950,13 @@
for ( Children::const_iterator it=child.begin(), itEnd=child.end();
it != itEnd; ++it )
{
- boost::intrusive_ptr<XMLNode_as> node = *it;
- ary->push(as_value(node.get()));
+ boost::intrusive_ptr<XMLNode_as> node = *it;
+ ary->push(as_value(node.get()));
}
return as_value(ary.get());
}
-void xmlnode_class_init(as_object& global)
-{
- // This is the global XMLNode_as "class"
- static boost::intrusive_ptr<builtin_function> cl;
-
- if ( cl == NULL )
- {
- cl=new builtin_function(&xmlnode_new, getXMLNodeInterface());
- }
-
- global.init_member("XMLNode", cl.get());
-
-}
-
-#ifdef GNASH_USE_GC
-void
-XMLNode_as::markReachableResources() const
-{
- // Mark childs
- for (Children::const_iterator i=_children.begin(),
- e=_children.end(); i!=e; ++i)
- {
- (*i)->setReachable();
- }
-
- // Mark parent
- if ( _parent ) _parent->setReachable();
-
- // Mark attributes object
- if (_attributes) _attributes->setReachable();
-
- markAsObjectReachable();
-}
-#endif // GNASH_USE_GC
-
-namespace {
void
enumerateAttributes(const XMLNode_as& node,
=== modified file 'testsuite/actionscript.all/XML.as'
--- a/testsuite/actionscript.all/XML.as 2008-11-18 14:30:05 +0000
+++ b/testsuite/actionscript.all/XML.as 2008-11-24 13:14:17 +0000
@@ -864,9 +864,9 @@
if ( this.onLoadCalls == 2 )
{
#if OUTPUT_VERSION < 6
- check_totals(386);
+ check_totals(387);
#else
- check_totals(426);
+ check_totals(427);
#endif
play();
}
@@ -968,6 +968,10 @@
h = new XML("<open>& ' \"<");
check_equals(h.toString(), "<open>& ' "</open>");
+// A non-breaking space (honest).
+h = new XML("<open> </open>");
+check_equals(h.toString(), "<open> </open>");
+
h = new XML("</open><open>node with \"</open>");
check_equals(h.toString(), "");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10337: Minor changes to XMLNode and XML tests.,
Benjamin Wolsey <=