gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r12168: Yes, I do read your emails,


From: Rob Savoye
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r12168: Yes, I do read your emails, and often agree.
Date: Wed, 21 Apr 2010 16:12:47 -0600
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 12168 [merge]
committer: Rob Savoye <address@hidden>
branch nick: trunk
timestamp: Wed 2010-04-21 16:12:47 -0600
message:
  Yes, I do read your emails, and often agree.
  Merge from branch.
modified:
  libcore/asobj/flash/external/ExternalInterface_as.cpp
  libcore/asobj/flash/external/ExternalInterface_as.h
  libcore/asobj/flash/net/NetConnection_as.cpp
  libcore/asobj/flash/net/NetConnection_as.h
  libcore/asobj/flash/text/TextField_as.cpp
  libcore/movie_root.h
  libcore/vm/fn_call.h
  plugin/npapi/callbacks.cpp
  plugin/npapi/callbacks.h
  plugin/npapi/external.cpp
  plugin/npapi/plugin.cpp
  plugin/npapi/plugin.h
  plugin/npapi/pluginScriptObject.cpp
  plugin/npapi/pluginScriptObject.h
  testsuite/actionscript.all/ExternalInterface.as
=== modified file 'libcore/asobj/flash/external/ExternalInterface_as.cpp'
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp     2010-04-21 
00:29:06 +0000
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp     2010-04-21 
22:07:20 +0000
@@ -18,6 +18,9 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
+#include <map>
+#include <sstream>
+
 #include "Relay.h" // for inheritance
 #include "ExternalInterface_as.h"
 #include "as_object.h" // for inheritance
@@ -31,62 +34,14 @@
 #include "as_value.h"
 #include "as_object.h"
 #include "xml/XMLDocument_as.h"
+#include "Array_as.h"
 #include "namedStrings.h"
+#include "Global_as.h"
 #include "PropertyList.h"
 
-#include <sstream>
-
 namespace gnash {
 
 namespace {
-
-/// Class used to serialize properties of an object to a buffer
-class PropsSerializer : public AbstractPropertyVisitor
-{
-
-public:
-    
-    PropsSerializer(ExternalInterface_as &ei, VM& vm)
-        : _ei(ei),
-        _st(vm.getStringTable()),
-        _error(false)
-    {}
-    
-    bool success() const { return !_error; }
-
-    bool accept(const ObjectURI& uri, const as_value& val) {
-        if (_error) return true;
-
-        const string_table::key key = getName(uri);
-
-        if (key == NSV::PROP_uuPROTOuu || key == NSV::PROP_CONSTRUCTOR) {
-            log_debug(" skip serialization of specially-named property %s",
-                      _st.value(key));
-            return true;
-        }
-
-        // write property name
-        const std::string& id = _st.value(key);
-
-//        log_debug(" serializing property %s", id);
-        
-        _xml << "<property id=\"" << id << "\">";
-        _xml << _ei.toXML(const_cast<as_value &>(val));
-        _xml << "</property>";
-            
-        return true;
-    }
-
-    std::string getXML() { return _xml.str(); };
-    
-private:
-    ExternalInterface_as &_ei;
-    string_table&       _st;
-    mutable bool        _error;
-    std::stringstream   _xml;
-};
-}
-
 as_value externalinterface_addCallback(const fn_call& fn);
 as_value externalinterface_call(const fn_call& fn);
 as_value externalInterfaceConstructor(const fn_call& fn);
@@ -114,16 +69,76 @@
 as_value externalinterface_uToJS(const fn_call& fn);
 as_value externalinterface_uToXML(const fn_call& fn);
 as_value externalinterface_uUnescapeXML(const fn_call& fn);
+}
+
+/// Class used to serialize properties of an object to a buffer
+class PropsSerializer : public AbstractPropertyVisitor
+{
+
+public:
+    
+    PropsSerializer(VM& vm)
+        : _st(vm.getStringTable()),
+          _error(false)
+    {}
+    
+    bool success() const { return !_error; }
+
+    bool accept(const ObjectURI& uri, const as_value& val) {
+        if (_error) return true;
+
+        const string_table::key key = getName(uri);
+
+        if (key == NSV::PROP_uuPROTOuu || key == NSV::PROP_CONSTRUCTOR) {
+            log_debug(" skip serialization of specially-named property %s",
+                      _st.value(key));
+            return true;
+        }
+
+        // write property name
+        const std::string& id = _st.value(key);
+
+//        log_debug(" serializing property %s", id);
+        
+        _xml << "<property id=\"" << id << "\">";
+        _xml << ExternalInterface_as::toXML(val);
+        _xml << "</property>";
+            
+        return true;
+    }
+
+    std::string getXML() { return _xml.str(); };
+    
+private:
+    string_table&       _st;
+    mutable bool        _error;
+    std::stringstream   _xml;
+};
 
 // extern 
 void
 externalinterface_class_init(as_object& where, const ObjectURI& uri)
 {
-    // TODO: this may not be correct, but it should be enumerable.
-    const int flags = 0;
-    where.init_destructive_property(uri, externalInterfaceConstructor, flags);
+#if 1
+    where.init_destructive_property(uri, externalInterfaceConstructor, 0);
+#else
+    Global_as& gl = getGlobal(where);
+    as_object* proto = gl.createObject();
+    as_object* cl = gl.createClass(&externalInterfaceConstructor, proto);
+
+    attachTextFieldInterface(*proto);
+    attachTextFieldStaticMembers(*cl);
+             
+    where.init_member(uri, cl, as_object::DefaultFlags);
+
+    // ASSetPropFlags is called on the TextField class.
+    as_object* null = 0;
+    callMethod(&gl, NSV::PROP_AS_SET_PROP_FLAGS, cl, null, 131);
+#endif
 }
 
