gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9640: Stub unimplemented XMLNode fu


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9640: Stub unimplemented XMLNode functions.
Date: Mon, 25 Aug 2008 13:13:06 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9640
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2008-08-25 13:13:06 +0200
message:
  Stub unimplemented XMLNode functions.
modified:
  libcore/asobj/NetConnection.cpp
  libcore/asobj/NetStream.cpp
  libcore/asobj/Sound.cpp
  libcore/asobj/System.cpp
  libcore/asobj/xmlnode.cpp
  libcore/sprite_instance.cpp
  testsuite/actionscript.all/XMLNode.as
    ------------------------------------------------------------
    revno: 9638.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Mon 2008-08-25 12:16:16 +0200
    message:
      Make attachInterface code a bit more readable.
      
      Stub missing XMLNode members.
    modified:
      libcore/asobj/NetConnection.cpp
      libcore/asobj/NetStream.cpp
      libcore/asobj/Sound.cpp
      libcore/asobj/System.cpp
      libcore/asobj/xmlnode.cpp
      libcore/sprite_instance.cpp
      testsuite/actionscript.all/XMLNode.as
=== modified file 'libcore/asobj/NetConnection.cpp'
--- a/libcore/asobj/NetConnection.cpp   2008-08-18 23:53:04 +0000
+++ b/libcore/asobj/NetConnection.cpp   2008-08-25 10:16:16 +0000
@@ -992,14 +992,8 @@
 void
 NetConnection::attachProperties()
 {
-       as_c_function_ptr gettersetter;
-
-       gettersetter = NetConnection::isConnected_getset;
-       init_property("isConnected", *gettersetter, *gettersetter);
-
-       gettersetter = NetConnection::uri_getset;
-       init_property("uri", *gettersetter, *gettersetter);
-
+       init_property("isConnected", &NetConnection::isConnected_getset, 
&NetConnection::isConnected_getset);
+       init_property("uri", &NetConnection::uri_getset, 
&NetConnection::uri_getset);
 }
 
 as_object*

=== modified file 'libcore/asobj/NetStream.cpp'
--- a/libcore/asobj/NetStream.cpp       2008-08-18 23:53:04 +0000
+++ b/libcore/asobj/NetStream.cpp       2008-08-25 10:16:16 +0000
@@ -413,28 +413,13 @@
        // Properties
        // TODO: attach to each instance rather then to the class ? check it ..
 
-       as_c_function_ptr gettersetter;
-
-       gettersetter = &netstream_time;
-       o.init_readonly_property("time", *gettersetter);
-
-       gettersetter = &netstream_bytesloaded;
-       o.init_readonly_property("bytesLoaded", *gettersetter);
-
-       gettersetter = &netstream_bytestotal;
-       o.init_readonly_property("bytesTotal", *gettersetter);
-
-       gettersetter = &netstream_currentFPS;
-       o.init_readonly_property("currentFps", *gettersetter);
-
-       gettersetter = &netstream_bufferLength;
-       o.init_readonly_property("bufferLength", *gettersetter);
-
-       gettersetter = &netstream_bufferTime;
-       o.init_readonly_property("bufferTime", *gettersetter);
-
-       gettersetter = &netstream_liveDelay;
-       o.init_readonly_property("liveDelay", *gettersetter);
+       o.init_readonly_property("time", &netstream_time);
+       o.init_readonly_property("bytesLoaded", &netstream_bytesloaded);
+       o.init_readonly_property("bytesTotal", &netstream_bytestotal);
+       o.init_readonly_property("currentFps", &netstream_currentFPS);
+       o.init_readonly_property("bufferLength", &netstream_bufferLength);
+       o.init_readonly_property("bufferTime", &netstream_bufferTime);
+       o.init_readonly_property("liveDelay", &netstream_liveDelay);
 
 }
 

=== modified file 'libcore/asobj/Sound.cpp'
--- a/libcore/asobj/Sound.cpp   2008-06-19 16:45:06 +0000
+++ b/libcore/asobj/Sound.cpp   2008-08-25 10:16:16 +0000
@@ -685,22 +685,12 @@
        o.init_member("areSoundsInaccessible", new 
builtin_function(sound_areSoundsInaccessible), fl_hpcn9);
 
        // Properties
-
-       as_c_function_ptr gettersetter;
-
-       gettersetter = &sound_duration;
-       o.init_readonly_property("duration", *gettersetter);
-
        //there's no such thing as an ID3 member (swfdec shows)
-       //gettersetter = &sound_ID3;
-       //o.init_property("ID3", *gettersetter, *gettersetter);
+       o.init_readonly_property("duration", &sound_duration);
+       o.init_readonly_property("position", &sound_position);
 
-       gettersetter = &checkPolicyFile_getset;
        int fl_hp = as_prop_flags::dontEnum|as_prop_flags::dontDelete;
