gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. 0893d097b4c3e2ebf153


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 0893d097b4c3e2ebf153189bbcb0fbff5ecf7605
Date: Thu, 28 Oct 2010 08:22:36 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  0893d097b4c3e2ebf153189bbcb0fbff5ecf7605 (commit)
       via  1270ff493013acd689bcf5b34a0300936ddaab5b (commit)
       via  4fa09f7ff0d1a3b1c765d4040027fa15aa964473 (commit)
       via  7e5e50b92c9b9b02111b69ba1354ec0ef9ac3c0d (commit)
       via  41fde01b3aa0d30fd171efa0111ce1524c78035a (commit)
       via  7adee1ba42d923c925b2a2ce9550ce1979099d94 (commit)
       via  269dd1fad4e27c7053235147dc1bfa913cb39873 (commit)
       via  4957bdc7ac5d26a00322f222e70ff7bec1baa0a6 (commit)
      from  9f661ece59ff2e829d3e953d246d6868d40e49c7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=0893d097b4c3e2ebf153189bbcb0fbff5ecf7605


commit 0893d097b4c3e2ebf153189bbcb0fbff5ecf7605
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 28 10:11:19 2010 +0200

    Clean up.

diff --git a/libcore/asobj/flash/external/ExternalInterface_as.cpp 
b/libcore/asobj/flash/external/ExternalInterface_as.cpp
index 9290e5e..40ec17f 100644
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp
@@ -149,7 +149,6 @@ private:
     const fn_call& _fn;
 };
 
-
 }
 
 void