+namespace {
+
 void
 attachExternalInterfaceInterface(as_object& /*o*/)
 {
@@ -132,69 +147,65 @@
 void
 attachExternalInterfaceStaticProperties(as_object& o)
 {
-    const int flags = PropFlags::dontEnum |
-                      PropFlags::dontDelete |
-                      PropFlags::readOnly;
+    
+//    const int swf6Flags = as_object::DefaultFlags | PropFlags::onlySWF6Up;
+    const int swf7Flags = as_object::DefaultFlags | PropFlags::onlySWF7Up;
+    const int swf8Flags = as_object::DefaultFlags | PropFlags::onlySWF8Up;
 
     Global_as& gl = getGlobal(o);
     
     // Initialize the properties
-    o.init_readonly_property("available", &externalinterface_available);
+    o.init_readonly_property("available", &externalinterface_available, 
swf7Flags);
 
-    // FIXME: for now, always make these available as ming doesn't support v9
-//    if (getSWFVersion(o) > 8) {
-    o.init_readonly_property("marshallExceptions", 
&externalinterface_marshallExceptions);
-    o.init_property("objectID", externalinterface_objectID, 
externalinterface_objectID);
-//    }
+    o.init_property("marshallExceptions", externalinterface_marshallExceptions,
+                    externalinterface_marshallExceptions, swf8Flags);
+    o.init_readonly_property("objectID", &externalinterface_objectID, 
swf8Flags);
     
     // Initialize the methods, most of which are undocumented helper functions
     o.init_member("addCallback", gl.createFunction(
-                externalinterface_addCallback), flags);
-    o.init_member("call", gl.createFunction(externalinterface_call), flags);
+                externalinterface_addCallback), swf7Flags);
+    o.init_member("call", gl.createFunction(externalinterface_call), 
swf7Flags);
+    o.init_member("_argumentsToXML",
+                  gl.createFunction(externalinterface_uArgumentsToXML), 
swf8Flags);
+    o.init_member("_argumentsToAS",
+                  gl.createFunction(externalinterface_uArgumentsToAS), 
swf8Flags);
+    o.init_member("_addCallback",
+                  gl.createFunction(externalinterface_uAddCallback), 
swf8Flags);
+    o.init_member("_arrayToAS",
+                  gl.createFunction(externalinterface_uArrayToAS), swf8Flags);
+    o.init_member("_arrayToJS",
+                  gl.createFunction(externalinterface_uArrayToJS), swf8Flags);
+    o.init_member("_arrayToXML",
+                  gl.createFunction(externalinterface_uArrayToXML), swf8Flags);
+    o.init_member("_callIn",
+                  gl.createFunction(externalinterface_uCallIn), swf8Flags);
+    o.init_member("_callOut",
+                  gl.createFunction(externalinterface_uCallOut), swf8Flags);
+    o.init_member("_escapeXML",
+                  gl.createFunction(externalinterface_uEscapeXML), swf8Flags);
+    o.init_member("_evalJS",
+                  gl.createFunction(externalinterface_uEvalJS), swf8Flags);
+    o.init_member("_initJS",
+                  gl.createFunction(externalinterface_uInitJS), swf8Flags);
+    o.init_member("_jsQuoteString",
+                  gl.createFunction(externalinterface_uJsQuoteString), 
swf8Flags);
+    o.init_member("_objectID",
+                  gl.createFunction(externalinterface_uObjectID), swf8Flags);
+    o.init_member("_objectToAS",
+                  gl.createFunction(externalinterface_uObjectToAS), swf8Flags);
+    o.init_member("_objectToJS",
+                  gl.createFunction(externalinterface_uObjectToJS), swf8Flags);
+    o.init_member("_objectToXML",
+                  gl.createFunction(externalinterface_uObjectToXML), 
swf8Flags);
+    o.init_member("_toAS",
+                  gl.createFunction(externalinterface_uToAS), swf8Flags);
+    o.init_member("_toJS",
+                  gl.createFunction(externalinterface_uToJS), swf8Flags);
+    o.init_member("_toXML",
+                  gl.createFunction(externalinterface_uToXML), swf8Flags);
+    o.init_member("_unescapeXML",
+                  gl.createFunction(externalinterface_uUnescapeXML), 
swf8Flags);
 
-    if (getSWFVersion(o) > 6) {
-        o.init_member("_argumentsToXML",
-                      gl.createFunction(externalinterface_uArgumentsToXML), 
flags);
-        o.init_member("_argumentsToAS",
-                      gl.createFunction(externalinterface_uArgumentsToAS), 
flags);
-        o.init_member("_addCallback",
-                      gl.createFunction(externalinterface_uAddCallback), 
flags);
-        o.init_member("_arrayToAS",
-                      gl.createFunction(externalinterface_uArrayToAS), flags);
-        o.init_member("_arrayToJS",
-                      gl.createFunction(externalinterface_uArrayToJS), flags);
-        o.init_member("_arrayToXML",
-                      gl.createFunction(externalinterface_uArrayToXML), flags);
-        o.init_member("_callIn",
-                      gl.createFunction(externalinterface_uCallIn), flags);
-        o.init_member("_callOut",
-                      gl.createFunction(externalinterface_uCallOut), flags);
-        o.init_member("_escapeXML",
-                      gl.createFunction(externalinterface_uEscapeXML), flags);
-        o.init_member("_evalJS",
-                      gl.createFunction(externalinterface_uEvalJS), flags);
-        o.init_member("_initJS",
-                      gl.createFunction(externalinterface_uInitJS), flags);
-        o.init_member("_jsQuoteString",
-                      gl.createFunction(externalinterface_uJsQuoteString), 
flags);
-        o.init_member("_objectID",
-                      gl.createFunction(externalinterface_uObjectID), flags);
-        o.init_member("_objectToAS",
-                      gl.createFunction(externalinterface_uObjectToAS), flags);
-        o.init_member("_objectToJS",
-                      gl.createFunction(externalinterface_uObjectToJS), flags);
-        o.init_member("_objectToXML",
-                      gl.createFunction(externalinterface_uObjectToXML), 
flags);
-        o.init_member("_toAS",
-                      gl.createFunction(externalinterface_uToAS), flags);
-        o.init_member("_toJS",
-                      gl.createFunction(externalinterface_uToJS), flags);
-        o.init_member("_toXML",
-                      gl.createFunction(externalinterface_uToXML), flags);
-        o.init_member("_unescapeXML",
-                      gl.createFunction(externalinterface_uUnescapeXML), 
flags);
-    }
-    
 }
 
 as_value
@@ -214,7 +225,6 @@
         ptr->addCallback(methodName, asCallback.get());
     }
     
-    
     return as_value();    
 }
 
@@ -270,7 +280,7 @@
 //    GNASH_REPORT_FUNCTION;
 
     ExternalInterface_as* ptr = ensure<ThisIsNative<ExternalInterface_as> 
>(fn);
-    std::string &str = ptr->objectID();
+    const std::string &str = ptr->objectID();
     if (str.empty()) {
         return as_value();
     }
@@ -310,26 +320,25 @@
     // GNASH_REPORT_FUNCTION;
 
     std::stringstream ss;
-    ExternalInterface_as &ptr = (ExternalInterface_as &)(fn);
     
     if (fn.nargs > 0) {
         std::vector<as_value> args;
         for (size_t i=0; i<fn.nargs; i++) {
             args.push_back(fn.arg(i));
         }
-        return ptr.argumentsToXML(args);
+        return ExternalInterface_as::argumentsToXML(args);
     }
     
     return as_value();
 }
 
 as_value