-       o.init_property("checkPolicyFile", *gettersetter, *gettersetter, fl_hp);
-
-       gettersetter = &sound_position;
-       o.init_readonly_property("position", *gettersetter);
+       o.init_property("checkPolicyFile", &checkPolicyFile_getset, 
&checkPolicyFile_getset, fl_hp);
 
 }
 

=== modified file 'libcore/asobj/System.cpp'
--- a/libcore/asobj/System.cpp  2008-06-16 15:24:02 +0000
+++ b/libcore/asobj/System.cpp  2008-08-25 10:16:16 +0000
@@ -275,24 +275,19 @@
 attachSystemInterface(as_object& proto)
 {
        VM& vm = proto.getVM();
+    const int version = vm.getSWFVersion();
 
-       // Initialize Function prototype
        proto.init_member("security", getSystemSecurityInterface(proto));
        proto.init_member("capabilities", 
getSystemCapabilitiesInterface(proto));
        proto.init_member("setClipboard", new 
builtin_function(system_setclipboard));
        proto.init_member("showSettings", vm.getNative(2107, 0));
 
-    const int version = vm.getSWFVersion();
-
-       as_c_function_ptr gettersetter;
-    
-    if (version > 5) {
-           gettersetter = &system_exactsettings;
-           proto.init_property("exactSettings", *gettersetter, *gettersetter);
-       }
-
-       gettersetter = &system_usecodepage;
-       proto.init_property("useCodepage", *gettersetter, *gettersetter);
+       proto.init_property("useCodepage", &system_usecodepage, 
&system_usecodepage);
+
+    if (version < 6) return;
+
+    proto.init_property("exactSettings", &system_exactsettings, 
&system_exactsettings);
+
 }
 
 

=== modified file 'libcore/asobj/xmlnode.cpp'
--- a/libcore/asobj/xmlnode.cpp 2008-04-21 10:27:41 +0000
+++ b/libcore/asobj/xmlnode.cpp 2008-08-25 10:16:16 +0000
@@ -63,6 +63,12 @@
 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();
 
 //static LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
@@ -357,38 +363,23 @@
     o.init_member("insertBefore", new builtin_function(xmlnode_insertbefore));
     o.init_member("removeNode", new builtin_function(xmlnode_removenode));
     o.init_member("toString", new builtin_function(xmlnode_tostring));
-
-    as_c_function_ptr gettersetter;
-
-    gettersetter = &xmlnode_nodevalue;
-    o.init_property("nodeValue", *gettersetter, *gettersetter);
-
-    gettersetter = &xmlnode_nodename;
-    o.init_property("nodeName", *gettersetter, *gettersetter);
-
-    gettersetter = &xmlnode_nodetype;
-    o.init_readonly_property("nodeType", *gettersetter);
-
-    gettersetter = &xmlnode_attributes;
-    o.init_readonly_property("attributes", *gettersetter);
-
-    gettersetter = xmlnode_childNodes;
-    o.init_readonly_property("childNodes", *gettersetter);
-
-    gettersetter = &xmlnode_firstchild;
-    o.init_readonly_property("firstChild", *gettersetter);
-
-    gettersetter = &xmlnode_lastchild;
-    o.init_readonly_property("lastChild", *gettersetter);
-
-    gettersetter = &xmlnode_nextsibling;
-    o.init_readonly_property("nextSibling", *gettersetter);
-
-    gettersetter = &xmlnode_previoussibling;
-    o.init_readonly_property("previousSibling", *gettersetter);
-
-    gettersetter = &xmlnode_parentNode;
-    o.init_readonly_property("parentNode", *gettersetter);
+    o.init_member("getPrefixForNamespace", new 
builtin_function(xmlnode_getPrefixForNamespace));
+    o.init_member("getNamespaceForPrefix", new 
builtin_function(xmlnode_getNamespaceForPrefix));
+
+    o.init_property("nodeValue", &xmlnode_nodevalue, &xmlnode_nodevalue);
+    o.init_property("nodeName", &xmlnode_nodename, &xmlnode_nodename);
+
+    o.init_readonly_property("namespaceURI", &xmlnode_namespaceURI);
+    o.init_readonly_property("localName", &xmlnode_localName);
+    o.init_readonly_property("prefix", &xmlnode_prefix);
+    o.init_readonly_property("nodeType", &xmlnode_nodetype);
+    o.init_readonly_property("attributes", &xmlnode_attributes);
+    o.init_readonly_property("childNodes", &xmlnode_childNodes);
+    o.init_readonly_property("firstChild", &xmlnode_firstchild);
+    o.init_readonly_property("lastChild", &xmlnode_lastchild);
+    o.init_readonly_property("nextSibling", &xmlnode_nextsibling);
+    o.init_readonly_property("previousSibling", &xmlnode_previoussibling);
+    o.init_readonly_property("parentNode", &xmlnode_parentNode);
 
 }
 
