gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash testsuite/actionscript.all/XML.as ChangeL...


From: Rob Savoye
Subject: [Gnash-commit] gnash testsuite/actionscript.all/XML.as ChangeL...
Date: Tue, 13 Feb 2007 19:36:35 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Rob Savoye <rsavoye>    07/02/13 19:36:35

Modified files:
        testsuite/actionscript.all: XML.as 
        .              : ChangeLog 
        server/asobj   : Makefile.am NetStream.cpp Number.cpp xml.cpp 
                         xml.h xmlnode.cpp xmlnode.h xmlsocket.cpp 
                         xmlsocket.h 
        server/vm      : ActionExec.cpp 

Log message:
                * server/asobj/xmlnode.cpp: Implement toString(). Make 
appendChild
                actually work.
                * server/asobj/xml.cpp: Re-implement toString(). Make
                createElement() and createTextNode() actually work.
                * server/asobj/xmlnode.h, xml.h: Include stringstream, and add 
to
                stringify() prototype.
                * server/asobj/xml.cpp: 
                * server/vm/ActionExec.cpp: Renable the stack dump messages for
                -va.
                * testsuite/actionscript.all/XML.as: Replace all the create* and
                appendChild() tests now that this functionality actually works.
                * server/Makefile.am: Add boost and pthread libs for cross 
compiling.
                * server/asobj/Makefile.am: Add glib and gstreamer cflags, 
needed
                when cross compiling with Gstreamer support.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/XML.as?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2349&r2=1.2350
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Makefile.am?cvsroot=gnash&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/NetStream.cpp?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Number.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.cpp?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlnode.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlnode.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlsocket.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xmlsocket.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.18&r2=1.19

Patches:
Index: testsuite/actionscript.all/XML.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/XML.as,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- testsuite/actionscript.all/XML.as   18 Jan 2007 22:53:22 -0000      1.16
+++ testsuite/actionscript.all/XML.as   13 Feb 2007 19:36:34 -0000      1.17
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 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
@@ -16,13 +16,11 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-//
-
 // Test case for XML ActionScript class
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: XML.as,v 1.16 2007/01/18 22:53:22 strk Exp $";
+rcsid="$Id: XML.as,v 1.17 2007/02/13 19:36:34 rsavoye Exp $";
 
 #include "dejagnu.as"
 #include "utils.as"
@@ -231,97 +229,77 @@
     fail("bytes counts are not the same");
 }
 
-check(XML);
 
+check(XML);
 myXML = new XML();
 check(myXML != undefined);
+check(myXML.createElement);
 
-var before = myXML.hasChildNodes();
-//trace(before);
+//    file.puts("function: dodo()");
+// create three XML nodes using createElement()
+var element1 = myXML.createElement("element1");
+check(element1.nodeName == "element1");
 
-check(myXML.createElement);
+var element2 = myXML.createElement("element2");
+check(element2.nodeName == "element2");
 
-getElement = myXML.createElement("module");
+var element3 = myXML.createElement("element3");
+check(element3.nodeName == "element3");
 
-check(getElement);
-trace(typeof(getElement));
-check(getElement.nodeName != undefined );
-#if OUTPUT_VERSION > 6
-// we're case-sensitive in version 7 !!
-check_equals(getElement.nodename, undefined );
-#else
-check(getElement.nodename != undefined );
-#endif
-
-check_equals(getElement.nodeName, "module");
-if (getElement.nodeName == "module") {
-    pass("XML::createElementNode() works");
-} else {
-    fail("XML::createElementNode() doesn't work");
-}
+check(myXML.createTextNode);
 
-textElement = myXML.createTextNode("Hello World");
-if (textElement.nodeValue == "Hello World") {
-    pass("XML::createTextNode() works");
-} else {
-    fail("XML::createTextNode() doesn't work");
-}
+// create two XML text nodes using createTextNode()
+var textNode1 = myXML.createTextNode("textNode1 String value");
+check(textNode1.nodeValue == "textNode1 String value");
 
-check_equals(textElement.nodeType, 3);
-check_equals(textElement.nodeValue, "Hello World");
-check_equals(typeof(textElement.nodeName), 'null');
-check_equals(textElement.nodeName, null);
-
-//note(textElement);
-
-check(getElement);
-check(getElement.appendChild);
-check(textElement);
-
-check_equals(getElement.hasChildNodes(), false);
-
-getElement.appendChild(textElement);
-if ( getElement.hasChildNodes() ) {
-    pass("Appending Text Node to Element Node works");
-} else {
-    xfail("Appending Text Node to Element Node doesn't work");
-}
+var textNode2 = myXML.createTextNode("textNode2 String value");
+check(textNode2.nodeValue == "textNode2 String value");
 
-nodename = getElement.nodeName;
-myXML.appendChild(getElement);
-var after = myXML.hasChildNodes();
+// place the new nodes into the XML tree
+element2.appendChild(textNode1);
+check(element2.nodeValue == "textNode1 String value");
 
-//trace(after);
+element3.appendChild(textNode2);
+check(element3.nodeValue == "textNode2 String value");
 
-if ((before == false) && (after == true) && (nodename == "module")) {
-       pass("XML::appendChild() works");
-} else {
-       fail("XML::appendChild() doesn't work");
-}
+// place the new nodes into the XML tree
+doc.appendChild(element1);
+//check(doc.firstChild.nodeName == "element1");
 
-// trace(myXML.toString());
+element1.appendChild(element2);
+check(element1.hasChildNodes());
+// trace(element1.nodeName);
+// trace(element1.firstChild.nodeName);
+check(element1.firstChild.nodeName == "element2");
 
-newnode = myXML.cloneNode(false);
+element2.appendChild(element3);
+check(element2.hasChildNodes());
 
-//trace(myXML.nodeName);
-//trace(newnode.nodeValue);
+trace(doc.toString());
 