-externalinterface_uArgumentsToAS(const fn_call& fn)
+externalinterface_uArgumentsToAS(const fn_call& /*fn*/)
 {
     // GNASH_REPORT_FUNCTION;
     
-    std::string str(fn.arg(0).to_string());
-    ExternalInterface_as &ptr = (ExternalInterface_as &)(fn);
+    // std::string str(fn.arg(0).to_string());
+    // ExternalInterface_as &ptr = (ExternalInterface_as &)(fn);
     // if (fn.nargs > 0) {
     //     return ptr->argumentsToAS();
     // }
@@ -340,22 +349,25 @@
 as_value
 externalinterface_uAddCallback(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+//    GNASH_REPORT_FUNCTION;
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value();
 }
 
 as_value
 externalinterface_uArrayToAS(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+//    GNASH_REPORT_FUNCTION;
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value();
 }
 
 as_value
 externalinterface_uArrayToJS(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+//    GNASH_REPORT_FUNCTION;
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value();
 }
 
 as_value
@@ -363,10 +375,9 @@
 {
 //    GNASH_REPORT_FUNCTION;
     
-    ExternalInterface_as &ptr = (ExternalInterface_as &)(fn);
     if (fn.nargs == 1) {
         as_object *obj = fn.arg(0).to_object(getGlobal(fn));
-        std::string str = ptr.arrayToXML(obj);
+        std::string str = ExternalInterface_as::arrayToXML(obj);
         return as_value(str);
     }
     
@@ -376,50 +387,60 @@
 as_value
 externalinterface_uCallIn(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+//    GNASH_REPORT_FUNCTION;
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value();
 }
 
 as_value
 externalinterface_uCallOut(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+//    GNASH_REPORT_FUNCTION;
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value();
 }
 
 as_value
 externalinterface_uEvalJS(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+//    GNASH_REPORT_FUNCTION;
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value();
 }
 
 as_value
 externalinterface_uInitJS(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+//    GNASH_REPORT_FUNCTION;
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value();
 }
 
 as_value
 externalinterface_uJsQuoteString(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+//    GNASH_REPORT_FUNCTION;
+    LOG_ONCE( log_unimpl (__FUNCTION__) );
+    return as_value();
 }
 
 as_value
 externalinterface_uObjectID(const fn_call& /*fn*/)
 {
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+//    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 (__FUNCTION__) );
-       return as_value();
+//    GNASH_REPORT_FUNCTION;
+    if (fn.nargs == 1) {
+        return ExternalInterface_as::objectToAS(getGlobal(fn), 
fn.arg(0).to_string());
+    }
+    
+    return as_value();
 }
 
 as_value
@@ -434,19 +455,16 @@
 {
 //    GNASH_REPORT_FUNCTION;
     
-    ExternalInterface_as &ptr = (ExternalInterface_as &)(fn);
     if (fn.nargs == 1) {
         if (!fn.arg(0).is_null() && !fn.arg(0).is_undefined()) {
             as_object *obj = fn.arg(0).to_object(getGlobal(fn));
-            std::string str = ptr.objectToXML(obj);
+            std::string str = ExternalInterface_as::objectToXML(obj);
             return as_value(str);
         } else {
-            return "<object></object>";
+            return as_value("<object></object>");
         }
     }
     
-//    const string_table::key key = getName(uri);    
-    
     return as_value();
 }
 
@@ -461,12 +479,10 @@
 externalinterface_uToXML(const fn_call& fn)
 {
 //    GNASH_REPORT_FUNCTION;
-    ExternalInterface_as &ptr = (ExternalInterface_as &)(fn);
-    
+
     if (fn.nargs == 1) {
         as_value val = fn.arg(0);
-        std::string str = ptr.toXML(val);
-        return as_value(str);
+        as_value(ExternalInterface_as::toXML(val));
     }
     
     return as_value();
@@ -475,10 +491,10 @@
 as_value
 externalinterface_uToAS(const fn_call& fn)
 {
-    ExternalInterface_as &ptr = (ExternalInterface_as &)(fn);
+//    GNASH_REPORT_FUNCTION;
     
     if (fn.nargs == 1) {
-        as_value val = ptr.toAS(fn.arg(0).to_string());
+        as_value val = ExternalInterface_as::toAS(getGlobal(fn), 
fn.arg(0).to_string());
         return val;
     }
     
@@ -513,13 +529,12 @@
     return as_value();
 }
 
-// } // end of anonymous namespace used for callbacks
+} // end of anonymous namespace used for callbacks
 
 // namespace gnash {
 
-ExternalInterface_as::ExternalInterface_as(as_object* owner)
-    : ActiveRelay(owner),
-      _exceptions(false)
+ExternalInterface_as::ExternalInterface_as(as_object* /*owner*/)
+    : _exceptions(false)
 
 {
     LOG_ONCE( log_unimpl (__FUNCTION__) );
@@ -531,17 +546,19 @@
 }
 
 bool
-ExternalInterface_as::addCallback(const std::string &/*name */, as_object */* 
method */)
+ExternalInterface_as::addCallback(const std::string &name, as_object *method)
 {
-    LOG_ONCE( log_unimpl (__FUNCTION__) );
-
-    return false;
+    // GNASH_REPORT_FUNCTION;
+    _methods[name] = method;
+    
+    return true;
 }
 
 bool
-ExternalInterface_as::call(as_object */*asCallback*/, const std::string& 
/*methodName*/,
+ExternalInterface_as::call(as_object */*asCallback*/, const std::string& 
/*name*/,
                            const std::vector<as_value>& /*args*/, size_t 
/*firstArg*/)
 {
+    // GNASH_REPORT_FUNCTION;
     LOG_ONCE( log_unimpl (__FUNCTION__) );
 
     return false;
@@ -570,7 +587,7 @@
     }
 
     // Get all the properties
-    PropsSerializer props(*this, vm);
+    PropsSerializer props(vm);
     obj->visitProperties<IsEnumerable>(props);
     if (!props.success()) {
         log_error("Could not serialize object");
@@ -597,7 +614,7 @@
     VM& vm = getVM(*obj);    
     
     ss << "<array>";
-    PropsSerializer props(*this, vm);
+    PropsSerializer props(vm);
     obj->visitProperties<IsEnumerable>(props);
     if (!props.success()) {
         log_error("Could not serialize object");
@@ -612,7 +629,7 @@
 
 /// Convert an AS object to an XML string.
 std::string
-ExternalInterface_as::toXML(as_value &val)
+ExternalInterface_as::toXML(const as_value &val)
 {
     // GNASH_REPORT_FUNCTION;
     std::stringstream ss;
@@ -647,7 +664,7 @@
 
 /// Convert an XML string to an AS object.
 as_value
-ExternalInterface_as::toAS(const std::string &xml)
+ExternalInterface_as::toAS(Global_as& /*gl*/, const std::string &xml)
 {
     // GNASH_REPORT_FUNCTION;
 
@@ -702,18 +719,20 @@
             //     // NPIdentifier id = 
NPN_GetStringIdentifier(it->first.c_str());
             //     // NPVariant *value = it->second;
             // }
+            // as_object *obj = new as_object(gl);
         } else if (tag == "<object>") {
             start = end;
             end = xml.find("</object");
             std::string str = xml.substr(start, end-start);
-            // std::map<std::string, NPVariant *> props = parseProperties(str);
+            // std::map<std::string, as_value> props = parseProperties(str);
             // std::map<std::string, NPVariant *>::iterator it;
             // for (it=props.begin(); it != props.end(); ++it) {
             //     // NPIdentifier id = 
NPN_GetStringIdentifier(it->first.c_str());
             //     // NPVariant *value = it->second;
             // }
-            // as_object *obj = new as_object;
-            // val = obj; 
+            // as_object *obj = val.to_object();
+            // val.set_as_object(obj); 
+            // as_object *obj = new as_object(gl);
         }
     }
 
@@ -730,13 +749,50 @@
     ss << "<arguments>";
     for (it=args.begin(); it != args.end(); it++) {
         as_value val = *it;
-        ss << toXML(val);
+        // ss << externalinterface_uToXML(val);
     }
     ss << "</arguments>";
     
     return as_value(ss.str());
 }
 
+std::map<std::string, as_value>
+ExternalInterface_as::propertiesToAS(Global_as& gl, 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(gl, data);
+        start = xml.find(" id=", end);
+    }
+
+    return props;
+}
+
+as_value
+ExternalInterface_as::objectToAS(Global_as& /*gl*/, const std::string &/*xml*/)
+{
+    // GNASH_REPORT_FUNCTION;
+
+    return as_value();
+}
+
 } // end of gnash namespace
 
 // local Variables:

=== modified file 'libcore/asobj/flash/external/ExternalInterface_as.h'
--- a/libcore/asobj/flash/external/ExternalInterface_as.h       2010-04-21 
00:29:06 +0000
+++ b/libcore/asobj/flash/external/ExternalInterface_as.h       2010-04-21 
22:07:20 +0000
@@ -23,17 +23,19 @@
 
 #include <string>
 #include <vector>
-
-#include "Relay.h" // for inheritance
+#include <map>
 
 namespace gnash {
 
 class as_object;
 class as_value;
 class ObjectURI;
-
-
-class ExternalInterface_as : public ActiveRelay
+class Global_as;
+}
+
+namespace gnash {
+
+class ExternalInterface_as
 {
 public:
     ExternalInterface_as(as_object* owner);
@@ -48,53 +50,56 @@
     void marshallExceptions(bool flag) { _exceptions = flag; };
     bool marshallExceptions() { return _exceptions; };
 
-    // Returns the id attribute of the object tag in Internet Explorer,
-    // or the name attribute of the embed tag in Netscape. 
-    std::string &objectID() { return _objectid; };
+    /// Returns the id attribute of the object tag in Internet Explorer,
+    /// or the name attribute of the embed tag in Netscape. 
+    const std::string &objectID() { return _objectid; };
     std::string objectID(as_object &obj);    
     
     /// Call a callback if it's registered already.
-    bool call(as_object* asCallback, const std::string& methodName,
+    static bool call(as_object* asCallback, const std::string& methodName,
               const std::vector<as_value>& args, size_t firstArg);
 
-    /// Convert an AS object to an XML string.
-    std::string toXML(as_value &obj);
-    
-    /// Convert an XML string to an AS value.
-    as_value toAS(const std::string &xml);
-    
-//    as_value toJS(const std::string &xml);;
-    
     // These appear to be undocumented helper functions of this class
     // that while propably designed to be used internally, get used
     // by ActionScript coders.
 
-    as_value argumentsToXML(std::vector<as_value> &args);
+    /// Convert an AS object to an XML string.
+    static std::string toXML(const as_value &obj);
+    
+    /// Convert an XML string to an AS value.
+    static as_value toAS(Global_as& as, const std::string &xml);
+
+    /// Convert an XML string of properties to a data structure.
+    static std::map<std::string, as_value> propertiesToAS(Global_as& gl,
+                                                   std::string &xml);
+    
+    static as_value argumentsToXML(std::vector<as_value> &args);
 //    as_value argumentsToAS();
     
-    std::string objectToXML(as_object *obj);
-    // std::string objectToJS(as_object &obj);
-    // std::string objectToAS(as_object &obj);
-    
-    std::string arrayToXML(as_object *obj);
-
-// check(EI.hasOwnProperty("_arrayToJS"));
-// check(EI.hasOwnProperty("_arrayToAS"));
-
-
-// check(EI.hasOwnProperty("_jsQuoteString"));
-// check(EI.hasOwnProperty("_initJS"));
-// check(EI.hasOwnProperty("_evalJS"));
-    
-// check(EI.hasOwnProperty("_callOut"));
-// check(EI.hasOwnProperty("_callIn"));
-
-    std::string escapeXML(as_object &obj);
-    std::string unescapeXML(as_object &obj);
+    static std::string objectToXML(as_object *obj);
+    static as_value objectToAS(Global_as& gl, const std::string &xml);
+//  std::string objectToJS(as_object &obj);
+//  as_value toJS(const std::string &xml);;
+    
+    static std::string arrayToXML(as_object *obj);
+
+//  std::string arrayToJS();
+//  as_value arrayToAS();
+
+//  std::string jsQuoteString();
+//  void initJS();
+//  bool evalJS();
+    
+//  callOut"));
+//  callIn"));
+
+    static std::string escapeXML(as_object &obj);
+    static std::string unescapeXML(as_object &obj);
     
 private:
     std::string _objectid;
     bool        _exceptions;
+    std::map<std::string, as_object *> _methods;
 };
 
 /// Initialize the global ExternalInterface class

=== modified file 'libcore/asobj/flash/net/NetConnection_as.cpp'
--- a/libcore/asobj/flash/net/NetConnection_as.cpp      2010-03-11 01:47:08 
+0000
+++ b/libcore/asobj/flash/net/NetConnection_as.cpp      2010-04-21 19:29:41 
+0000
@@ -143,8 +143,7 @@
     /// The NetConnection_as owns all ConnectionHandlers, so there is no
     /// need to mark it reachable.
     ConnectionHandler(NetConnection_as& nc)
-        :
-        _nc(nc)
+        : _nc(nc)
     {}
 
     // Object handling connection status messages
@@ -668,8 +667,7 @@
 //----- NetConnection_as ----------------------------------------------------
 
 NetConnection_as::NetConnection_as(as_object* owner)
-    :
-    ActiveRelay(owner),
+    : ActiveRelay(owner),
     _queuedConnections(),
     _currentConnection(0),
     _uri(),

=== modified file 'libcore/asobj/flash/net/NetConnection_as.h'
--- a/libcore/asobj/flash/net/NetConnection_as.h        2010-03-14 06:02:38 
+0000
+++ b/libcore/asobj/flash/net/NetConnection_as.h        2010-04-21 19:29:41 
+0000
@@ -57,8 +57,8 @@
         CALL_BADVERSION
     };
 
-       NetConnection_as(as_object* owner);
-       ~NetConnection_as();
+    NetConnection_as(as_object* owner);
+    ~NetConnection_as();
 
     /// Process connection stuff
     virtual void update();
@@ -94,8 +94,8 @@
     /// Get an stream by name
     std::auto_ptr<IOChannel> getStream(const std::string& name);
 
-       /// Mark responders associated with remoting calls
-       void markReachableResources() const;
+    /// Mark responders associated with remoting calls
+    void markReachableResources() const;
 
 private:
 
@@ -103,8 +103,8 @@
 
     void getStatusCodeInfo(StatusCode code, NetConnectionStatus& info);
 
-       /// Extend the URL to be used for playing
-       void addToURL(const std::string& url);
+    /// Extend the URL to be used for playing
+    void addToURL(const std::string& url);
 
     /// Queue of call groups
     //
@@ -112,7 +112,7 @@
     /// will perform a POST request containing all calls
     /// to the same uri and dispatch results.
     ///
-       std::list<ConnectionHandler*> _queuedConnections;
+    std::list<ConnectionHandler*> _queuedConnections;
 
     /// Queue of calls gathered during a single movie advancement
     //
@@ -121,8 +121,8 @@
     ///
     std::auto_ptr<ConnectionHandler> _currentConnection; 
 
-       /// the url prefix optionally passed to connect()
-       std::string _uri;
+    /// the url prefix optionally passed to connect()
+    std::string _uri;
 
     bool _isConnected;
 
@@ -136,3 +136,8 @@
 } // end of gnash namespace
 
 #endif
+
+// local Variables:
+// mode: C++
+// indent-tabs-mode: nil
+// End:

=== modified file 'libcore/asobj/flash/text/TextField_as.cpp'
--- a/libcore/asobj/flash/text/TextField_as.cpp 2010-03-11 01:47:08 +0000
+++ b/libcore/asobj/flash/text/TextField_as.cpp 2010-04-21 22:07:20 +0000
@@ -1198,6 +1198,6 @@
 
 // local Variables:
 // mode: C++
-// indent-tabs-mode: t
+// indent-tabs-mode: nil
 // End:
 

=== modified file 'libcore/movie_root.h'
--- a/libcore/movie_root.h      2010-03-14 02:26:46 +0000
+++ b/libcore/movie_root.h      2010-04-21 19:27:23 +0000
@@ -760,10 +760,18 @@
     /// (for browser communication mostly)
     void setHostFD(int fd)
     {
-        assert(fd > 0);
+        assert(fd >= 0);
         _hostfd = fd;
     }
 
+    /// Set a filedescriptor to use for host application requests
+    /// (for browser communication mostly)
+    void setControlFD(int fd)
+    {
+        assert(fd >= 0);
+        _controlfd = fd;
+    }
+
     /// Get the filedescriptor to use for host application requests
     /// (for browser communication mostly)
     ///
@@ -772,6 +780,10 @@
     {
         return _hostfd;
     }
+    int getControlFD() const
+    {
+        return _controlfd;
+    }
 
     /// Abstract base class for FS handlers
     class AbstractFsCallback {
@@ -1146,6 +1158,7 @@
     //
     /// -1 if none
     int _hostfd;
+    int _controlfd;
 
     /// The display quality of the entire movie.
     //
@@ -1155,7 +1168,7 @@
 
     std::bitset<4u> _alignMode;
 
-       bool _showMenu;
+    bool _showMenu;
     
     ScaleMode _scaleMode;
     

=== modified file 'libcore/vm/fn_call.h'
--- a/libcore/vm/fn_call.h      2010-03-12 03:52:58 +0000
+++ b/libcore/vm/fn_call.h      2010-04-21 22:06:19 +0000
@@ -86,7 +86,7 @@
     /// extends beyond a function call.
     void setReachable() const {
         std::for_each(_v.begin(), _v.end(),
-                std::mem_fun_ref(&as_value::setReachable));
+                      std::mem_fun_ref(&as_value::setReachable));
     }
 
     void swap(std::vector<T>& to) {
@@ -121,132 +121,131 @@
     ///                     null) whenever a function requires it.
     fn_call(as_object* this_in, const as_environment& env_in,
             Args& args, as_object* sup = 0, bool isNew = false)
-               :
-               this_ptr(this_in),
-               super(sup),
-               nargs(args.size()),
+       :
+        this_ptr(this_in),
+        super(sup),
+        nargs(args.size()),
         callerDef(0),
         _new(isNew),
-               _env(env_in)
-       {
-        args.swap(_args);
-       }
-
+        _env(env_in)
+        {
+            args.swap(_args);
+        }
+    
     fn_call(as_object* this_in, const as_environment& env_in)
-               :
-               this_ptr(this_in),
-               super(0),
-               nargs(0),
+       :
+       this_ptr(this_in),
+       super(0),
+       nargs(0),
         callerDef(0),
         _new(false),
-               _env(env_in)
+       _env(env_in)
        {
        }
-
+    
     /// Copy constructor
     fn_call(const fn_call& fn)
         :
         this_ptr(fn.this_ptr),
         super(fn.super),
-               nargs(fn.nargs),
+       nargs(fn.nargs),
         callerDef(fn.callerDef),
         _new(false),
         _env(fn._env),
         _args(fn._args)
        {
        }
-
-       /// The as_object (or a pointer derived thereof) on which this call
-       /// is taking place.
-       as_object* this_ptr;
-
-       /// The "super" object in this function call context
+    
+    /// The as_object (or a pointer derived thereof) on which this call
+    /// is taking place.
+    as_object* this_ptr;
+    
+    /// The "super" object in this function call context
     //
     /// If this is 0, the super may be constructed from the this pointer.
-       as_object* super;
-
-       /// Number of arguments to this ActionScript function call.
+    as_object* super;
+    
+    /// Number of arguments to this ActionScript function call.
     Args::size_type nargs;
-
+    
     /// Definition containing caller code. 0 if spontaneous (system event).
     const movie_definition* callerDef;
-
+    
     /// Return the VM this fn_call is running from
     VM& getVM() const
-    {
-        return _env.getVM();
-    }
-
-       /// Return true if this call is an object instantiation
-       bool isInstantiation() const
-       {
-               return _new;
-       }
-
-       /// Access a particular argument.
-       const Args::value_type& arg(unsigned int n) const
-       {
-               assert(n < nargs);
-               return _args[n]; 
-       }
-
+        {
+            return _env.getVM();
+        }
+    
+    /// Return true if this call is an object instantiation
+    bool isInstantiation() const
+       {
+            return _new;
+       }
+    
+    /// Access a particular argument.
+    const Args::value_type& arg(unsigned int n) const
+       {
+            assert(n < nargs);
+            return _args[n]; 
+       }
+    
     const Args::container_type& getArgs() const {
         return _args;
     }
-
-       void drop_bottom()
-       {
-               assert(!_args.empty());
-        _args.erase(_args.begin());
-               --nargs;
-       }
-
-       const as_environment& env() const
-       {
-               return _env;
-       }
-
-       /// Dump arguments to given output stream
-       void dump_args(std::ostream& os) const
-       {
-               for (size_t i = 0; i < nargs; ++i)
-               {
-                       if ( i ) os << ", ";
-                       os << arg(i).toDebugString();
-               }
-       }
-
-       /// Return arguments as a string (for debugging)
-       std::string dump_args() const
-       {
-               std::stringstream ss;
-               dump_args(ss);
-               return ss.str();
-       }
-
-       void resetArgs()
-       {
-               nargs = 0;
-               _args.clear();
-       }
-
-       void pushArg(const Args::value_type& arg)
-       {
-               ++nargs;
-               _args.push_back(arg);
-       }
-
+    
+    void drop_bottom()
+       {
+            assert(!_args.empty());
+            _args.erase(_args.begin());
+            --nargs;
+       }
+    
+    const as_environment& env() const
+       {
+            return _env;
+       }
+    
+    /// Dump arguments to given output stream
+    void dump_args(std::ostream& os) const
+       {
+            for (size_t i = 0; i < nargs; ++i) {
+                if ( i ) os << ", ";
+                os << arg(i).toDebugString();
+            }
+       }
+    
+    /// Return arguments as a string (for debugging)
+    std::string dump_args() const
+       {
+            std::stringstream ss;
+            dump_args(ss);
+            return ss.str();
+       }
+    
+    void resetArgs()
+       {
+            nargs = 0;
+            _args.clear();
+       }
+    
+    void pushArg(const Args::value_type& arg)
+       {
+            ++nargs;
+            _args.push_back(arg);
+       }
+    
 private:
 
     bool _new;
-
-       /// The ActionScript environment in which the function call is taking
-       /// place. This contains, among other things, the function arguments.
-       const as_environment& _env;
-
-       /// The actual arguments
+    
+    /// The ActionScript environment in which the function call is taking
+    /// place. This contains, among other things, the function arguments.
+    const as_environment& _env;
+    
+    /// The actual arguments
     Args::container_type _args;
-
+    
 };
 
 
@@ -275,7 +274,6 @@
     }
 };
 