@@ -511,18 +502,100 @@
     return as_value();
 }
 
-static as_value
+
+as_value
+xmlnode_getNamespaceForPrefix(const fn_call& fn)
+{
+    boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
+    log_unimpl("XMLNode.getNamespaceForPrefix");
+    return as_value();
+}
+
+
+as_value
+xmlnode_getPrefixForNamespace(const fn_call& fn)
+{
+    boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
+    log_unimpl("XMLNode.getPrefixForNamespace");
+    return as_value();
+}
+
+
+as_value
+xmlnode_namespaceURI(const fn_call& fn)
+{
+    boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
+
+    if (fn.nargs > 0)
+    {
+        // no setter
+        IF_VERBOSE_ASCODING_ERRORS(
+            log_aserror("XMLNode.namespaceURI is readonly!");
+        );
+        
+        return as_value();
+    }
+    
+    // TODO: implement getter
+    log_unimpl("XMLNode.namespaceURI");
+    return as_value();
+}
+
+
+as_value
+xmlnode_prefix(const fn_call& fn)
+{
+    boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
+
+    if (fn.nargs > 0)
+    {
+        // no setter
+        IF_VERBOSE_ASCODING_ERRORS(
+            log_aserror("XMLNode.prefix is readonly!");
+        );
+        
+        return as_value();
+    }
+    
+    // TODO: implement getter
+    log_unimpl("XMLNode.prefix");
+    return as_value();
+}
+
+
+as_value
+xmlnode_localName(const fn_call& fn)
+{
+    boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
+
+    if (fn.nargs > 0)
+    {
+        // no setter
+        IF_VERBOSE_ASCODING_ERRORS(
+            log_aserror("XMLNode.localName is readonly!");
+        );
+        
+        return as_value();
+    }
+    
+    // TODO: implement getter
+    log_unimpl("XMLNode.localName");
+    return as_value();
+}
+
+
+as_value
 xmlnode_removenode(const fn_call& fn)
 {
-    //GNASH_REPORT_FUNCTION;
     boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
     
     ptr->removeNode();
     return as_value();
 }
 
+
 // TODO: shouldn't overriding get_text_value() be fine ?
-static as_value
+as_value
 xmlnode_tostring(const fn_call& fn)
 {
     //GNASH_REPORT_FUNCTION;
@@ -536,20 +609,16 @@
     return as_value(ss.str());
 }
 
-static as_value
+as_value
 xmlnode_haschildnodes(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
     boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
     return as_value(ptr->hasChildNodes());
 }
 
-// Both a getter and a setter for nodeValue
-static as_value
+as_value
 xmlnode_nodevalue(const fn_call& fn)
 {
-    //GNASH_REPORT_FUNCTION;
-
     boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
     as_value rv;
     rv.set_null();
@@ -568,11 +637,9 @@
     return rv;
 }
 
-// Both a getter and a setter for nodeName
-static as_value
+as_value
 xmlnode_nodename(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
     boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
     as_value rv;
     rv.set_null();
@@ -588,22 +655,17 @@
     return rv;
 }
 
-// Both a getter and a (do-nothing) setter for nodeType
-static as_value
+as_value
 xmlnode_nodetype(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
-    
     boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
-
     return as_value(ptr->nodeType());
 }
 
-// Both a getter and a (do-nothing) setter for attributes
-static as_value
+
+as_value
 xmlnode_attributes(const fn_call& fn)
 {
-    //GNASH_REPORT_FUNCTION;
     
     boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
 
@@ -629,8 +691,6 @@
     return as_value(ret); 
 }
 
-/// A getter and a (do-nothing) setter for XMLNode.firstChild property
-//
 /// 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
@@ -639,10 +699,9 @@
 /// manipulate child nodes; use the appendChild(), insertBefore(),
 /// and removeNode() methods to manipulate child nodes. 
 ///
-static as_value
+as_value
 xmlnode_firstchild(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
     boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
     as_value rv;
     rv.set_null();
@@ -655,18 +714,15 @@
     return rv;
 }
 
-/// A getter and a (do-nothing) setter for XMLNode.lastChild
-//
 /// Read-only property; an XMLNode 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
 /// be used to manipulate child nodes; use the appendChild(),
 /// insertBefore(), and removeNode() methods to manipulate child
 /// nodes.
-static as_value
+as_value
 xmlnode_lastchild(const fn_call& fn)
 {
-    //GNASH_REPORT_FUNCTION;
     boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
     as_value rv;
     rv.set_null();
@@ -677,11 +733,10 @@
     return rv;
 }
 