-//trace("Child1" + _global.child1);
-//trace("Child2" + _global.child2);
-
-// This won't work as onLoad is not called unless you
-// actually *load* the XML, we're using parseXML that
-// does *not* trigger loading (see also getBytesLoaded
-// and getBytesTotal) and does *not* trigger onLoad 
-// event to execute.
-#if 0 
-if ((_global.child1 == "sub sub1 node data 1")
-    && (global.child2 == "sub sub1 node data 2")) {
-       pass("XML::onLoad works");
-} else {
-       fail("XML::onLoad doesn't work");
-}
-#endif
+// // trace(myXML.toString());
+
+// newnode = myXML.cloneNode(false);
+
+// //trace(myXML.nodeName);
+// //trace(newnode.nodeValue);
+
+// //trace("Child1" + _global.child1);
+// //trace("Child2" + _global.child2);
+
+// // This won't work as onLoad is not called unless you
+// // actually *load* the XML, we're using parseXML that
+// // does *not* trigger loading (see also getBytesLoaded
+// // and getBytesTotal) and does *not* trigger onLoad 
+// // event to execute.
+// #if 0 
+// if ((_global.child1 == "sub sub1 node data 1")
+//     && (global.child2 == "sub sub1 node data 2")) {
+//     pass("XML::onLoad works");
+// } else {
+//     fail("XML::onLoad doesn't work");
+// }
+// #endif
 
 // We're done
 totals();

Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2349
retrieving revision 1.2350
diff -u -b -r1.2349 -r1.2350
--- ChangeLog   13 Feb 2007 17:11:06 -0000      1.2349
+++ ChangeLog   13 Feb 2007 19:36:34 -0000      1.2350
@@ -1,3 +1,21 @@
+2007-02-13  Rob Savoye  <address@hidden>
+
+       * server/asobj/xmlnode.cpp: Implement toString(). Make appendChild
+       actually work.
+       * server/asobj/xml.cpp: Re-implement toString(). Make
+       createElement() and createTextNode() actually work.
+       * server/asobj/xmlnode.h, xml.h: Include stringstream, and add to
+       stringify() prototype.
+       * server/asobj/xml.cpp: 
+       * server/vm/ActionExec.cpp: Renable the stack dump messages for
+       -va.
+       * testsuite/actionscript.all/XML.as: Replace all the create* and
+       appendChild() tests now that this functionality actually works.
+       * server/Makefile.am: Add boost and pthread libs for cross compiling.
+       * server/asobj/Makefile.am: Add glib and gstreamer cflags, needed
+       when cross compiling with Gstreamer support.
+       
+
 2007-02-13 Sandro Santilli <address@hidden>
 
        * server/parser/shape_character_def.h: new add_path() and

Index: server/asobj/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Makefile.am,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- server/asobj/Makefile.am    13 Jan 2007 20:06:17 -0000      1.29
+++ server/asobj/Makefile.am    13 Feb 2007 19:36:34 -0000      1.30
@@ -1,6 +1,6 @@
 ## Process this file with automake to generate Makefile.in
 # 
-#   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+#   Copyright (C) 2005, 2006, 2007 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
@@ -15,10 +15,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-# 
-#
-
-# $Id: Makefile.am,v 1.29 2007/01/13 20:06:17 tgc Exp $
+# $Id: Makefile.am,v 1.30 2007/02/13 19:36:34 rsavoye Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -37,6 +34,8 @@
        -I$(top_srcdir) \
        $(PTHREAD_CFLAGS) \
        $(DMALLOC_CFLAGS) \
+       $(GLIB_CFLAGS) \
+       $(GSTREAMER_CFLAGS) \
        $(BOOST_CFLAGS) \
        $(LIBXML_CFLAGS) \
        $(NULL)

Index: server/asobj/NetStream.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/NetStream.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- server/asobj/NetStream.cpp  30 Jan 2007 12:49:03 -0000      1.25
+++ server/asobj/NetStream.cpp  13 Feb 2007 19:36:34 -0000      1.26
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 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
@@ -13,12 +13,9 @@
 // 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-// 
-//
 //
 
-/* $Id: NetStream.cpp,v 1.25 2007/01/30 12:49:03 strk Exp $ */
+/* $Id: NetStream.cpp,v 1.26 2007/02/13 19:36:34 rsavoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"

Index: server/asobj/Number.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Number.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/asobj/Number.cpp     12 Feb 2007 01:18:45 -0000      1.20
+++ server/asobj/Number.cpp     13 Feb 2007 19:36:34 -0000      1.21
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 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
@@ -14,11 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-// 
-//
-//
-
-/* $Id: Number.cpp,v 1.20 2007/02/12 01:18:45 nihilus Exp $ */
+/* $Id: Number.cpp,v 1.21 2007/02/13 19:36:34 rsavoye Exp $ */
 
 // Implementation of ActionScript Number class.
 
@@ -33,6 +29,23 @@
 #include <sstream>
 #include <cmath>
 