-
 /// Check that the 'this' pointer is a DisplayObject
 //
 /// By default this just checks for any DisplayObject type.
@@ -322,9 +320,9 @@
 {
     as_object* obj = fn.this_ptr;
     if (!obj) throw ActionTypeError();
-
+    
     typename T::value_type* ret = T()(obj);
-
+    
     if (!ret) {
         std::string target = typeName(ret);
         std::string source = typeName(obj);
@@ -385,5 +383,5 @@
 
 // Local Variables:
 // mode: C++
-// indent-tabs-mode: t
+// indent-tabs-mode: nil
 // End:

=== modified file 'plugin/npapi/callbacks.cpp'
--- a/plugin/npapi/callbacks.cpp        2010-04-21 18:33:57 +0000
+++ b/plugin/npapi/callbacks.cpp        2010-04-21 19:46:03 +0000
@@ -75,6 +75,8 @@
 FSCommand
 #endif
 
+namespace gnash {
+
 // Callbacks for the default methods
 
 // As these callbacks use a generalized typedef for the signature, often some
@@ -676,6 +678,8 @@
     return false;
 }
 
+} // end of gnash namespace
+
 // local Variables:
 // mode: C++
 // indent-tabs-mode: nil

=== modified file 'plugin/npapi/callbacks.h'
--- a/plugin/npapi/callbacks.h  2010-04-15 20:13:21 +0000
+++ b/plugin/npapi/callbacks.h  2010-04-21 19:46:03 +0000
@@ -55,6 +55,8 @@
 /// request to the player while waiting for a response. So not having to wait
 /// can be a good thing to avoid issues.
 
+namespace gnash {
+
 /// Set a variable in the flash player
 ///
 /// @param npobj the NPObject to act on
@@ -287,6 +289,8 @@
 
 #endif // GNASH_PLUGIN_CALLBACKS_H
 
+} // end of gnash namespace
+
 // local Variables:
 // mode: C++
 // indent-tabs-mode: nil

=== modified file 'plugin/npapi/external.cpp'
--- a/plugin/npapi/external.cpp 2010-04-19 23:03:36 +0000
+++ b/plugin/npapi/external.cpp 2010-04-21 19:46:03 +0000
@@ -253,7 +253,6 @@
 NPVariant *
 ExternalInterface::parseXML(const std::string &xml)
 {
-
     NPVariant *value =  (NPVariant *)NPN_MemAlloc(sizeof(NPVariant));
     NULL_TO_NPVARIANT(*value);
     

=== modified file 'plugin/npapi/plugin.cpp'
--- a/plugin/npapi/plugin.cpp   2010-04-19 23:01:59 +0000
+++ b/plugin/npapi/plugin.cpp   2010-04-21 20:24:32 +0000
@@ -103,7 +103,16 @@
 #endif
 extern NPNetscapeFuncs NPNFuncs;
 
+namespace gnash {
 NPBool plugInitialized = FALSE;
+}
+
+/// \brief Return the MIME Type description for this plugin.
+char*
+NPP_GetMIMEDescription(void)
+{
+    return const_cast<char *>(MIME_TYPES_DESCRIPTION);
+}
 
 static bool waitforgdb = false;
 static bool createSaLauncher = false;
@@ -112,11 +121,15 @@
 // void GnashLogDebug(const std::string& msg);
 // void GnashLogError(const std::string& msg);
 
-/// \brief Return the MIME Type description for this plugin.
-char*
-NPP_GetMIMEDescription(void)
+static const char*
+getPluginDescription() 
 {
-    return const_cast<char *>(MIME_TYPES_DESCRIPTION);
+    static const char* desc = NULL;
+    if (!desc) {
+        desc = std::getenv("GNASH_PLUGIN_DESCRIPTION");
+        if (desc == NULL) desc = PLUGIN_DESCRIPTION;
+    }
+    return desc;
 }
 
 //
@@ -132,12 +145,12 @@
 NPError
 NS_PluginInitialize()
 {
-    if ( plugInitialized ) {
-        log_debug("NS_PluginInitialize called, but ignored (we already 
initialized)");
+    if ( gnash::plugInitialized ) {
+        gnash::log_debug("NS_PluginInitialize called, but ignored (we already 
initialized)");
         return NPERR_NO_ERROR;
     }
 
-    log_debug("NS_PluginInitialize call ---------------------------");
+    gnash::log_debug("NS_PluginInitialize call ---------------------------");
 
     // Browser Functionality Checks
 
@@ -152,10 +165,10 @@
                        (void *)&supportsXEmbed);
 
     if (err != NPERR_NO_ERROR || !supportsXEmbed) {
-        log_error("NPAPI ERROR: No xEmbed support in this browser!");
+        gnash::log_error("NPAPI ERROR: No xEmbed support in this browser!");
         return NPERR_INCOMPATIBLE_VERSION_ERROR;
     } else {
-        log_debug("xEmbed supported in this browser");
+        gnash::log_debug("xEmbed supported in this browser");
     }
 
     // GTK is not strictly required, but we do use the Glib main event loop,
@@ -165,10 +178,10 @@
 
     if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2) {
 #ifdef GNASH_PLUGIN_DEBUG
-        log_error("NPAPI ERROR: No GTK2 support in this browser! Have version 
%d", (int)toolkit);
+        gnash::log_error("NPAPI ERROR: No GTK2 support in this browser! Have 
version %d", (int)toolkit);
 #endif
     } else {
-        log_debug("GTK2 supported in this browser");
+        gnash::log_debug("GTK2 supported in this browser");
     }
 
     /*
@@ -176,7 +189,7 @@
     */
     char* opts = std::getenv("GNASH_OPTIONS");
     if (opts != NULL) {
-        log_debug(std::string("GNASH_OPTIONS : ") + std::string(opts));
+        gnash::log_debug(std::string("GNASH_OPTIONS : ") + std::string(opts));
         
         // Should the plugin wait for gdb to be attached?
         if ( strstr(opts, "waitforgdb") ) {
@@ -204,7 +217,7 @@
         newGnashRc.append(home);
         newGnashRc.append("/.gnashpluginrc");
     } else {
-        log_error("WARNING: NPAPI plugin could not find user home dir");
+        gnash::log_error("WARNING: NPAPI plugin could not find user home dir");
     }
 
     char *gnashrc = std::getenv("GNASHRC");
@@ -219,14 +232,14 @@
     gnashrc[PATH_MAX-1] = '\0';
 
     if ( putenv(gnashrc) ) {
-        log_debug("WARNING: NPAPI plugin could not append to the GNASHRC env 
variable");
+        gnash::log_debug("WARNING: NPAPI plugin could not append to the 
GNASHRC env variable");
     } else {
-        log_debug("NOTE: NPAPI plugin set GNASHRC to %d", newGnashRc);
+        gnash::log_debug("NOTE: NPAPI plugin set GNASHRC to %d", newGnashRc);
     }
 
     /* Success */
 
-    plugInitialized = TRUE;
+    gnash::plugInitialized = TRUE;
 
     return NPERR_NO_ERROR;
 }
@@ -242,7 +255,7 @@
 {
 #if 0
     if (!plugInitialized) {
-        log_debug("Plugin already shut down");
+        gnash::log_debug("Plugin already shut down");
         return;
     }
 
@@ -250,8 +263,6 @@
 #endif
 }
 
-
-
 /// \brief Retrieve values from the plugin for the Browser
 ///
 /// This C++ function is called by the browser to get certain
@@ -305,7 +316,7 @@
         return NULL;
     }
 
-    return new nsPluginInstance(aCreateDataStruct);
+    return new gnash::nsPluginInstance(aCreateDataStruct);
 }
 
 /// \brief destroy our plugin instance object
@@ -315,9 +326,11 @@
 void
 NS_DestroyPluginInstance(nsPluginInstanceBase* aPlugin)
 {
-    delete static_cast<nsPluginInstance *> (aPlugin);
+    delete static_cast<gnash::nsPluginInstance *> (aPlugin);
 }
 
+namespace gnash {
+
 //
 // nsPluginInstance class implementation
 //
@@ -337,7 +350,7 @@
     _filefd(-1),
     _name()
 {
-    // log_debug(__PRETTY_FUNCTION__);
+    // gnash::log_debug(__PRETTY_FUNCTION__);
 
     for (size_t i=0, n=data->argc; i<n; ++i) {
         std::string name, val;
@@ -380,11 +393,11 @@
                             reinterpret_cast<struct sockaddr *>(&sock_in),
                             sizeof(sock_in));
         if (ret == 0) {
-            log_debug("Connected to debug server on fd #%d", sockfd);
+            gnash::log_debug("Connected to debug server on fd #%d", sockfd);
             _controlfd = sockfd;
             _scriptObject->setControlFD(_controlfd);
         } else {
-            log_debug("Couldn't connect to debug server: %s", strerror(errno));
+            gnash::log_debug("Couldn't connect to debug server: %s", 
strerror(errno));
         }
     }
 #endif
@@ -402,13 +415,13 @@
 
     if (rv <= 0) {
         // The child process has not exited; it may be deadlocked. Kill it.
-        log_error("BUG: Child process is stuck. Killing it.");
+//        gnash::log_error("BUG: Child process is stuck. Killing it.");
 
         kill(*pid, SIGKILL);
         waitpid(*pid, &status, 0);
     }
  
-    log_debug("Child process exited with status %s", status);
+    gnash::log_debug("Child process exited with status %s", status);
 
     delete pid;
 
@@ -418,7 +431,7 @@
 /// \brief Destructor
 nsPluginInstance::~nsPluginInstance()
 {
-//    log_debug("plugin instance destruction");
+//    gnash::log_debug("plugin instance destruction");
 
     if ( _ichanWatchId ) {
         g_source_remove(_ichanWatchId);
@@ -439,7 +452,7 @@
             cleanup_childpid(pid);
         } else {
 
-            log_debug("Child process exited with status %d", status);
+            gnash::log_debug("Child process exited with status %d", status);
         }
     }
     _childpid = 0;
@@ -454,7 +467,7 @@
 nsPluginInstance::init(NPWindow* aWindow)
 {
     if(!aWindow) {
-        log_error("%s: ERROR: Window handle was bogus!", __PRETTY_FUNCTION__);
+        gnash::log_error("%s: ERROR: Window handle was bogus!", 
__PRETTY_FUNCTION__);
         return FALSE;
     } else {
 #if GNASH_PLUGIN_DEBUG > 1
@@ -478,7 +491,7 @@
 void
 nsPluginInstance::shut()
 {
-    log_debug("Gnash plugin shutting down");
+    gnash::log_debug("Gnash plugin shutting down");
 
     if (_streamfd != -1) {
         if (close(_streamfd) == -1) {
@@ -490,7 +503,7 @@
 
     if (_controlfd != -1) {
         if (close(_controlfd) != 0) {
-            log_error("Gnash plugin failed to close the control socket!");
+            gnash::log_error("Gnash plugin failed to close the control 
socket!");
         }
     }
 
@@ -510,11 +523,11 @@
 nsPluginInstance::SetWindow(NPWindow* aWindow)
 {
     if(!aWindow) {
-        log_error(std::string(__FUNCTION__) + ": ERROR: Window handle was 
bogus!");
+        gnash::log_error(std::string(__FUNCTION__) + ": ERROR: Window handle 
was bogus!");
         return NPERR_INVALID_PARAM;
 #if 0
     } else {
-        log_debug("%s: X origin = %d, Y Origin = %d, Width = %d,"
+        gnash::log_debug("%s: X origin = %d, Y Origin = %d, Width = %d,"
             " Height = %d, WindowID = %p, this = %p",
             __FUNCTION__,
             aWindow->x, aWindow->y, aWindow->width, aWindow->height,
@@ -550,7 +563,7 @@
             NPNFuncs.retainobject(_scriptObject);
             *v = _scriptObject;
         } else {
-            log_debug("_scriptObject is not assigned");
+            gnash::log_debug("_scriptObject is not assigned");
         }
     }
 #endif
@@ -562,7 +575,7 @@
 // FIXME: debugging stuff, will be gone soon after I figure how this works
 void myfunc(void */* param */)
 {
-    log_debug("Here I am!!!\n");
+    gnash::log_debug("Here I am!!!\n");
 }
 
 void
@@ -599,10 +612,10 @@
 #if 0
     // FIXME: debugging crap for now call javascript
     NPN_PluginThreadAsyncCall(_instance, myfunc, NULL);
-    // log_debug("FIXME: %s", getEmbedURL());
+    // gnash::log_debug("FIXME: %s", getEmbedURL());
 #endif
     
-    log_debug("The full URL is %s", _swf_url);
+    gnash::log_debug("The full URL is %s", _swf_url);
 
     if (!_swf_url.empty() && _window) {
         startProc();
@@ -631,7 +644,7 @@
 int32_t
 nsPluginInstance::WriteReady(NPStream* /* stream */ )
 {
-    //log_debug("Stream for %s is ready", stream->url);
+    //gnash::log_debug("Stream for %s is ready", stream->url);
     if ( _streamfd != -1 ) {
        return 1024;
     } else {
@@ -665,7 +678,7 @@
     log_trace(__PRETTY_FUNCTION__);
     
     if ( cond & G_IO_HUP ) {
-        log_debug("Player request channel hang up");
+        gnash::log_debug("Player request channel hang up");
         // Returning false here will cause the "watch" to be removed. This 
watch
         // is the only reference held to the GIOChannel, so it will be
         // destroyed. We must make sure we don't attempt to destroy it again.
@@ -675,7 +688,7 @@
 
     assert(cond & G_IO_IN);
 
-    log_debug("Checking player requests on fd #%d",
+    gnash::log_debug("Checking player requests on fd #%d",
               g_io_channel_unix_get_fd(iochan));
 
     do {
@@ -686,22 +699,22 @@
                            &requestSize, NULL, &error);
         switch ( status ) {
             case G_IO_STATUS_ERROR:
-                log_error(std::string("Error reading request line: ") + 
error->message);
+                gnash::log_error(std::string("Error reading request line: ") + 
error->message);
 
                 g_error_free(error);
                 return false;
             case G_IO_STATUS_EOF:
-                log_error(std::string("EOF (error: ") + error->message);
+                gnash::log_error(std::string("EOF (error: ") + error->message);
                 return false;
             case G_IO_STATUS_AGAIN:
-                log_error(std::string("Read again(error: ") + error->message);
+                gnash::log_error(std::string("Read again(error: ") + 
error->message);
                 break;
             case G_IO_STATUS_NORMAL:
                 // process request
-                log_debug("Normal read: " + std::string(request));
+                gnash::log_debug("Normal read: " + std::string(request));
                 break;
             default:
-                log_error("Abnormal status!");
+                gnash::log_error("Abnormal status!");
                 return false;
             
         }
@@ -720,7 +733,7 @@
 nsPluginInstance::processPlayerRequest(gchar* buf, gsize linelen)
 {
     if ( linelen < 4 ) {
-        log_error(std::string("Invalid player request (too short): ") +  buf);
+        gnash::log_error(std::string("Invalid player request (too short): ") + 
 buf);
         return false;
     }
 
@@ -728,7 +741,7 @@
         char* target = buf + 4;
         if ( ! *target )
         {
-            log_error("No target found after GET request");
+            gnash::log_error("No target found after GET request");
             return false;
         }
         char* url = target;
@@ -737,18 +750,18 @@
             *url='\0';
             ++url;
         } else {
-            log_error("No colon found after GETURL target string");
+            gnash::log_error("No colon found after GETURL target string");
             return false;
         }
 
-        log_debug("Asked to get URL '%s' in target %s", url, target);
+        gnash::log_debug("Asked to get URL '%s' in target %s", url, target);
         NPN_GetURL(_instance, url, target);
         return true;
 
     } else if ( ! std::strncmp(buf, "INVOKE ", 7) ) {
         char* command = buf + 7;
         if ( ! *command ) {
-            log_error("No command found after INVOKE request");
+            gnash::log_error("No command found after INVOKE request");
             return false;
         }
         char* arg = command;
@@ -757,7 +770,7 @@
             *arg='\0';
             ++arg;
         } else {
-            log_error("No colon found after INVOKE command string");
+            gnash::log_error("No colon found after INVOKE command string");
             return false;
         }
 
@@ -769,7 +782,7 @@
         // TODO: check if _self is a good target for this
         static const char* tgt = "_self";
 
-        log_debug("Calling NPN_GetURL(" + jsurl.str() + ", '" + 
std::string(tgt) + "');");
+        gnash::log_debug("Calling NPN_GetURL(" + jsurl.str() + ", '" + 
std::string(tgt) + "');");
 
         NPN_GetURL(_instance, jsurl.str().c_str(), tgt);
         return true;
@@ -785,7 +798,7 @@
         }
         else
         {
-            log_error("No colon found after getURL postdata string");
+            gnash::log_error("No colon found after getURL postdata string");
             return false;
         }
         
@@ -795,7 +808,7 @@
             *url='\0';
             ++url;
         } else {
-            log_error("No $ character found after getURL target string");
+            gnash::log_error("No $ character found after getURL target 
string");
             return false;
         }
         
@@ -805,7 +818,7 @@
 
         return true;
     } else {
-        log_error("Unknown player request: " + std::string(buf));
+        gnash::log_error("Unknown player request: " + std::string(buf));
         return false;
     }
 }
@@ -823,7 +836,7 @@
         procname = gnash_env;
         process_found = (0 == stat(procname.c_str(), &procstats));
         if (!process_found) {
-            log_error("Invalid path to gnash executable: ");
+            gnash::log_error("Invalid path to gnash executable: ");
             return "";
         }
     }
@@ -838,7 +851,7 @@
     }
 
     if (!process_found) {
-        log_error(std::string("Unable to find Gnash in ") + GNASHBINDIR);
+        gnash::log_error(std::string("Unable to find Gnash in ") + 
GNASHBINDIR);
         return "";
     }
 
@@ -864,7 +877,7 @@
     saLauncher.open(ss.str().c_str(), std::ios::out | std::ios::trunc);
 
     if (!saLauncher) {
-        log_error("Failed to open new file for standalone launcher: " + 
ss.str());
+        gnash::log_error("Failed to open new file for standalone launcher: " + 
ss.str());
         return;
     }
 
@@ -897,7 +910,7 @@
 
     std::string cmd = getGnashExecutable();
     if (cmd.empty()) {
-        log_error("Failed to locate the Gnash executable!");
+        gnash::log_error("Failed to locate the Gnash executable!");
         return arg_vec;
     }
     arg_vec.push_back(cmd);
@@ -907,7 +920,7 @@
     
     const char* pageurl = getCurrentPageURL();
     if (!pageurl) {
-        log_error("Could not get current page URL!");
+        gnash::log_error("Could not get current page URL!");
     } else {
         arg_vec.push_back("-U");
         arg_vec.push_back(pageurl);
@@ -963,7 +976,7 @@
             closed++;
         }
     }
-    log_debug("Closed %d files.", closed);
+    gnash::log_debug("Closed %d files.", closed);
 } 
 
 void
@@ -997,7 +1010,7 @@
     
     int ret = pipe(p2c_pipe);
     if (ret == -1) {
-        log_error("ERROR: parent to child pipe() failed: " +
+        gnash::log_error("ERROR: parent to child pipe() failed: " +
                  std::string(std::strerror(errno)));
     }
     _streamfd = p2c_pipe[1];
@@ -1006,14 +1019,14 @@
     int c2p_pipe[2];
     ret = pipe(c2p_pipe);
     if (ret == -1) {
-        log_error("ERROR: child to parent pipe() failed: " +
+        gnash::log_error("ERROR: child to parent pipe() failed: " +
                  std::string(std::strerror(errno)));
     }
 
     int p2c_controlpipe[2];
     ret = pipe(p2c_controlpipe);
     if (ret == -1) {
-        log_error("ERROR: parent to child pipe() failed: " +
+        gnash::log_error("ERROR: parent to child pipe() failed: " +
                  std::string(std::strerror(errno)));
     }
 
@@ -1035,7 +1048,7 @@
                                                   _scriptObject->getWriteFD());
 
     if (arg_vec.empty()) {
-        log_error("Failed to obtain command line parameters.");
+        gnash::log_error("Failed to obtain command line parameters.");
         return;
     }
     
@@ -1051,7 +1064,7 @@
     
     // If the fork failed, childpid is -1. So print out an error message.
     if (_childpid == -1) {
-        log_error("ERROR: dup2() failed: " + std::string(strerror(errno)));
+        gnash::log_error("ERROR: dup2() failed: " + 
std::string(strerror(errno)));
         return;
     }
     
@@ -1061,21 +1074,21 @@
         // we want to write to p2c pipe, so close read-fd0
         ret = close (p2c_pipe[0]);
         if (ret == -1) {
-            log_error("ERROR: p2c_pipe[0] close() failed: " +
+            gnash::log_error("ERROR: p2c_pipe[0] close() failed: " +
                           std::string(strerror(errno)));
         }
 #if 0
         // we want to read from c2p pipe, so close write-fd1
         ret = close (c2p_pipe[1]);
         if (ret == -1) {
-            log_error("ERROR: c2p_pipe[1] close() failed: " + 
+            gnash::log_error("ERROR: c2p_pipe[1] close() failed: " + 
                           std::string(strerror(errno)));
         }
         
         ret = close (p2c_controlpipe[0]); // close read descriptor
 #endif
         
-        log_debug("Forked successfully, child process PID is %d" , _childpid);
+        gnash::log_debug("Forked successfully, child process PID is %d" , 
_childpid);
       
         return;
     }
@@ -1090,7 +1103,7 @@
     ret = dup2 (p2c_pipe[0], fileno(stdin));
     
     if (ret == -1) {
-        log_error("ERROR: dup2() failed: " + std::string(strerror(errno)));
+        gnash::log_error("ERROR: dup2() failed: " + 
std::string(strerror(errno)));
     }
 
     // Close all of the browser's file descriptors that we just inherited
@@ -1101,7 +1114,7 @@
 
     // Start the desired executable and go away.
     
-    log_debug("Starting process: %s", boost::algorithm::join(arg_vec, " "));
+    gnash::log_debug("Starting process: %s", boost::algorithm::join(arg_vec, " 
"));
 
     wait_for_gdb();
 
@@ -1128,7 +1141,7 @@
     NPN_ReleaseObject(window);
 
     if (!NPVARIANT_IS_OBJECT(vDoc)) {
-        log_error("Can't get window object");
+        gnash::log_error("Can't get window object");
         return NULL;
     }
     
@@ -1140,7 +1153,7 @@
     NPN_ReleaseObject(npDoc);
 
     if (!NPVARIANT_IS_OBJECT(vLoc)) {
-        log_error("Can't get window.location object");
+        gnash::log_error("Can't get window.location object");
         return NULL;
     }
 
@@ -1152,7 +1165,7 @@
     NPN_ReleaseObject(npLoc);
 
     if (!NPVARIANT_IS_STRING(vProp)) {
-        log_error("Can't get window.location.href object");
+        gnash::log_error("Can't get window.location.href object");
         return NULL;
     }
 
@@ -1161,17 +1174,6 @@
     return propValue.UTF8Characters; // const char *
 }
 
-static const char*
-getPluginDescription() 
-{
-    static const char* desc = NULL;
-    if (!desc) {
-        desc = std::getenv("GNASH_PLUGIN_DESCRIPTION");
-        if (desc == NULL) desc = PLUGIN_DESCRIPTION;
-    }
-    return desc;
-}
-
 void
 processLog_error(const boost::format& fmt)
 {
@@ -1200,6 +1202,8 @@
 { /* do nothing */ }
 #endif
 
+} // end of gnash namespace
+
 // Local Variables:
 // mode: C++
 // indent-tabs-mode: nil

=== modified file 'plugin/npapi/plugin.h'
--- a/plugin/npapi/plugin.h     2010-04-19 23:46:40 +0000
+++ b/plugin/npapi/plugin.h     2010-04-21 19:46:03 +0000
@@ -56,6 +56,8 @@
 #include "pluginbase.h"
 #include "pluginScriptObject.h"
 
+namespace gnash {
+
 extern NPBool      plugInitialized;
 
 class nsPluginInstance : public nsPluginInstanceBase
@@ -197,6 +199,8 @@
 // end of __PLUGIN_H__
 #endif
 
+} // end of gnash namespace
+
 // local Variables:
 // mode: C++
 // indent-tabs-mode: nil

=== modified file 'plugin/npapi/pluginScriptObject.cpp'
--- a/plugin/npapi/pluginScriptObject.cpp       2010-04-21 18:33:57 +0000
+++ b/plugin/npapi/pluginScriptObject.cpp       2010-04-21 19:46:03 +0000
@@ -55,6 +55,8 @@
 
 extern NPNetscapeFuncs NPNFuncs;
 
+namespace gnash {
+
 // NPClass of GnashPluginScriptObject
 static NPClass GnashPluginScriptObjectClass = {
     NP_CLASS_STRUCT_VERSION,
@@ -1072,6 +1074,8 @@
     }
 }
 
+} // end of gnash namespace
+
 // local Variables:
 // mode: C++
 // indent-tabs-mode: nil

=== modified file 'plugin/npapi/pluginScriptObject.h'
--- a/plugin/npapi/pluginScriptObject.h 2010-04-21 14:33:46 +0000
+++ b/plugin/npapi/pluginScriptObject.h 2010-04-21 19:46:03 +0000
@@ -45,6 +45,8 @@
 #define READFD 0
 #define WRITEFD 1
 
+namespace gnash {
+
 /// Makes a deep copy of a NPVariant.
 /// @param from The source NPVariant to copy values from.
 /// @param to The destination NPVariant.
@@ -190,6 +192,8 @@
     int         _watchid;
 };
 
+} // end of gnash namespace
+
 #endif // GNASH_PLUGIN_SCRIPT_OBJECT_H
 
 // local Variables:

=== modified file 'testsuite/actionscript.all/ExternalInterface.as'
--- a/testsuite/actionscript.all/ExternalInterface.as   2010-04-21 02:54:52 
+0000
+++ b/testsuite/actionscript.all/ExternalInterface.as   2010-04-21 22:08:59 
+0000
@@ -242,7 +242,18 @@
 }
 
 // check(r instanceOf EI);
+if (r instanceOf EI) {
+    pass("ExternalInterface instanceOf");
+} else {
+    fail("ExternalInterface instanceOf");
+}
 
+// But it doesn't do much.
+if (r._toXML(o) == undefined) {
+    pass("ExternalInterface undefined");
+} else {
+    fail("ExternalInterface undefined");
+}
 
 xml = EI._objectToXML(nc);
 if (xml == '<object></object>') {
@@ -387,11 +398,12 @@
     fail("ExternalInterface::_toAS(false)");
 }
 
-val = EI._toAS('<object><property 
id="b"><string>string</string></property><property 
id="a"><number>1</number></property></object>');
+val = EI._objectToAS('<object><property 
id="b"><string>string</string></property><property 
id="a"><number>1</number></property></object>');
+trace(val);
 if (typeOf(val) == "object") {
-    xpass("ExternalInterface::_toAS(object)");
+    xpass("ExternalInterface::_objectToAS(object)");
 } else {
-    xfail("ExternalInterface::_toAS(object)");
+    xfail("ExternalInterface::_objectToAS(object)");
 }
 
 #endif  // version > 7


reply via email to

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