@@ -172,10 +171,7 @@ registerExternalInterfaceNative(as_object& global)
 void
 externalinterface_class_init(as_object& where, const ObjectURI& uri)
 {
-//    GNASH_REPORT_FUNCTION;
-
     where.init_destructive_property(uri, externalInterfaceConstructor, 0);
-
 }
 
 namespace {
@@ -183,7 +179,6 @@ namespace {
 void
 attachExternalInterfaceStaticInterface(as_object& o)
 {    
-    // GNASH_REPORT_FUNCTION;
     
     const int swf8Flags = PropFlags::onlySWF8Up;
     
@@ -254,7 +249,6 @@ attachExternalInterfaceStaticInterface(as_object& o)
 as_value
 externalinterface_addCallback(const fn_call& fn)
 {
-    // GNASH_REPORT_FUNCTION;
     movie_root& mr = getRoot(fn);
 
     if (mr.getControlFD() <= 0) {
@@ -280,7 +274,6 @@ externalinterface_addCallback(const fn_call& fn)
 as_value
 externalinterface_call(const fn_call& fn)
 {
-    // GNASH_REPORT_FUNCTION;
     movie_root& mr = getRoot(fn);
     as_value val;
 
@@ -313,7 +306,6 @@ externalinterface_call(const fn_call& fn)
 as_value
 externalinterface_available(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
     
     movie_root& m = getRoot(fn);
     bool mode = false;
@@ -373,7 +365,6 @@ externalinterface_available(const fn_call& fn)
 as_value
 externalinterface_objectID(const fn_call& fn)
 {
-    // GNASH_REPORT_FUNCTION;
 
     movie_root& mr = getRoot(fn);
     MovieClip *mc = mr.getLevel(0);
@@ -386,13 +377,10 @@ externalinterface_objectID(const fn_call& fn)
     getObject(mc)->get_member(st.find("name"), &name);
 
     if (id.is_undefined() && !name.is_undefined()) {
-//        log_debug("ObjectdID name is: %s", name.to_string());
         return name;
     } else if (!id.is_undefined() && name.is_undefined()) {
-//        log_debug("ObjectdID id is: %s", id.to_string());
         return id;
     } else if (id.is_undefined() && name.is_undefined()) {
-//        log_debug("no objectID defined!");
         return as_value();
     }
     
@@ -457,8 +445,6 @@ externalinterface_uArgumentsToAS(const fn_call& /*fn*/)
 as_value
 externalinterface_uAddCallback(const fn_call& /*fn*/)
 {
-    // GNASH_REPORT_FUNCTION;
-    
     LOG_ONCE( log_unimpl (__FUNCTION__) );
     return as_value();
 }
@@ -466,7 +452,6 @@ externalinterface_uAddCallback(const fn_call& /*fn*/)
 as_value
 externalinterface_uArrayToAS(const fn_call& /*fn*/)
 {
-//    GNASH_REPORT_FUNCTION;
     LOG_ONCE( log_unimpl (__FUNCTION__) );
     return as_value();
 }
@@ -474,7 +459,6 @@ externalinterface_uArrayToAS(const fn_call& /*fn*/)
 as_value
 externalinterface_uArrayToJS(const fn_call& /*fn*/)
 {
-//    GNASH_REPORT_FUNCTION;
     LOG_ONCE( log_unimpl (__FUNCTION__) );
     return as_value();
 }
@@ -499,7 +483,6 @@ externalinterface_uArrayToXML(const fn_call& fn)
 as_value
 externalinterface_uCallIn(const fn_call& /*fn*/)
 {
-//    GNASH_REPORT_FUNCTION;
     LOG_ONCE( log_unimpl (__FUNCTION__) );
     return as_value();
 }
@@ -507,7 +490,6 @@ externalinterface_uCallIn(const fn_call& /*fn*/)
 as_value
 externalinterface_uCallOut(const fn_call& /*fn*/)
 {
-//    GNASH_REPORT_FUNCTION;
     LOG_ONCE( log_unimpl (__FUNCTION__) );
     return as_value();
 }
@@ -515,7 +497,6 @@ externalinterface_uCallOut(const fn_call& /*fn*/)
 as_value
 externalinterface_uEvalJS(const fn_call& /*fn*/)
 {
-//    GNASH_REPORT_FUNCTION;
     LOG_ONCE( log_unimpl (__FUNCTION__) );
     return as_value();
 }
@@ -523,7 +504,6 @@ externalinterface_uEvalJS(const fn_call& /*fn*/)
 as_value
 externalinterface_uInitJS(const fn_call& /*fn*/)
 {
-//    GNASH_REPORT_FUNCTION;
     LOG_ONCE( log_unimpl (__FUNCTION__) );
     return as_value();
 }
@@ -531,7 +511,6 @@ externalinterface_uInitJS(const fn_call& /*fn*/)
 as_value
 externalinterface_uJsQuoteString(const fn_call& /*fn*/)
 {
-//    GNASH_REPORT_FUNCTION;
     LOG_ONCE( log_unimpl (__FUNCTION__) );
     return as_value();
 }
@@ -539,13 +518,12 @@ externalinterface_uJsQuoteString(const fn_call& /*fn*/)
 as_value
 externalinterface_uObjectID(const fn_call& /*fn*/)
 {
-//    GNASH_REPORT_FUNCTION;
     LOG_ONCE( log_unimpl (__FUNCTION__) );
     return as_value();
 }
 
 as_value
-externalinterface_uObjectToAS(const fn_call& fn)
+externalinterface_uObjectToAS(const fn_call& /*fn*/)
 {
     LOG_ONCE(log_unimpl("ExternalInterface._objectToAS"));
     return as_value();
@@ -720,8 +698,6 @@ externalinterface_uToAS(const fn_call& fn)
 as_value
 externalinterface_uEscapeXML(const fn_call& fn)
 {
-    // GNASH_REPORT_FUNCTION;
-    
     if (fn.nargs == 1) {
         std::string str(fn.arg(0).to_string());
         escapeXML(str);
@@ -734,8 +710,6 @@ externalinterface_uEscapeXML(const fn_call& fn)
 as_value
 externalinterface_uUnescapeXML(const fn_call& fn)
 {
-    // GNASH_REPORT_FUNCTION;
-
     if (fn.nargs == 1) {
         std::string str = fn.arg(0).to_string();
         gnash::unescapeXML(str);

http://git.savannah.gnu.org/cgit//commit/?id=1270ff493013acd689bcf5b34a0300936ddaab5b


commit 1270ff493013acd689bcf5b34a0300936ddaab5b
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 28 10:07:15 2010 +0200

    We can return undefined without using a separate function.

diff --git a/libcore/ExternalInterface.cpp b/libcore/ExternalInterface.cpp
index b6b0fd7..f876b8a 100644
--- a/libcore/ExternalInterface.cpp
+++ b/libcore/ExternalInterface.cpp
@@ -137,14 +137,6 @@ ExternalInterface::_toXML(const as_value &val)
     return ss.str();
 }
 
-as_value
-ExternalInterface::objectToAS(Global_as& /*gl*/, const std::string &/*xml*/)
-{
-    // GNASH_REPORT_FUNCTION;
-
-    return as_value();
-}
-
 boost::shared_ptr<ExternalInterface::invoke_t>
 ExternalInterface::ExternalEventCheck(int fd)
 {
diff --git a/libcore/ExternalInterface.h b/libcore/ExternalInterface.h
index 3b3b757..fd1faa5 100644
--- a/libcore/ExternalInterface.h
+++ b/libcore/ExternalInterface.h
@@ -48,12 +48,6 @@ struct DSOEXPORT ExternalInterface
         std::vector<as_value> args;
     };
 
-    // Some of these appear to be undocumented helper functions of this class
-    // that while probably designed to be used internally, get used
-    // by ActionScript coders.
-
-    DSOEXPORT static as_value objectToAS(Global_as& gl, const std::string 
&xml);
-    
     /// Convert an AS object to an XML string.
     static std::string toXML(const as_value &obj) {
         ExternalInterface ei;
diff --git a/libcore/asobj/flash/external/ExternalInterface_as.cpp 
b/libcore/asobj/flash/external/ExternalInterface_as.cpp
index 78ea91b..9290e5e 100644
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp
@@ -547,11 +547,7 @@ externalinterface_uObjectID(const fn_call& /*fn*/)
 as_value
 externalinterface_uObjectToAS(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
-    if (fn.nargs == 1) {
-        return ExternalInterface::objectToAS(getGlobal(fn), 
fn.arg(0).to_string());
-    }
-    
+    LOG_ONCE(log_unimpl("ExternalInterface._objectToAS"));
     return as_value();
 }
 

http://git.savannah.gnu.org/cgit//commit/?id=4fa09f7ff0d1a3b1c765d4040027fa15aa964473


commit 4fa09f7ff0d1a3b1c765d4040027fa15aa964473
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 28 10:06:09 2010 +0200

    Drop another unused function.

diff --git a/libcore/ExternalInterface.h b/libcore/ExternalInterface.h
index dae21d4..3b3b757 100644
--- a/libcore/ExternalInterface.h
+++ b/libcore/ExternalInterface.h
@@ -53,11 +53,6 @@ struct DSOEXPORT ExternalInterface
     // by ActionScript coders.
 
     DSOEXPORT static as_value objectToAS(Global_as& gl, const std::string 
&xml);
-
-    static std::string objectToXML(as_object *obj) {
-        ExternalInterface ei;
-        return ei._objectToXML(obj);
-    }
     
     /// Convert an AS object to an XML string.
     static std::string toXML(const as_value &obj) {

http://git.savannah.gnu.org/cgit//commit/?id=7e5e50b92c9b9b02111b69ba1354ec0ef9ac3c0d


commit 7e5e50b92c9b9b02111b69ba1354ec0ef9ac3c0d
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 28 10:04:12 2010 +0200

    Drop another unused function

diff --git a/libcore/ExternalInterface.cpp b/libcore/ExternalInterface.cpp
index 0e214cf..b6b0fd7 100644
--- a/libcore/ExternalInterface.cpp
+++ b/libcore/ExternalInterface.cpp
@@ -50,11 +50,6 @@
 namespace gnash {
 
 namespace {
-    /// Convert an XML string to an AS value.
-    as_value toAS(const std::string& xml);
-}
-
-namespace {
 
 class Enumerator : public KeyVisitor
 {
@@ -528,75 +523,6 @@ ExternalInterface::readBrowser(int fd)
     return buf;
 }
 
-namespace {
-
-/// Convert an XML string to an AS object.
-as_value
-toAS(const std::string& xml)
-{
-    // GNASH_REPORT_FUNCTION;
-
-    std::string::size_type start = 0;
-    std::string::size_type end;
-    std::string tag;
-    as_value val;
-    
-    // Look for the ending > in the first part of the data for the tag
-    end = xml.find(">");
-    if (end != std::string::npos) {
-        end++;                  // go past the > character
-        tag = xml.substr(start, end);
-        // Look for the easy ones first
-        if (tag == "<null/>") {
-            val.set_null();
-        } else if (tag == "<void/>") {
-            val.set_null();     // FIXME: we need a void type in as_value
-        } else if (tag == "<true/>") {
-            val.set_bool(true);
-        } else if (tag == "<false/>") {
-            val.set_bool(false);
-        } else if (tag == "<number>") {
-            start = end;
-            end = xml.find("</number>");
-            std::string str = xml.substr(start, end-start);
-            if (str.find(".") != std::string::npos) {
-                double num = strtod(str.c_str(), NULL);
-                val.set_double(num);
-            } else {
-                int num = strtol(str.c_str(), NULL, 0);
-                val.set_double(num);
-            }
-        } else if (tag == "<string>") {
-            start = end;
-            end = xml.find("</string>");
-            std::string str = xml.substr(start, end-start);
-            int length = str.size();;
-            char *data = new char[length+1];
-            std::copy(str.begin(), str.end(), data);
-            data[length] = 0;  // terminate the new string or bad things happen
-            // When an NPVariant becomes a string object, it *does not* make a 
copy.
-            // Instead it stores the pointer (and length) we just allocated.
-            val.set_string(data);
-            // as_value copies the string, so we don't need data anymore
-            delete[] data;
-        } else if (tag == "<array>") {
-            start = end;
-            end = xml.find("</array");
-            std::string str = xml.substr(start, end-start);
-            log_unimpl("array processing for ExternalInterface");
-        } else if (tag == "<object>") {
-            start = end;
-            end = xml.find("</object");
-            std::string str = xml.substr(start, end-start);
-            log_unimpl("object processing for ExternalInterface");
-        }
-    }
-
-    return val;
-}
-
-}
-
 } // end of gnash namespace
 
 // local Variables:

http://git.savannah.gnu.org/cgit//commit/?id=41fde01b3aa0d30fd171efa0111ce1524c78035a


commit 41fde01b3aa0d30fd171efa0111ce1524c78035a
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 28 09:59:22 2010 +0200

    Drop unused function.

diff --git a/libcore/ExternalInterface.cpp b/libcore/ExternalInterface.cpp
index 8c41a04..0e214cf 100644
--- a/libcore/ExternalInterface.cpp
+++ b/libcore/ExternalInterface.cpp
@@ -142,35 +142,6 @@ ExternalInterface::_toXML(const as_value &val)
     return ss.str();
 }
 
-std::map<std::string, as_value>
-ExternalInterface::propertiesToAS(std::string &xml)
-{
-    // GNASH_REPORT_FUNCTION;
-    std::map<std::string, as_value> props;
-
-    std::string::size_type start = 0;
-    std::string::size_type end;
-
-    std::string id;
-    start = xml.find(" id=");
-    while (start != std::string::npos) {
-        // Extract the id from the property tag
-        start++;
-        end = xml.find(">", start) - 1;
-        id = xml.substr(start, end-start);
-        id.erase(0, 4);
-
-        // Extract the data
-        start = end + 2;
-        end = xml.find("</property>", start) ;
-        std::string data = xml.substr(start, end-start);
-        props[id] = toAS(data);
-        start = xml.find(" id=", end);
-    }
-
-    return props;
-}
-
 as_value
 ExternalInterface::objectToAS(Global_as& /*gl*/, const std::string &/*xml*/)
 {
diff --git a/libcore/ExternalInterface.h b/libcore/ExternalInterface.h
index 751da59..dae21d4 100644
--- a/libcore/ExternalInterface.h
+++ b/libcore/ExternalInterface.h
@@ -52,10 +52,6 @@ struct DSOEXPORT ExternalInterface
     // that while probably designed to be used internally, get used
     // by ActionScript coders.
 
-    /// Convert an XML string of properties to a data structure.
-    DSOEXPORT static std::map<std::string, as_value> propertiesToAS(
-            std::string &xml);
-    
     DSOEXPORT static as_value objectToAS(Global_as& gl, const std::string 
&xml);
 
     static std::string objectToXML(as_object *obj) {

http://git.savannah.gnu.org/cgit//commit/?id=7adee1ba42d923c925b2a2ce9550ce1979099d94


commit 7adee1ba42d923c925b2a2ce9550ce1979099d94
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 28 09:57:50 2010 +0200

    Move functions out of header.

diff --git a/libcore/ExternalInterface.cpp b/libcore/ExternalInterface.cpp
index 99cb542..8c41a04 100644
--- a/libcore/ExternalInterface.cpp
+++ b/libcore/ExternalInterface.cpp
@@ -50,6 +50,11 @@
 namespace gnash {
 
 namespace {
+    /// Convert an XML string to an AS value.
+    as_value toAS(const std::string& xml);
+}
+
+namespace {
 
 class Enumerator : public KeyVisitor
 {
@@ -137,73 +142,8 @@ ExternalInterface::_toXML(const as_value &val)
     return ss.str();
 }
 
-/// Convert an XML string to an AS object.
-as_value
-ExternalInterface::toAS(Global_as& /*gl*/, const std::string &xml)
-{
-    // GNASH_REPORT_FUNCTION;
-
-    std::string::size_type start = 0;
-    std::string::size_type end;
-    std::string tag;
-    as_value val;
-    
-    // Look for the ending > in the first part of the data for the tag
-    end = xml.find(">");
-    if (end != std::string::npos) {
-        end++;                  // go past the > character
-        tag = xml.substr(start, end);
-        // Look for the easy ones first
-        if (tag == "<null/>") {
-            val.set_null();
-        } else if (tag == "<void/>") {
-            val.set_null();     // FIXME: we need a void type in as_value
-        } else if (tag == "<true/>") {
-            val.set_bool(true);
-        } else if (tag == "<false/>") {
-            val.set_bool(false);
-        } else if (tag == "<number>") {
-            start = end;
-            end = xml.find("</number>");
-            std::string str = xml.substr(start, end-start);
-            if (str.find(".") != std::string::npos) {
-                double num = strtod(str.c_str(), NULL);
-                val.set_double(num);
-            } else {
-                int num = strtol(str.c_str(), NULL, 0);
-                val.set_double(num);
-            }
-        } else if (tag == "<string>") {
-            start = end;
-            end = xml.find("</string>");
-            std::string str = xml.substr(start, end-start);
-            int length = str.size();;
-            char *data = new char[length+1];
-            std::copy(str.begin(), str.end(), data);
-            data[length] = 0;  // terminate the new string or bad things happen
-            // When an NPVariant becomes a string object, it *does not* make a 
copy.
-            // Instead it stores the pointer (and length) we just allocated.
-            val.set_string(data);
-            // as_value copies the string, so we don't need data anymore
-            delete[] data;
-        } else if (tag == "<array>") {
-            start = end;
-            end = xml.find("</array");
-            std::string str = xml.substr(start, end-start);
-            log_unimpl("array processing for ExternalInterface");
-        } else if (tag == "<object>") {
-            start = end;
-            end = xml.find("</object");
-            std::string str = xml.substr(start, end-start);
-            log_unimpl("object processing for ExternalInterface");
-        }
-    }
-
-    return val;
-}
-
 std::map<std::string, as_value>
-ExternalInterface::propertiesToAS(Global_as& gl, std::string &xml)
+ExternalInterface::propertiesToAS(std::string &xml)
 {
     // GNASH_REPORT_FUNCTION;
     std::map<std::string, as_value> props;
@@ -224,7 +164,7 @@ ExternalInterface::propertiesToAS(Global_as& gl, 
std::string &xml)
         start = end + 2;
         end = xml.find("</property>", start) ;
         std::string data = xml.substr(start, end-start);
-        props[id] = toAS(gl, data);
+        props[id] = toAS(data);
         start = xml.find(" id=", end);
     }
 
@@ -617,6 +557,75 @@ ExternalInterface::readBrowser(int fd)
     return buf;
 }
 
+namespace {
+
+/// Convert an XML string to an AS object.
+as_value
+toAS(const std::string& xml)
+{
+    // GNASH_REPORT_FUNCTION;
+
+    std::string::size_type start = 0;
+    std::string::size_type end;
+    std::string tag;
+    as_value val;
+    
+    // Look for the ending > in the first part of the data for the tag
+    end = xml.find(">");
+    if (end != std::string::npos) {
+        end++;                  // go past the > character
+        tag = xml.substr(start, end);
+        // Look for the easy ones first
+        if (tag == "<null/>") {
+            val.set_null();
+        } else if (tag == "<void/>") {
+            val.set_null();     // FIXME: we need a void type in as_value
+        } else if (tag == "<true/>") {
+            val.set_bool(true);
+        } else if (tag == "<false/>") {
+            val.set_bool(false);
+        } else if (tag == "<number>") {
+            start = end;
+            end = xml.find("</number>");
+            std::string str = xml.substr(start, end-start);
+            if (str.find(".") != std::string::npos) {
+                double num = strtod(str.c_str(), NULL);
+                val.set_double(num);
+            } else {
+                int num = strtol(str.c_str(), NULL, 0);
+                val.set_double(num);
+            }
+        } else if (tag == "<string>") {
+            start = end;
+            end = xml.find("</string>");
+            std::string str = xml.substr(start, end-start);
+            int length = str.size();;
+            char *data = new char[length+1];
+            std::copy(str.begin(), str.end(), data);
+            data[length] = 0;  // terminate the new string or bad things happen
+            // When an NPVariant becomes a string object, it *does not* make a 
copy.
+            // Instead it stores the pointer (and length) we just allocated.
+            val.set_string(data);
+            // as_value copies the string, so we don't need data anymore
+            delete[] data;
+        } else if (tag == "<array>") {
+            start = end;
+            end = xml.find("</array");
+            std::string str = xml.substr(start, end-start);
+            log_unimpl("array processing for ExternalInterface");
+        } else if (tag == "<object>") {
+            start = end;
+            end = xml.find("</object");
+            std::string str = xml.substr(start, end-start);
+            log_unimpl("object processing for ExternalInterface");
+        }
+    }
+
+    return val;
+}
+
+}
+
 } // end of gnash namespace
 
 // local Variables:
diff --git a/libcore/ExternalInterface.h b/libcore/ExternalInterface.h
index ff4e40b..751da59 100644
--- a/libcore/ExternalInterface.h
+++ b/libcore/ExternalInterface.h
@@ -52,12 +52,9 @@ struct DSOEXPORT ExternalInterface
     // that while probably designed to be used internally, get used
     // by ActionScript coders.
 
-    /// Convert an XML string to an AS value.
-    DSOEXPORT static as_value toAS(Global_as& as, const std::string &xml);
-
     /// Convert an XML string of properties to a data structure.
-    DSOEXPORT static std::map<std::string, as_value> propertiesToAS(Global_as& 
gl,
-                                                   std::string &xml);
+    DSOEXPORT static std::map<std::string, as_value> propertiesToAS(
+            std::string &xml);
     
     DSOEXPORT static as_value objectToAS(Global_as& gl, const std::string 
&xml);
 

http://git.savannah.gnu.org/cgit//commit/?id=269dd1fad4e27c7053235147dc1bfa913cb39873


commit 269dd1fad4e27c7053235147dc1bfa913cb39873
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 28 09:52:53 2010 +0200

    Implement _utoAS correctly. Add tests.

diff --git a/libcore/asobj/flash/external/ExternalInterface_as.cpp 
b/libcore/asobj/flash/external/ExternalInterface_as.cpp
index 0d799c5..78ea91b 100644
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp
@@ -49,6 +49,7 @@
 #include "log.h"
 #include "RunResources.h"
 #include "StreamProvider.h"
+#include "ObjectURI.h"
 
 #define MAXHOSTNAMELEN 256 // max hostname size. However this is defined in 
netdb.h
 
@@ -660,14 +661,63 @@ externalinterface_uToXML(const fn_call& fn)
 as_value
 externalinterface_uToAS(const fn_call& fn)
 {
-//    GNASH_REPORT_FUNCTION;
-    
-    if (fn.nargs == 1) {
-        as_value val = ExternalInterface::toAS(getGlobal(fn),
-                fn.arg(0).to_string());
-        return val;
+    if (!fn.nargs) return as_value();
+
+    as_value arg = fn.arg(0);
+    as_object* o = toObject(arg, getVM(fn));
+
+    if (!o) {
+        return as_value();
+    }
+    string_table& st = getStringTable(fn);
+    const ObjectURI nodeName(st.find("nodeName"));
+    const ObjectURI firstChild(st.find("firstChild"));
+
+    const as_value& nn = getMember(*o, nodeName);
+
+    if (equals(nn, as_value("number"), getVM(fn))) {
+        as_object* fc = toObject(getMember(*o, firstChild), getVM(fn));
+        const as_value v = callMethod(fc, NSV::PROP_TO_STRING);
+        // This should call Number(obj.firstChild.toString()), i.e. use
+        // the non-constructing number conversion function, but the extra
+        // code needed to implement that isn't worth it.
+        return as_value(toNumber(v, getVM(fn)));
+    }
+    if (equals(nn, as_value("string"), getVM(fn))) {
+        as_object* ei =
+            fn.env().find_object("flash.external.ExternalInterface");
+        as_value fc = getMember(*o, firstChild);
+        return callMethod(ei, st.find("_unescapeXML"),
+                fc.to_string(getSWFVersion(fn)));
+    }
+    if (equals(nn, as_value("false"), getVM(fn))) {
+        return as_value(false);
+    }
+    if (equals(nn, as_value("true"), getVM(fn))) {
+        return as_value(true);
+    }
+    if (equals(nn, as_value("null"), getVM(fn))) {
+        as_value null;
+        null.set_null();
+        return null;
+    }
+    if (equals(nn, as_value("undefined"), getVM(fn))) {
+        return as_value();
+    }
+    if (equals(nn, as_value("object"), getVM(fn))) {
+        as_object* ei =
+            fn.env().find_object("flash.external.ExternalInterface");
+        return callMethod(ei, st.find("_objectToXML"), o);
+    }
+    if (equals(nn, as_value("array"), getVM(fn))) {
+        as_object* ei =
+            fn.env().find_object("flash.external.ExternalInterface");
+        return callMethod(ei, st.find("_arrayToXML"), o);
+    }
+    if (equals(nn, as_value("class"), getVM(fn))) {
+        as_value fc = getMember(*o, firstChild);
+        return fn.env().find_object(fc.to_string(getSWFVersion(fn)));
     }
-    
     return as_value();
 }
 
diff --git a/libcore/vm/ASHandlers.cpp b/libcore/vm/ASHandlers.cpp
index d0a4283..77f82c6 100644
--- a/libcore/vm/ASHandlers.cpp
+++ b/libcore/vm/ASHandlers.cpp
@@ -1266,7 +1266,8 @@ ActionStopDragMovie(ActionExec& thread)
     DisplayObject* tgtch = env.get_target();
     MovieClip* root_movie = tgtch ? tgtch->get_root() : 0;
     if (root_movie) root_movie->stop_drag();
-    else log_debug(_("ActionStopDragMovie: as_environment target is null or 
not a sprite"));
+    else log_debug(_("ActionStopDragMovie: as_environment target is "
+                "null or not a sprite"));
 }
 
 void
diff --git a/testsuite/actionscript.all/ExternalInterface.as 
b/testsuite/actionscript.all/ExternalInterface.as
index 2fe5284..be4bf30 100644
--- a/testsuite/actionscript.all/ExternalInterface.as
+++ b/testsuite/actionscript.all/ExternalInterface.as
@@ -285,20 +285,63 @@ ret  = EI._unescapeXML(rin);
 // so this is mainly a test case problem.
 xcheck_equals (ret, "& ß+ü &nbsp; < << <>''\"");
 
+// This isn't how _toAS works:
 val = EI._toAS("<number>34.56</number>");
-xcheck_equals (typeof(val), 'undefined');
+check_equals (typeof(val), 'undefined');
 
 val = EI._toAS("<string>Hello World!</string>");
-xcheck_equals (typeof(val), 'undefined');
+check_equals (typeof(val), 'undefined');
 
 val = EI._toAS("<null/>");
-xcheck_equals (typeof(val), 'undefined');
+check_equals (typeof(val), 'undefined');
 
 val = EI._toAS("<true/>");
-xcheck_equals (typeof(val), 'undefined');
+check_equals (typeof(val), 'undefined');
 
 val = EI._toAS("<false/>");
-xcheck_equals (typeof(val), 'undefined');
+check_equals (typeof(val), 'undefined');
+
+// This is how it works:
+// Note that it's really designed for XMLNodes, but it's quite happy with
+// the faked nodes we're giving it here.
+
+o = {};
+o.nodeName = "false";
+check_equals(EI._toAS(o), false);
+
+o = {};
+o.nodeName = "true";
+check_equals(EI._toAS(o), true);
+
+o = {};
+o.nodeName = "number";
+check_equals(EI._toAS(o).toString(), "NaN");
+o.firstChild = new String("45");
+check_equals(EI._toAS(o), 45);
+
+e = {};
+e.toString = function() { return "23"; };
+o.firstChild = e;
+check_equals(EI._toAS(o), 23);
+
+// This way doesn't work.
+o = {};
+o.nodeName = "boolean";
+check_equals(EI._toAS(o), undefined);
+o.firstChild = new String("false");
+check_equals(EI._toAS(o), undefined);
+
+o = {};
+o.nodeName = "null";
+check_equals(EI._toAS(o), null);
+
+o = {};
+o.nodeName = "class";
+o.firstChild = new String("foo");
+check_equals(EI._toAS(o), undefined);
+
+o.firstChild = new String("Date");
+check_equals(typeof(EI._toAS(o)), "function");
 
 val = EI._objectToAS('<object><property 
id="b"><string>string</string></property><property 
id="a"><number>1</number></property></object>');
 xcheck_equals (typeOf(val), 'object');
@@ -313,6 +356,6 @@ xcheck_equals (typeOf(val), 'object');
 #elif OUTPUT_VERSION < 8 // }{
        check_totals(49);
 #else // SWF8+ }{
-       check_totals(101);
+       check_totals(111);
 # endif // }
 

http://git.savannah.gnu.org/cgit//commit/?id=4957bdc7ac5d26a00322f222e70ff7bec1baa0a6


commit 4957bdc7ac5d26a00322f222e70ff7bec1baa0a6
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 28 09:10:18 2010 +0200

    Don't forward declare more than necessary.

diff --git a/libcore/asobj/flash/external/ExternalInterface_as.h 
b/libcore/asobj/flash/external/ExternalInterface_as.h
index 715af74..88cf5ad 100644
--- a/libcore/asobj/flash/external/ExternalInterface_as.h
+++ b/libcore/asobj/flash/external/ExternalInterface_as.h
@@ -21,14 +21,9 @@
 #ifndef GNASH_ASOBJ_EXTERNALINTERFACE_H
 #define GNASH_ASOBJ_EXTERNALINTERFACE_H
 
-
 namespace gnash {
-
-class as_object;
-class as_value;
-struct ObjectURI;
-class Global_as;
-class movie_root;
+    class as_object;
+    struct ObjectURI;
 }
 
 namespace gnash {
@@ -39,7 +34,7 @@ void externalinterface_class_init(gnash::as_object& where,
 
 void registerExternalInterfaceNative(as_object& global);
 
-} // end of gnash namespace
+} // namespace gnash 
 
 #endif
 

-----------------------------------------------------------------------

Summary of changes:
 libcore/ExternalInterface.cpp                      |  102 --------------------
 libcore/ExternalInterface.h                        |   18 ----
 .../asobj/flash/external/ExternalInterface_as.cpp  |   98 +++++++++++--------
 .../asobj/flash/external/ExternalInterface_as.h    |   11 +--
 libcore/vm/ASHandlers.cpp                          |    3 +-
 testsuite/actionscript.all/ExternalInterface.as    |   55 ++++++++++-
 6 files changed, 113 insertions(+), 174 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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