+// Why ?
+//#undef fpclassify
+//#define fpclassify(x) _fpclassify(x)
+
+/* C99: 7.12 6 defines for floating point classification */
+
+#undef FP_ZERO
+#define FP_ZERO          1
+#undef FP_SUBNORMAL
+#define FP_SUBNORMAL     2
+#undef FP_NORMAL
+#define FP_NORMAL        4
+#undef FP_INFINITE
+#define FP_INFINITE      8
+#undef FP_NAN
+#define FP_NAN           16 
+
 using namespace std;
 
 namespace gnash {

Index: server/asobj/xml.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/asobj/xml.cpp        5 Feb 2007 07:18:30 -0000       1.15
+++ server/asobj/xml.cpp        13 Feb 2007 19:36:34 -0000      1.16
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: xml.cpp,v 1.15 2007/02/05 07:18:30 zoulunkai Exp $ */
+/* $Id: xml.cpp,v 1.16 2007/02/13 19:36:34 rsavoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -29,6 +29,7 @@
 #include "xmlnode.h"
 #include "xml.h"
 #include "builtin_function.h"
+#include "debugger.h"
 
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
@@ -38,6 +39,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <string>
+#include <sstream>
 #include <vector>
 
 using namespace std;
@@ -78,6 +80,11 @@
 static void xml_nodename(const fn_call& fn);
 static void xml_nodevalue(const fn_call& fn);
   
+static LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+#ifdef USE_DEBUGGER
+static Debugger& debugger = Debugger::getDefaultInstance();
+#endif
+
 XML::XML() 
        :
        as_object(getXMLInterface()),
@@ -244,10 +251,10 @@
 
     element = new XMLNode;
             
-    //log_msg("Created new element for %s at %p\n", node->name, element);
+//    log_msg("Created new element for %s at %p\n", node->name, element);
     memset(element, 0, sizeof (XMLNode));
 
-    log_msg("%s: extracting node %s\n", __FUNCTION__, node->name);
+//    log_msg("%s: extracting node %s\n", __FUNCTION__, node->name);
 
     // See if we have any Attributes (properties)
     attr = node->properties;
@@ -299,14 +306,14 @@
 
     while (childnode != NULL) {
         if (childnode->type == XML_ELEMENT_NODE) {
-            //log_msg("\t\t extracting node %s\n", childnode->name);
+//            log_msg("\t\t extracting node %s\n", childnode->name);
             child = extractNode(childnode, mem);
             //if (child->_value.get_type() != as_value::UNDEFINED) {
-            if (child->_value != 0) {
-                //log_msg("\tPushing childNode %s, value %s on element %p\n", 
child->_name.c_str(), child->_value.to_string(), element);
-            } else {
-                //log_msg("\tPushing childNode %s on element %p\n", 
child->_name.c_str(), element);
-            }
+//             if (child->_value != 0) {
+//                 log_msg("\tPushing childNode %s, value %s on element %s\n", 
child->_name, child->_value, element->_name);
+//             } else {
+//                 log_msg("\tPushing childNode %s on element %s\n", 
child->_name, element->_name);
+//             }
             element->_children.push_back(child);
         }
         childnode = childnode->next;
@@ -320,8 +327,6 @@
 XML::parseDoc(xmlDocPtr document, bool mem)
 {
     GNASH_REPORT_FUNCTION;
-    
-    XMLNode *top;
     xmlNodePtr cur;
 
     if (document == 0) {
@@ -332,11 +337,7 @@
     cur = xmlDocGetRootElement(document);
   
     if (cur != NULL) {
-        top = extractNode(cur, mem);
-        //_nodes->_name = reinterpret_cast<const char *>(cur->name);
-        _nodes = top;
-        //_node_data.push_back(top);
-        //cur = cur->next;
+        _nodes = extractNode(cur, mem);
     }  
 
     _loaded = true;
@@ -389,7 +390,7 @@
 bool
 XML::load(const char *filespec)
 {
-    GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
     struct stat stats;
     log_msg("Load disk XML file: %s\n", filespec);
   
@@ -479,7 +480,7 @@
     obj->set_member("length", length); // FIXME: use a getter/setter !
     if (xml->_value != 0) {
         //obj->set_member("nodeValue", xml->_value); // use the getter/setter !
-        log_msg("\tnodevalue for %s is: %s\n", nodename, xml->_value);
+        //log_msg("\tnodevalue for %s is: %s\n", nodename, xml->_value);
     } else {
         // obj->set_member("nodeValue", as_value::UNDEFINED); // use the 
getter/setter !
     }
@@ -492,9 +493,9 @@
         attr_obj = new xmlattr_as_object;
         for (i=0; i<xml->_attributes.size(); i++) {
             attr_obj->set_member(xml->_attributes[i]->_name, 
xml->_attributes[i]->_value);
-           log_msg("\t\tAdding attribute as member %s, value is %s to node %s 
(%p)\n",
-                   xml->_attributes[i]->_name,
-                   xml->_attributes[i]->_value, nodename, 
static_cast<void*>(obj) );
+//         log_msg("\t\tAdding attribute as member %s, value is %s to node %s 
(%p)\n",
+//                 xml->_attributes[i]->_name,
+//                 xml->_attributes[i]->_value, nodename, 
static_cast<void*>(obj) );
         }
         obj->set_member("attributes", attr_obj);
     }
@@ -561,11 +562,14 @@
 void
 XML::appendChild(XMLNode *node)
 {
+    GNASH_REPORT_FUNCTION;
+    
     if (!_nodes) {
       _nodes = new XMLNode;
     }
     _nodes->_children.push_back(node);
-    //    log_msg("%s: %p at _nodes at %p\n", __PRETTY_FUNCTION__, this, 
_nodes);
+//    log_msg("%s: %p at _nodes at %p\n", __PRETTY_FUNCTION__, this, _nodes);
+//    dbglogfile << node->_name << endl;
 }
 
 /// \brief copy a node
@@ -577,6 +581,7 @@
 XMLNode &
 XML::cloneNode(XMLNode &newnode, bool deep)
 {
+    GNASH_REPORT_FUNCTION;
     log_msg("%s: deep is %d\n", __PRETTY_FUNCTION__, deep);
 
     if (_nodes && deep) {
@@ -591,6 +596,7 @@
     log_msg("%s:partially unimplemented \n", __PRETTY_FUNCTION__);
 }
 
+# if 0
 /// \brief create a new XML element
 ///
 /// Method; creates a new XML element with the name specified in the
@@ -620,6 +626,7 @@
     log_msg("%s:unimplemented \n", __FUNCTION__);
     return (XMLNode*)0;
 }
+#endif
 
 /// \brief insert a node before a node
 ///
@@ -669,60 +676,81 @@
 const char *
 XML::toString()
 {
+    GNASH_REPORT_FUNCTION;
     if (_nodes) {
-       return stringify(_nodes);
+       stringstream xmlout;
+       return stringify(_nodes, &xmlout);
     }
     return NULL;
 }
 
-// 
 const char *
-XML::stringify(XMLNode *xml)
+XML::stringify(XMLNode *xml, stringstream *xmlout)
 {
-    int           child;
-    unsigned int  i;
+//    GNASH_REPORT_FUNCTION;
     const char    *nodename = xml->nodeName();
-    int           length;
-    string       str;
-    
-    log_msg("%s: processing for object %p\n", __PRETTY_FUNCTION__, 
(void*)this);
+    const char    *nodevalue = xml->nodeValue();
+//    stringstream xmlout;
+//     string str;
   
-    // Process the attributes, if any
-    if (_nodes->_attributes.size() == 0) {
-        log_msg("\t\tNo attributes for node\n");
-    } else {
-        for (i=0; i<xml->_attributes.size(); i++) {
-            log_msg("\t\tAdding attribute as member %s, value is %s to node 
%s\n",
-                    xml->_attributes[i]->_name,
-                    xml->_attributes[i]->_value, nodename);
-        }
-    }
+//    log_msg("%s: processing for object %s <%p>\n", __PRETTY_FUNCTION__, 
nodename, (void*)xml);
 
-    vector<XMLNode *>::iterator it;
-    for (it = _nodes->_children.begin(); it != _nodes->_children.end(); ++it) {
-       log_msg("Found One!!!! %p\n", (void*)*it);
+    if (nodename) {
+       *xmlout << "<" << nodename;
+//       str = "<";
+//       str += nodename;
     }
     
-    // Process the children, if there are any
-    length = xml->_children.size();
-
-    if (length) {
-        log_msg("\tProcessing %d children nodes\n", length);
-        for (child=0; child<length; child++) {
-           log_msg("Name %p\n", (void*)(xml->_children[child]));
-           if (xml->_children[child]->_name) {
-//             log_msg("Name %p", xml->_children[child]);
-           }
-           if (xml->_children[child]->_value) {
-//             log_msg("Value %s", xml->_children[child]->_value);
+    if (nodevalue) {
+       *xmlout << nodevalue;
+//     str += nodevalue;
            }
        
-//         str += stringify(xml->_children[child]);
-        }
-    } else {
-        log_msg("\tNode %s has no children\n", nodename);
-    }
-    return str.c_str();
+    // Process the attributes, if any
+    vector<XMLAttr *>::iterator ita;
+    for (ita = xml->_attributes.begin(); ita != xml->_attributes.end(); ita++) 
{
+//     log_msg("Found One child !!!! %p\n", (void*)*ita);
+//     cerr << "<" << (*it)->nodeName() << ">" << endl;
+       XMLAttr *xa = *ita;
+//     log_msg("\t\tAdding attribute as member %s, value is %s to node %s",
+//             nodename, xa->_name, xa->_value);
+       *xmlout << " " << xa->_name << "=\"" << xa->_value << "\"";
+//     str += " ";
+//     str += xa->_name;
+//     str += "=\"";
+//     str += xa->_value;
+//     str += "\"";
+    }
+    
+    if (nodename) {
+       *xmlout << ">";         // closing symbol for this tag
+//     str += ">";
+    }
+
+    int length = xml->_children.size();
+//    log_msg("\tProcessing %d children nodes for %s", length, nodename);
+    
+    vector<XMLNode *>::iterator itx;
+    for (itx = _nodes->_children.begin(); itx != _nodes->_children.end(); 
++itx) {
+//     log_msg("Found One XML child !!!! %s <%p>\n", (*itx)->nodeName(), 
(void*)*itx);
+//     cerr << "<" << (*it)->nodeName() << ">" << endl;
+       XMLNode *x = *itx;
+       *xmlout << x->toString();
+//     str +=  x->stringify(x);
+    }
+    
+    if (nodename) {
+       *xmlout << "</" << nodename << ">";
+//      str += "</";
+//      str += nodename;
+
+//      str += ">";
+    }
+
+    const char *xxx = xmlout->str().c_str();
+//    cerr << "XMLOUT XML= " << xxx << endl;
+    return xmlout->str().c_str();
+//    return str.c_str();
 }
 
 //
@@ -935,8 +963,7 @@
 getXMLInterface()
 {
        static boost::intrusive_ptr<as_object> o;
-       if ( o == NULL )
-       {
+    if ( o == NULL ) {
                o = new as_object();
                attachXMLInterface(*o);
        }
@@ -991,6 +1018,7 @@
 void
 xml_loaded(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
     as_value   method;
     as_value   val;
 
@@ -1006,6 +1034,7 @@
 
 void xml_addrequestheader(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
     log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
     XML *ptr = (XML*)fn.this_ptr;
     assert(ptr);
@@ -1016,17 +1045,26 @@
 }
 void xml_appendchild(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
   //    log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
+    if (fn.nargs > 0) {
     XML *ptr = (XML*)fn.this_ptr;
     assert(ptr);
-    XMLNode *xml_obj = (XMLNode*)fn.env->top(0).to_object();
-    
+       XMLNode *xml_obj = dynamic_cast<XMLNode*>(fn.arg(0).to_object());
+       if (xml_obj->nodeType() == XML_ELEMENT_NODE) {
     ptr->appendChild(xml_obj);
+       } else {
+           ptr->nodeValueSet(xml_obj->nodeValue());
+       }
+    } else {
+        log_msg("ERROR: no child XMLNode paramaters!\\n");
+    }
 }
 
 void xml_clonenode(const fn_call& fn)
 {
-    log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
+    GNASH_REPORT_FUNCTION;
+//    log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
     XML        *ptr = (XML*)fn.this_ptr;
     XMLNode   *xml_obj;
     assert(ptr);
@@ -1043,18 +1081,21 @@
 }
 void xml_createelement(const fn_call& fn)
 {
-  //    log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
+//    GNASH_REPORT_FUNCTION;
+    
     XML *ptr = (XML*)fn.this_ptr;
     assert(ptr);
-    XMLNode *xml_obj;
-    const char *text;
 
     if (fn.nargs > 0) {
-        text = fn.arg(0).to_string(); 
-       xml_obj = new XMLNode;
+        const char *text = fn.arg(0).to_string();
+       XMLNode *xml_obj = new XMLNode();
+//     cerr << "create new child XMLNode is at " << (void *)xml_obj << endl;
        xml_obj->nodeNameSet(text);
        xml_obj->nodeTypeSet(XML_ELEMENT_NODE); 
+//     ptr->set_member(text, xml_obj); // FIXME: use a getter/setter !
+       // no return code from this method
        fn.result->set_as_object(xml_obj);
+       
    } else {
         log_msg("ERROR: no text for element creation!\n");
     }
@@ -1063,7 +1104,7 @@
 
 void xml_createtextnode(const fn_call& fn)
 {
-       log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
+//    GNASH_REPORT_FUNCTION;
 
        //assert(dynamic_cast<XML*>(fn.this_ptr));
        //XML *ptr = static_cast<XML*>(fn.this_ptr);
@@ -1071,8 +1112,7 @@
        XMLNode *xml_obj;
        const char *text;
 
-       if (fn.nargs > 0)
-       {
+    if (fn.nargs > 0) {
                text = fn.arg(0).to_string(); 
                xml_obj = new XMLNode;
                xml_obj->nodeValueSet(text);
@@ -1100,12 +1140,14 @@
 
 void xml_haschildnodes(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
     XML *ptr = (XML*)fn.this_ptr;
     assert(ptr);
     fn.result->set_bool(ptr->hasChildNodes());
 }
 void xml_insertbefore(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
     XML *ptr = (XML*)fn.this_ptr;
     assert(ptr);
     
@@ -1115,6 +1157,7 @@
 }
 void xml_parsexml(const fn_call& fn)
 {
+//    GNASH_REPORT_FUNCTION;
     const char *text;
     as_value   method;
     as_value   val;    
@@ -1157,6 +1200,7 @@
     
 void xml_removenode(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
     XML *ptr = (XML*)fn.this_ptr;
     assert(ptr);
     
@@ -1165,6 +1209,7 @@
 }
 void xml_send(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
     XML *ptr = (XML*)fn.this_ptr;
     assert(ptr);
     
@@ -1173,6 +1218,7 @@
 }
 void xml_sendandload(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
     XML *ptr = (XML*)fn.this_ptr;
     assert(ptr);
     
@@ -1181,16 +1227,20 @@
 }
 void xml_tostring(const fn_call& fn)
 {
+//    GNASH_REPORT_FUNCTION;
     XML *ptr = (XML*)fn.this_ptr;
     assert(ptr);
     
-    fn.result->set_string(ptr->toString());
+    string str = ptr->toString();
+//     cerr << "AAAAHHHHH: " << str << endl;
+    fn.result->set_string(str.c_str());
 }
 
 // Both a getter and a setter for nodeName
 static void
 xml_nodename(const fn_call& fn)
 {
+//    GNASH_REPORT_FUNCTION;
        assert(dynamic_cast<XML*>(fn.this_ptr));
        XML *ptr = static_cast<XML*>(fn.this_ptr);
 
@@ -1210,7 +1260,7 @@
 static void
 xml_nodevalue(const fn_call& fn)
 {
-       //GNASH_REPORT_FUNCTION;
+//    GNASH_REPORT_FUNCTION;
 
        assert(dynamic_cast<XML*>(fn.this_ptr));
        XML *ptr = static_cast<XML*>(fn.this_ptr);
@@ -1234,16 +1284,14 @@
 static void
 xml_firstchild(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
        assert(dynamic_cast<XML*>(fn.this_ptr));
        XML *ptr = static_cast<XML*>(fn.this_ptr);
 
-       if ( fn.nargs == 0 )
-       {
+    if ( fn.nargs == 0 ) {
                //fn.result->set_as_object(ptr->firstChild());
                fn.result->set_as_object(ptr);
-       }
-       else
-       {
+    } else {
                IF_VERBOSE_ASCODING_ERRORS(
                        log_aserror("Tried to set read-only property 
XML.firstChild");
                );
@@ -1254,16 +1302,14 @@
 static void
 xml_childnodes(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
        assert(dynamic_cast<XML*>(fn.this_ptr));
        XML *ptr = static_cast<XML*>(fn.this_ptr);
 
-       if ( fn.nargs == 0 )
-       {
+    if ( fn.nargs == 0 ) {
                //fn.result->set_as_object(ptr->childNodes());
                fn.result->set_as_object(ptr);
-       }
-       else
-       {
+    } else {
                IF_VERBOSE_ASCODING_ERRORS(
                        log_aserror("Tried to set read-only property 
XML.childNodes");
                );
@@ -1279,16 +1325,15 @@
 // extern (used by Global.cpp)
 void xml_class_init(as_object& global)
 {
+//    GNASH_REPORT_FUNCTION;
        // This is going to be the global XML "class"/"function"
        static boost::intrusive_ptr<builtin_function> cl;
 
-       if ( cl == NULL )
-       {
+    if ( cl == NULL ) {
                cl=new builtin_function(&xml_new, getXMLInterface());
                // replicate all interface to class, to be able to access
                // all methods as static functions
                attachXMLInterface(*cl);
-                    
        }
 
        // Register _global.String

Index: server/asobj/xml.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/asobj/xml.h  18 Jan 2007 16:55:35 -0000      1.5
+++ server/asobj/xml.h  13 Feb 2007 19:36:34 -0000      1.6
@@ -28,6 +28,7 @@
 
 //#define DEBUG_MEMORY_ALLOCATION 1
 #include <vector>
+#include <sstream>
 
 #include "xmlattrs.h"
 #include "xmlnode.h"
@@ -40,17 +41,16 @@
 #include <libxml/parser.h>
 #include <libxml/xmlreader.h>
 
-// Forward declarations
-namespace gnash {
-       class fn_call;
-}
+using namespace std;
 
 namespace gnash {
   
+// Forward declarations
+class fn_call;
+
 /// XML class and ActionScript object
 class DSOLOCAL XML : public as_object
 {
-
 public:
 
     XML();
@@ -92,7 +92,7 @@
   
   std::vector<XMLNode *> childNodes();
   
-    const char *stringify(XMLNode *xml);
+    const char *stringify(XMLNode *xml, std::stringstream *str);
     //  Returns true if the specified node has child nodes; otherwise, returns 
false.
   bool hasChildNodes() {
     if (_nodes) {

Index: server/asobj/xmlnode.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xmlnode.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/asobj/xmlnode.cpp    5 Feb 2007 07:18:30 -0000       1.9
+++ server/asobj/xmlnode.cpp    13 Feb 2007 19:36:34 -0000      1.10
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 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
@@ -14,11 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-// 
-//
-//
-
-/* $Id: xmlnode.cpp,v 1.9 2007/02/05 07:18:30 zoulunkai Exp $ */
+/* $Id: xmlnode.cpp,v 1.10 2007/02/13 19:36:34 rsavoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -27,6 +23,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <vector>
+#include "log.h"
 #include "tu_config.h"
 #include "fn_call.h"
 #include "builtin_function.h"
@@ -36,10 +33,12 @@
 #include "xmlnode.h"
 
 #ifdef DEBUG_MEMORY_ALLOCATION
-       #include "log.h"
+#include "log.h"
 #endif
 
 #include <unistd.h>
+#include <string>
+#include <sstream>
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
@@ -67,6 +66,8 @@
 static void xmlnode_previoussibling(const fn_call& fn);
 static as_object* getXMLNodeInterface();
 
+static LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+
 
 //std::vector<as_object *> _xmlobjs;    // FIXME: hack alert
 
@@ -211,6 +212,7 @@
 void
 XMLNode::appendChild(XMLNode *node)
 {
+//    GNASH_REPORT_FUNCTION;
 //     log_msg("%s: %p, as is %d, node is %d\n",
 //         __PRETTY_FUNCTION__, this, _children.size(), _children.size());
 //
@@ -231,6 +233,7 @@
 XMLNode &
 XMLNode::cloneNode(XMLNode &newnode, bool deep)
 {
+    GNASH_REPORT_FUNCTION;
     log_msg("%s: deep is %d\n", __PRETTY_FUNCTION__, deep);
 
     if (deep) {
@@ -264,30 +267,11 @@
 {
     log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
 }
-const char *
-XMLNode::toString()
-{
-    XMLNode *node;
-    
-    vector<XMLNode *>::const_iterator it;
-    for (it = _children.begin(); it != _children.end(); it++) {
-       node = *it;
-//     log_msg("Got something\n");
-       if (node->_name) {
-           log_msg("Node name is %s", node->_name);
-       }
-       if (node->_value) {
-           log_msg("Node value is %s", node->_name);
-       }       
-    }
-    
-    log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
-    return "Hello World!";
-}
 
 XMLNode *
 XMLNode::previousSibling(int x)
 {
+//    GNASH_REPORT_FUNCTION;
     log_msg("%s: partially implemented. " SIZET_FMT " objects\n",
            __PRETTY_FUNCTION__,  _children.size());
     if (_children.size() > 0) {
@@ -300,6 +284,7 @@
 XMLNode *
 XMLNode::nextSibling(int x)
 {
+    GNASH_REPORT_FUNCTION;
     log_msg("%s: unimplemented \n", __PRETTY_FUNCTION__);
     if (x < (int) _children.size()) {
        return _children[x];
@@ -307,6 +292,61 @@
     return NULL;
 }
 
+const char *
+XMLNode::toString()
+{
+//    GNASH_REPORT_FUNCTION;
+    stringstream xmlout;
+    return stringify(this, &xmlout);
+}
+
+const char *
+XMLNode::stringify(XMLNode *xml, stringstream *xmlout)
+{
+//    GNASH_REPORT_FUNCTION;
+    int           child;
+    const char    *nodevalue = xml->nodeValue();
+    const char    *nodename = xml->nodeName();
+    
+//    log_msg("%s: processing for object %s <%p>\n", __PRETTY_FUNCTION__, 
nodename, xml);
+
+    // Create the beginning of the tag
+    *xmlout << "<" << nodename;
+    
+    // Process the attributes, if any
+    vector<XMLAttr *>::iterator ita;
+    for (ita = xml->_attributes.begin(); ita != xml->_attributes.end(); ita++) 
{
+       XMLAttr *xa = *ita;
+//     log_msg("\t\tAdding attribute as member %s, value is %s to node %s",
+//             nodename, xa->_name, xa->_value);
+       *xmlout << " " << xa->_name << "=\"" << xa->_value << "\"";
+    }
+
+    *xmlout << ">";            // closing symbol for this tag
+    
+    if (nodevalue) {
+       *xmlout << nodevalue;
+       *xmlout << "</" << nodename << ">";
+    }
+
+    int length = xml->_children.size();
+//    log_msg("\tProcessing %d children nodes for %s", length, nodename);
+    
+    vector<XMLNode *>::iterator itx;
+    for (itx = xml->_children.begin(); itx != xml->_children.end(); itx++) {
+//     log_msg("Found One XMLNode child !!!! %s <%p>\n", (*itx)->nodeName(), 
(void*)*itx);
+//     cerr << "<" << (*it)->nodeName() << ">" << endl;
+       XMLNode *x = *itx;
+       *xmlout << x->toString();
+    }
+
+    if (!nodevalue) {
+       *xmlout << "</" << nodename << ">";
+    }
+
+    return xmlout->str().c_str();;
+}
+
 void
 attachXMLNodeInterface(as_object& o)
 {
@@ -338,7 +378,7 @@
     /// \brief XMLNode::firstChild property
     ///
     /// Read-only property; evaluates the specified XML object and
-    /// references the first child in the parent node\ufffds child
+    /// references the first child in the parent node's child
     /// list. This property is null if the node does not have
     /// children. This property is undefined if the node is a text
     /// node. This is a read-only property and cannot be used to
@@ -373,8 +413,7 @@
 getXMLNodeInterface()
 {
        static boost::intrusive_ptr<as_object> o;
-       if ( o == NULL )
-       {
+    if ( o == NULL ) {
                o = new as_object();
                attachXMLNodeInterface(*o);
        }
@@ -384,16 +423,13 @@
 static void
 xmlnode_new(const fn_call& fn)
 {
-       XMLNode *xml_obj;
+//    GNASH_REPORT_FUNCTION;
   
-       xml_obj = new XMLNode;
-
-       if ( fn.nargs > 0 )
-       {
+    XMLNode *xml_obj = new XMLNode;
+    if ( fn.nargs > 0 )        {
                xml_obj->nodeTypeSet(static_cast<xmlElementType>(
                                static_cast<int>(fn.arg(0).to_number())));
-               if ( fn.nargs > 1 )
-               {
+       if (fn.nargs > 1)       {
                        xml_obj->nodeValueSet(fn.arg(1).to_string());
                }
        }
@@ -404,34 +440,41 @@
 static void
 xmlnode_appendchild(const fn_call& fn)
 {
+//    GNASH_REPORT_FUNCTION;
+    if (fn.nargs > 0) {
     XMLNode *ptr = (XMLNode*)fn.this_ptr;
     assert(ptr);
 //    log_msg("%s: %p, %d args\n", __PRETTY_FUNCTION__, ptr, fn.nargs);
     
-    XMLNode *node = dynamic_cast<XMLNode*>(fn.arg(0).to_object());
+       XMLNode *xml_obj = dynamic_cast<XMLNode*>(fn.arg(0).to_object());       
+       if (xml_obj->nodeType() == XML_ELEMENT_NODE) {
+           ptr->appendChild(xml_obj);
+       } else {
+           ptr->nodeValueSet(xml_obj->nodeValue());
+       }
     
 //    log_msg("%s: %p \n", __PRETTY_FUNCTION__, xml_obj);
     int length = ptr->length();
     if (length > 0) {
-       XMLNode *ass = node->previousSibling(length); // or is it 'ptr' ??
+           XMLNode *ass = xml_obj->previousSibling(length); // or is it 'ptr' 
??
 // FIXME: This shouldn't always be NULL
 //     log_msg("%s: ASS is %p, length is %d\n", __PRETTY_FUNCTION__,
 //             ass, length);
        ptr->set_member("previousSibling", ass); // FIXME: don't do this, rely 
on getter/setter
 //     ptr->set_member("nextSibling", 
xml_obj->obj.nextSibling(ptr->obj.length()));
     }
-    ptr->appendChild(node);
     // The last child in the list is always the one we just appended
-    ptr->set_member("lastChild", node); // FIXME: don't do this, rely on 
getter/setter
-   
-//    ptr->obj.appendChild(&(xml_obj->obj));
-//    ptr->obj.nodeValueSet((char *)xmlnode_obj->obj.nodeValue());
+       ptr->set_member("lastChild", xml_obj); // FIXME: don't do this, rely on 
getter/setter
+    } else {
+        log_msg("ERROR: no child XMLNode paramaters!\\n");
+    }
 }
 
 static void
 xmlnode_clonenode(const fn_call& fn)
 {
-    log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
+    GNASH_REPORT_FUNCTION;
+//    log_msg("%s: %d args\n", __PRETTY_FUNCTION__, fn.nargs);
     XMLNode    *ptr = (XMLNode*)fn.this_ptr;
     XMLNode   *xmlnode_obj;
     assert(ptr);
@@ -450,6 +493,7 @@
 static void
 xmlnode_insertbefore(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
     XMLNode *ptr = (XMLNode*)fn.this_ptr;
     assert(ptr);
     
@@ -460,6 +504,7 @@
 static void
 xmlnode_removenode(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
     XMLNode *ptr = (XMLNode*)fn.this_ptr;
     assert(ptr);
     
@@ -471,6 +516,8 @@
 static void
 xmlnode_tostring(const fn_call& fn)
 {
+//    GNASH_REPORT_FUNCTION;
+    
     XMLNode *ptr = (XMLNode*)fn.this_ptr;
     assert(ptr);
     
@@ -535,12 +582,9 @@
        assert(dynamic_cast<XMLNode*>(fn.this_ptr));
        XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
 
-       if ( fn.nargs == 0 )
-       {
+    if ( fn.nargs == 0 ) {
                fn.result->set_double(ptr->nodeType());
-       }
-       else
-       {
+    } else {
                IF_VERBOSE_ASCODING_ERRORS(
                        log_aserror("Tried to set read-only property 
XMLNode.nodeType");
                );
@@ -554,12 +598,9 @@
        assert(dynamic_cast<XMLNode*>(fn.this_ptr));
        XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
 
-       if ( fn.nargs == 0 )
-       {
+    if ( fn.nargs == 0 ) {
                fn.result->set_as_object(ptr->firstChild());
-       }
-       else
-       {
+    } else {
                IF_VERBOSE_ASCODING_ERRORS(
                        log_aserror("Tried to set read-only property 
XMLNode.firstChild");
                );
@@ -573,12 +614,9 @@
        assert(dynamic_cast<XMLNode*>(fn.this_ptr));
        XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
 
-       if ( fn.nargs == 0 )
-       {
+    if ( fn.nargs == 0 ) {
                fn.result->set_as_object(ptr->lastChild());
-       }
-       else
-       {
+    } else {
                IF_VERBOSE_ASCODING_ERRORS(
                        log_aserror("Tried to set read-only property 
XMLNode.lastChild");
                );
@@ -592,14 +630,11 @@
        assert(dynamic_cast<XMLNode*>(fn.this_ptr));
        XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
 
-       if ( fn.nargs == 0 )
-       {
+    if ( fn.nargs == 0 ) {
                log_error("FIXME: XMLNode.nextSibling unimplemented");
                //fn.result->set_as_object(ptr->nextSibling());
                fn.result->set_null();
-       }
-       else
-       {
+    } else {
                IF_VERBOSE_ASCODING_ERRORS(
                        log_aserror("Tried to set read-only property 
XMLNode.nextSibling");
                );
@@ -613,14 +648,11 @@
        assert(dynamic_cast<XMLNode*>(fn.this_ptr));
        XMLNode *ptr = static_cast<XMLNode*>(fn.this_ptr);
 
-       if ( fn.nargs == 0 )
-       {
+    if ( fn.nargs == 0 ) {
                log_error("FIXME: XMLNode.previousSibling unimplemented");
                //fn.result->set_as_object(ptr->previousSibling());
                fn.result->set_null();
-       }
-       else
-       {
+    } else {
                IF_VERBOSE_ASCODING_ERRORS(
                        log_aserror("Tried to set read-only property 
XMLNode.previousSibling");
                );
@@ -633,13 +665,11 @@
        // This is going to be the global XMLNode "class"/"function"
        static boost::intrusive_ptr<builtin_function> cl;
 
-       if ( cl == NULL )
-       {
+    if ( cl == NULL ) {
                cl=new builtin_function(&xmlnode_new, getXMLNodeInterface());
                // replicate all interface to class, to be able to access
                // all methods as static functions
                attachXMLNodeInterface(*cl);
-                    
        }
 
        // Register _global.String

Index: server/asobj/xmlnode.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xmlnode.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/asobj/xmlnode.h      18 Jan 2007 15:30:53 -0000      1.5
+++ server/asobj/xmlnode.h      13 Feb 2007 19:36:34 -0000      1.6
@@ -29,6 +29,9 @@
 
 //#define DEBUG_MEMORY_ALLOCATION 1
 #include <vector>
+#include <string>
+#include <sstream>
+
 #include "action.h"
 #include "impl.h"
 
@@ -50,7 +53,6 @@
 public:
     XMLNode();
     ~XMLNode();
-    
     int length()                 { return _children.size(); }
     const char *nodeName();
     const char *nodeValue();
@@ -71,6 +73,7 @@
     void nodeValueSet(const char *value);
     //  nodeType       XML.nodeType
 
+    const char *stringify(XMLNode *xml, std::stringstream *xmlout);
     bool hasChildNodes()
     {
            return ! _children.empty();

Index: server/asobj/xmlsocket.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xmlsocket.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/asobj/xmlsocket.cpp  9 Feb 2007 13:38:50 -0000       1.5
+++ server/asobj/xmlsocket.cpp  13 Feb 2007 19:36:34 -0000      1.6
@@ -63,8 +63,9 @@
   
 const int INBUF = 10000;
   
-XMLSocket::XMLSocket() {
-  //log_msg("%s: \n", __FUNCTION__);
+XMLSocket::XMLSocket()
+{
+//    GNASH_REPORT_FUNCTION;
   _data = false;
   _xmldata = false;
   _closed = false;
@@ -77,130 +78,14 @@
 
 XMLSocket::~XMLSocket()
 {
-  //log_msg("%s: \n", __FUNCTION__);
+//    GNASH_REPORT_FUNCTION;
 }
 
 bool
-XMLSocket::connect(const char *host, int port)
+XMLSocket::connect(const char *host, short port)
 {
-  struct sockaddr_in  sock_in;
-  fd_set              fdset;
-  struct timeval      tval;
-  int                 ret;
-  int                 retries;
-  char                thishostname[MAXHOSTNAMELEN];
-  struct protoent     *proto;
-
-  if (port < 1024) {
-    log_error("Can't connect to priviledged port #%d!\n", port);
-    _connect = false;
-    return false;
-  }
-
-  log_msg("%s: to host %s at port %d\n", __FUNCTION__, host, port);
-  
-  memset(&sock_in, 0, sizeof(struct sockaddr_in));
-  memset(&thishostname, 0, MAXHOSTNAMELEN);
-  if (strlen(host) == 0) {
-    if (gethostname(thishostname, MAXHOSTNAMELEN) == 0) {
-      log_msg("The hostname for this machine is %s.\n", thishostname);
-    } else {
-      log_msg("Couldn't get the hostname for this machine!\n");
-      return false;
-    }   
-  }
-  const struct hostent *hent = ::gethostbyname(host);
-  if (hent > 0) {
-    ::memcpy(&sock_in.sin_addr, hent->h_addr, hent->h_length);
-  }
-  sock_in.sin_family = AF_INET;
-  sock_in.sin_port = ntohs(static_cast<short>(port));
-
-#if 0
-    char ascip[32];
-    inet_ntop(AF_INET, &sock_in.sin_addr.s_addr, ascip, INET_ADDRSTRLEN);
-      log_msg("The IP address for this client socket is %s\n", ascip);
-#endif
-
-  proto = ::getprotobyname("TCP");
-
-  _sockfd = ::socket(PF_INET, SOCK_STREAM, proto->p_proto);
-  if (_sockfd < 0)
-    {
-      log_error("unable to create socket : %s\n", strerror(errno));
-      _sockfd = -1;
-      return false;
-    }
-
-  retries = 2;
-  while (retries-- > 0) {
-    // We use select to wait for the read file descriptor to be
-    // active, which means there is a client waiting to connect.
-    FD_ZERO(&fdset);
-    FD_SET(_sockfd, &fdset);
-    
-    // Reset the timeout value, since select modifies it on return. To
-    // block, set the timeout to zero.
-    tval.tv_sec = 5;
-    tval.tv_usec = 0;
-    
-    ret = ::select(_sockfd+1, &fdset, NULL, NULL, &tval);
-
-    // If interupted by a system call, try again
-    if (ret == -1 && errno == EINTR)
-      {
-        log_msg("The connect() socket for fd #%d was interupted by a system 
call!\n",
-                _sockfd);
-        continue;
-      }
-    
-    if (ret == -1)
-      {
-        log_msg("The connect() socket for fd #%d never was available for 
writing!\n",
-                _sockfd);
-#ifdef HAVE_WINSOCK
-        ::shutdown(_sockfd, SHUT_BOTH);
-#else
-        ::shutdown(_sockfd, SHUT_RDWR);
-#endif
-        _sockfd = -1;      
-        return false;
-      }
-    if (ret == 0) {
-      log_error("The connect() socket for fd #%d timed out waiting to 
write!\n",
-                _sockfd);
-      continue;
-    }
-
-    if (ret > 0) {
-      ret = ::connect(_sockfd, reinterpret_cast<struct sockaddr *>(&sock_in), 
sizeof(sock_in));
-      if (ret == 0) {
-        log_msg("\tport %d at IP %s for fd #%d\n", port,
-                ::inet_ntoa(sock_in.sin_addr), _sockfd);
-        _connect = true;
-        xml_fd = _sockfd;               // FIXME: This file descriptor is used 
by
-                                        // XML::checkSocket() when called from
-                                        // the main processing loop.
-        return true;
-      }
-      if (ret == -1) {
-        log_msg("The connect() socket for fd #%d never was available for 
writing!\n",
-                _sockfd);
-        _sockfd = -1;      
-        return false;
-      }
-    }
-  }
-  //  ::close(_sockfd);
-  //  return false;
-
-  printf("\tConnected at port %d on IP %s for fd #%d\n", port,
-          ::inet_ntoa(sock_in.sin_addr), _sockfd);
-  
-#ifndef HAVE_WINSOCK
-  fcntl(_sockfd, F_SETFL, O_NONBLOCK);
-#endif
-
+    GNASH_REPORT_FUNCTION;
+    createClient(host, port);
   _connect = true;
   return true;
 }
@@ -208,7 +93,7 @@
 void
 XMLSocket::close()
 {
-  log_msg("%s: \n", __FUNCTION__);
+    GNASH_REPORT_FUNCTION;
   // Since the return code from close() doesn't get used by Shockwave,
   // we don't care either.
   if (_sockfd > 0) {
@@ -220,18 +105,20 @@
 bool
 XMLSocket::anydata(char **msgs)
 {
-  //printf("%s: \n", __FUNCTION__);
+    GNASH_REPORT_FUNCTION;
   return anydata(_sockfd, msgs);
 }
 
 bool XMLSocket::processingData()
 {
+    GNASH_REPORT_FUNCTION;
   //printf("%s: processing flags is is %d\n", __FUNCTION__, _processing);
   return _processing;
 }
 
 void XMLSocket::processing(bool x)
 {
+    GNASH_REPORT_FUNCTION;
   //printf("%s: set processing flag to %d\n", __FUNCTION__, x);
   _processing = x;
 }
@@ -392,38 +279,39 @@
 void
 XMLSocket::onClose(std::string /* str */)
 {
-  log_msg("%s: \n", __FUNCTION__);
+    GNASH_REPORT_FUNCTION;
 }
 
 void
 XMLSocket::onConnect(std::string /* str */)
 {
-  log_msg("%s: \n", __FUNCTION__);
+    GNASH_REPORT_FUNCTION;
 }
 
 void
 XMLSocket::onData(std::string /* str */)
 {
-  log_msg("%s: \n", __FUNCTION__);
+    GNASH_REPORT_FUNCTION;
 }
 
 void
 XMLSocket::onXML(std::string /* str */)
 {
-  log_msg("%s: \n", __FUNCTION__);
+    GNASH_REPORT_FUNCTION;
 }
 
 void
 XMLSocket::push(as_object *obj)
 {
+    GNASH_REPORT_FUNCTION;
   _nodes.push_back(obj);
 }
 
 void
 XMLSocket::clear()
 {
-  unsigned int i;
-  for (i=0; i< _nodes.size(); i++) {
+    GNASH_REPORT_FUNCTION;
+    for (unsigned int i=0; i< _nodes.size(); i++) {
     delete _nodes[i];
   }
 }
@@ -431,23 +319,25 @@
 int
 XMLSocket::count()
 {
+    GNASH_REPORT_FUNCTION;
   return _nodes.size();
 }
 
 int
 XMLSocket::checkSockets(void)
 {
+    GNASH_REPORT_FUNCTION;
   return checkSockets(_sockfd);
 }
 
 int
 XMLSocket::checkSockets(int fd)
 {
+    GNASH_REPORT_FUNCTION;
   fd_set                fdset;
   int                   ret = 0;
   struct timeval        tval;
 
-  //log_msg("%s:\n", __FUNCTION__);
 
   FD_ZERO(&fdset);
   FD_SET(fd, &fdset);
@@ -478,6 +368,7 @@
 void
 xmlsocket_connect(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
   as_value     method;
   as_value     val;
   static bool first = true;     // This event handler should only be executed 
once.
@@ -545,6 +436,7 @@
 void
 xmlsocket_send(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
   as_value     method;
   as_value     val;
   
@@ -558,6 +450,7 @@
 void
 xmlsocket_close(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
   as_value     method;
   as_value     val;
   
@@ -571,6 +464,7 @@
 void
 xmlsocket_xml_new(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
   //log_msg("%s: nargs=%d\n", __FUNCTION__, nargs);
   
   xml_new(fn);
@@ -579,6 +473,7 @@
 void
 xmlsocket_new(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
   //log_msg("%s: nargs=%d\n", __FUNCTION__, nargs);
   
   as_object*   xmlsock_obj = new xmlsocket_as_object;
@@ -639,7 +534,7 @@
 void
 xmlsocket_event_ondata(const fn_call& fn)
 {
-  //log_msg("%s: nargs is %d\n", __FUNCTION__, nargs);
+    GNASH_REPORT_FUNCTION;
     
   as_value     method;
   as_value     val;
@@ -734,6 +629,7 @@
 void
 xmlsocket_event_connect(const fn_call& fn)
 {
+    GNASH_REPORT_FUNCTION;
   as_value     method;
   as_value     val;
   static bool first = true;     // This event handler should only be executed 
once.
@@ -780,6 +676,7 @@
 void
 xmlsocket_event_xml(const fn_call& /* fn */)
 {
+    GNASH_REPORT_FUNCTION;
 #if 0
   as_value* result = fn.result;
   as_object* this_ptr = fn.this_ptr;
@@ -795,6 +692,7 @@
 int
 check_sockets(int x)
 {
+    GNASH_REPORT_FUNCTION;
   if (xml_fd == 0) {
     return -1;
   }
@@ -802,5 +700,9 @@
   return xs.checkSockets(x);
 }
 
-} // end of gnaash namespace
+} // end of gnash namespace
 
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: server/asobj/xmlsocket.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xmlsocket.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/asobj/xmlsocket.h    30 Jan 2007 02:02:29 -0000      1.3
+++ server/asobj/xmlsocket.h    13 Feb 2007 19:36:34 -0000      1.4
@@ -24,6 +24,7 @@
 #include "tu_config.h"
 #include "xml.h"
 #include "impl.h"
+#include "network.h"
 
 #include <string>
 
@@ -31,16 +32,15 @@
 
 extern const int SOCKET_DATA;
   
-class DSOLOCAL XMLSocket {
- public:
+class DSOLOCAL XMLSocket : public Network {
+public:
   XMLSocket();
   ~XMLSocket();
   
-  bool connect(const char *host, int port);
+    bool connect(const char *host, short port);
   bool send(std::string str);
   void close();
 
-  
   bool anydata(char **msgs);
   bool anydata(int sockfd, char **msgs);
   bool connected() { return _connect; };
@@ -69,7 +69,7 @@
   int checkSockets(void);
   int checkSockets(int x);
 
- private:
+private:
   std::string  _host;
   short         _port;
   int           _sockfd;
@@ -109,3 +109,7 @@
 // __XMLSOCKETSOCKET_H__
 #endif
 
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/vm/ActionExec.cpp    10 Feb 2007 01:30:32 -0000      1.18
+++ server/vm/ActionExec.cpp    13 Feb 2007 19:36:34 -0000      1.19
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: ActionExec.cpp,v 1.18 2007/02/10 01:30:32 rsavoye Exp $ */
+/* $Id: ActionExec.cpp,v 1.19 2007/02/13 19:36:34 rsavoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -47,7 +47,7 @@
 // too much information for my tastes. I really want just
 // to see how stack changes while executing actions...
 // --strk Fri Jun 30 02:28:46 CEST 2006
-// #define DEBUG_STACK 1
+#define DEBUG_STACK 1
 #endif
 
 using namespace gnash;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]