-// Both a getter and a (do-nothing) setter for nextSibling
-static as_value
+
+as_value
 xmlnode_nextsibling(const fn_call& fn)
 {
-    //GNASH_REPORT_FUNCTION;
     as_value rv;
     rv.set_null();
 
@@ -693,11 +748,9 @@
     return rv;
 }
 
-// Both a getter and a (do-nothing) setter for previousSibling
-static as_value
+as_value
 xmlnode_previoussibling(const fn_call& fn)
 {
-    //GNASH_REPORT_FUNCTION;
     as_value rv;
     rv.set_null();
 
@@ -709,11 +762,9 @@
     return rv;
 }
 
-// Both a getter and a (do-nothing) setter for parentNode
-static as_value
+as_value
 xmlnode_parentNode(const fn_call& fn)
 {
-    //GNASH_REPORT_FUNCTION;
     as_value rv;
     rv.set_null();
 
@@ -725,11 +776,10 @@
     return rv;
 }
 
-// Both a getter and a (do-nothing) setter for childNodes
-static as_value
+
+as_value
 xmlnode_childNodes(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
     boost::intrusive_ptr<XMLNode> ptr = ensureType<XMLNode>(fn.this_ptr);
     boost::intrusive_ptr<as_array_object> ary = new as_array_object();
 
@@ -746,11 +796,9 @@
     return as_value(ary.get());
 }
 
-// extern (used by Global.cpp)
 void xmlnode_class_init(as_object& global)
 {
-//    GNASH_REPORT_FUNCTION;
-    // This is going to be the global XMLNode "class"/"function"
+    // This is the global XMLNode "class"
     static boost::intrusive_ptr<builtin_function> cl;
 
     if ( cl == NULL )
@@ -758,7 +806,6 @@
         cl=new builtin_function(&xmlnode_new, getXMLNodeInterface());
     }
 
-    // Register _global.String
     global.init_member("XMLNode", cl.get());
 
 }

=== modified file 'libcore/sprite_instance.cpp'
--- a/libcore/sprite_instance.cpp       2008-08-21 10:06:20 +0000
+++ b/libcore/sprite_instance.cpp       2008-08-25 10:16:16 +0000
@@ -2252,8 +2252,8 @@
     o.init_member("enabled", true); // see MovieClip.as testcase
     o.init_member("useHandCursor", true); // see MovieClip.as testcase
 
-    as_c_function_ptr gettersetter = &sprite_instance::lockroot_getset;
-    o.init_property("_lockroot", *gettersetter, *gettersetter); // see 
MovieClip.as testcase
+    o.init_property("_lockroot", &sprite_instance::lockroot_getset,
+                                &sprite_instance::lockroot_getset); // see 
MovieClip.as testcase
 
     if ( target_version  < 6 ) return;
 

=== modified file 'testsuite/actionscript.all/XMLNode.as'
--- a/testsuite/actionscript.all/XMLNode.as     2008-08-25 09:25:20 +0000
+++ b/testsuite/actionscript.all/XMLNode.as     2008-08-25 10:16:16 +0000
@@ -38,13 +38,13 @@
 check(XMLNode.prototype.hasOwnProperty("removeNode"));
 check(XMLNode.prototype.hasOwnProperty("toString"));
 
-xcheck(XMLNode.prototype.hasOwnProperty("getPrefixForNamespace"));
-xcheck(XMLNode.prototype.hasOwnProperty("getNamespaceForPrefix"));
+check(XMLNode.prototype.hasOwnProperty("getPrefixForNamespace"));
+check(XMLNode.prototype.hasOwnProperty("getNamespaceForPrefix"));
 
 check(XMLNode.prototype.hasOwnProperty("firstChild"));
 check(XMLNode.prototype.hasOwnProperty("lastChild"));
-xcheck(XMLNode.prototype.hasOwnProperty("namespaceURI"));
-xcheck(XMLNode.prototype.hasOwnProperty("localName"));
+check(XMLNode.prototype.hasOwnProperty("namespaceURI"));
+check(XMLNode.prototype.hasOwnProperty("localName"));
 check(XMLNode.prototype.hasOwnProperty("attributes"));
 check(XMLNode.prototype.hasOwnProperty("childNodes"));
 check(XMLNode.prototype.hasOwnProperty("nextSibling"));
@@ -52,7 +52,7 @@
 check(XMLNode.prototype.hasOwnProperty("nodeType"));
 check(XMLNode.prototype.hasOwnProperty("nodeValue"));
 check(XMLNode.prototype.hasOwnProperty("parentNode"));
-xcheck(XMLNode.prototype.hasOwnProperty("prefix"));
+check(XMLNode.prototype.hasOwnProperty("prefix"));
 check(XMLNode.prototype.hasOwnProperty("previousSibling"));
 
 var doc = new XML();


reply via email to

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