gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11081: Migrations for Stage and Sha


From: Sharad Desai
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11081: Migrations for Stage and SharedObject (100% working)
Date: Thu, 11 Jun 2009 15:02:00 -0600
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11081
committer: Sharad Desai <address@hidden>
branch nick: trunk
timestamp: Thu 2009-06-11 15:02:00 -0600
message:
  Migrations for Stage and SharedObject (100% working)
modified:
  libcore/asobj/flash/display/Stage_as.cpp
  libcore/asobj/flash/display/Stage_as.h
  libcore/asobj/flash/net/SharedObject_as.cpp
  libcore/asobj/flash/net/SharedObject_as.h
    ------------------------------------------------------------
    revno: 11063.1.1
    committer: Sharad Desai <address@hidden>
    branch nick: desaiTst
    timestamp: Thu 2009-06-11 14:48:16 -0600
    message:
      Migrations for Stage and SharedObject (100% working)
    modified:
      libcore/asobj/flash/display/Stage_as.cpp
      libcore/asobj/flash/display/Stage_as.h
      libcore/asobj/flash/net/SharedObject_as.cpp
      libcore/asobj/flash/net/SharedObject_as.h
=== modified file 'libcore/asobj/flash/display/Stage_as.cpp'
--- a/libcore/asobj/flash/display/Stage_as.cpp  2009-06-09 15:51:03 +0000
+++ b/libcore/asobj/flash/display/Stage_as.cpp  2009-06-11 20:48:16 +0000
@@ -1,6 +1,6 @@
-// Stage_as.cpp:  ActionScript "Stage" class, for Gnash.
-//
-//   Copyright (C) 2009 Free Software Foundation, Inc.
+// Stage_as.cpp:  All the world is one, for Gnash.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -22,15 +22,12 @@
 #endif
 
 #include "display/Stage_as.h"
+#include "movie_root.h"
+#include "as_object.h" // for inheritance
 #include "log.h"
 #include "fn_call.h"
 #include "smart_ptr.h" // for boost intrusive_ptr
 #include "builtin_function.h" // need builtin_function
-#include "GnashException.h" // for ActionException
-
-// ADDED
-#include "movie_root.h"
-#include "as_object.h" // for inheritance
 #include "VM.h"
 #include "Object.h" // for getObjectInterface()
 #include "AsBroadcaster.h" // for initializing self as a broadcaster
@@ -38,7 +35,6 @@
 #include "StringPredicates.h"
 
 #include <string>
-// END ADDED SECTION
 
 namespace gnash {
 
@@ -50,7 +46,7 @@
 static as_value stage_displaystate_getset(const fn_call& fn);
 static const char* getScaleModeString(movie_root::ScaleMode sm);
 static const char* getDisplayStateString(movie_root::DisplayState ds);
-       
+
 void registerStageNative(as_object& o)
 {
        VM& vm = o.getVM();
@@ -67,31 +63,23 @@
     vm.registerNative(stage_showMenu_getset, 666, 10);
 }
 
-
-// Forward declarations
-namespace {
-    as_value stage_addChildAt(const fn_call& fn);
-    as_value stage_addEventListener(const fn_call& fn);
-    as_value stage_dispatchEvent(const fn_call& fn);
-    as_value stage_hasEventListener(const fn_call& fn);
-    as_value stage_invalidate(const fn_call& fn);
-    as_value stage_isFocusInaccessible(const fn_call& fn);
-    as_value stage_removeChildAt(const fn_call& fn);
-    as_value stage_setChildIndex(const fn_call& fn);
-    as_value stage_swapChildrenAt(const fn_call& fn);
-    as_value stage_willTrigger(const fn_call& fn);
-    as_value stage_fullScreen(const fn_call& fn);
-    as_value stage_mouseLeave(const fn_call& fn);
-    as_value stage_resize(const fn_call& fn);
-    as_value stage_ctor(const fn_call& fn);
-    void attachStageInterface(as_object& o);
-    void attachStageStaticInterface(as_object& o);
-    as_object* getStageInterface();
-    
-// ADDED
+static void
+attachStageInterface(as_object& o)
+{
+    const int version = o.getVM().getSWFVersion();
+
+    if ( version < 5 ) return;
+
+    o.init_property("scaleMode", &stage_scalemode_getset, 
&stage_scalemode_getset);
+    o.init_property("align", &stage_align_getset, &stage_align_getset);
+    o.init_property("width", &stage_width_getset, &stage_width_getset);
+    o.init_property("height", &stage_height_getset, &stage_height_getset);
+    o.init_property("showMenu", &stage_showMenu_getset, 
&stage_showMenu_getset);
+    o.init_property("displayState", &stage_displaystate_getset, 
&stage_displaystate_getset);
 
 }
 
+
 Stage_as::Stage_as()
        :
        as_object(getObjectInterface())
@@ -105,6 +93,7 @@
        }
 }
 
+
 void
 Stage_as::notifyFullScreen(bool fs)
 {
@@ -122,7 +111,7 @@
        callMethod(NSV::PROP_BROADCAST_MESSAGE, "onResize");
 }
 
-// ADDED
+
 const char*
 getDisplayStateString(movie_root::DisplayState ds)
 {
@@ -133,7 +122,7 @@
        return displayStateName[ds];
 }
 
-// ADDED
+
 const char*
 getScaleModeString(movie_root::ScaleMode sm)
 {
@@ -146,7 +135,7 @@
        return modeName[sm];
 }
 
-// ADDED
+
 as_value
 stage_scalemode_getset(const fn_call& fn)
 {
@@ -179,8 +168,6 @@
        }
 }
 
-
-// ADDED
 as_value
 stage_width_getset(const fn_call& fn)
 {
@@ -199,7 +186,6 @@
     return as_value(m.getStageWidth());
 }
 
-// ADDED
 as_value
 stage_height_getset(const fn_call& fn)
 {
@@ -218,7 +204,7 @@
     return as_value(m.getStageHeight());
 }
 
-// ADDED
+
 as_value
 stage_align_getset(const fn_call& fn)
 {
@@ -263,7 +249,6 @@
        }
 }
 
-// ADDED
 as_value
 stage_showMenu_getset(const fn_call& fn)
 {
@@ -281,7 +266,6 @@
        }
 }
 
-// ADDED
 as_value
 stage_displaystate_getset(const fn_call& fn)
 {
@@ -310,209 +294,8 @@
 // extern (used by Global.cpp)
 void stage_class_init(as_object& global)
 {
-    static boost::intrusive_ptr<builtin_function> cl;
-
-    if (!cl) {
-        cl = new builtin_function(&stage_ctor, getStageInterface());
-        attachStageStaticInterface(*cl);
-    }
-
-    // Register _global.Stage
-    global.init_member("Stage", cl.get());
-}
-
-namespace {
-
-void
-attachStageInterface(as_object& o)
-{
-       const int version = o.getVM().getSWFVersion();
-
-    if ( version < 5 ) return;
-
-    o.init_property("scaleMode", &stage_scalemode_getset, 
&stage_scalemode_getset);
-    o.init_property("align", &stage_align_getset, &stage_align_getset);
-    o.init_property("width", &stage_width_getset, &stage_width_getset);
-    o.init_property("height", &stage_height_getset, &stage_height_getset);
-    o.init_property("showMenu", &stage_showMenu_getset, 
&stage_showMenu_getset);
-    o.init_property("displayState", &stage_displaystate_getset, 
&stage_displaystate_getset);
-
-
-    o.init_member("addChildAt", new builtin_function(stage_addChildAt));
-    o.init_member("addEventListener", new 
builtin_function(stage_addEventListener));
-    o.init_member("dispatchEvent", new builtin_function(stage_dispatchEvent));
-    o.init_member("hasEventListener", new 
builtin_function(stage_hasEventListener));
-    o.init_member("invalidate", new builtin_function(stage_invalidate));
-    o.init_member("isFocusInaccessible", new 
builtin_function(stage_isFocusInaccessible));
-    o.init_member("removeChildAt", new builtin_function(stage_removeChildAt));
-    o.init_member("setChildIndex", new builtin_function(stage_setChildIndex));
-    o.init_member("swapChildrenAt", new 
builtin_function(stage_swapChildrenAt));
-    o.init_member("willTrigger", new builtin_function(stage_willTrigger));
-    o.init_member("fullScreen", new builtin_function(stage_fullScreen));
-    o.init_member("mouseLeave", new builtin_function(stage_mouseLeave));
-    o.init_member("resize", new builtin_function(stage_resize));
-}
-
-void
-attachStageStaticInterface(as_object& o)
-{
-
-}
-
-as_object*
-getStageInterface()
-{
-    static boost::intrusive_ptr<as_object> o;
-    if ( ! o ) {
-        o = new as_object();
-        attachStageInterface(*o);
-    }
-    return o.get();
-}
-
-as_value
-stage_addChildAt(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_addEventListener(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_dispatchEvent(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_hasEventListener(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_invalidate(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_isFocusInaccessible(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_removeChildAt(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_setChildIndex(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_swapChildrenAt(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_willTrigger(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_fullScreen(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_mouseLeave(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_resize(const fn_call& fn)
-{
-    boost::intrusive_ptr<Stage_as> ptr =
-        ensureType<Stage_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-stage_ctor(const fn_call& fn)
-{
-    boost::intrusive_ptr<as_object> obj = new Stage_as;
-
-    return as_value(obj.get()); // will keep alive
-}
-
-} // anonymous namespace 
-} // gnash namespace
-
-// local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
-
+       static boost::intrusive_ptr<as_object> obj = new Stage_as();
+       global.init_member("Stage", obj.get());
+}
+
+} // end of gnash namespace

=== modified file 'libcore/asobj/flash/display/Stage_as.h'
--- a/libcore/asobj/flash/display/Stage_as.h    2009-06-08 21:22:11 +0000
+++ b/libcore/asobj/flash/display/Stage_as.h    2009-06-11 20:48:16 +0000
@@ -1,6 +1,5 @@
-// Stage_as.h:  ActionScript 3 "Stage" class, for Gnash.
-//
-//   Copyright (C) 2009 Free Software Foundation, Inc.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -17,25 +16,16 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-#ifndef GNASH_ASOBJ3_STAGE_H
-#define GNASH_ASOBJ3_STAGE_H
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-// ADDED
+#ifndef GNASH_ASOBJ_STAGE_H
+#define GNASH_ASOBJ_STAGE_H
+
 #include "as_object.h" // for inheritance
 #include "movie_root.h" // for access to scaleMode
 
 #include <list>
 
-// Forward declarations
-class as_object;
-
 namespace gnash {
-       
-// ADDED
+
 /// This is the Stage ActionScript object.
 //
 /// Some Stage methods are implemented in movie_root, because
@@ -67,19 +57,13 @@
 
 };
 
+/// Register native functions with the VM.
+void registerStageNative(as_object& o);
+
 /// Initialize the global Stage class
 void stage_class_init(as_object& global);
-
-// ADDED
-void registerStageNative(as_object& o);
-
-} // gnash namespace
-
-// GNASH_ASOBJ3_STAGE_H
+  
+} // end of gnash namespace
+
 #endif
 
-// local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
-

=== modified file 'libcore/asobj/flash/net/SharedObject_as.cpp'
--- a/libcore/asobj/flash/net/SharedObject_as.cpp       2009-06-08 21:22:11 
+0000
+++ b/libcore/asobj/flash/net/SharedObject_as.cpp       2009-06-11 20:48:16 
+0000
@@ -1,6 +1,6 @@
 // SharedObject_as.cpp:  ActionScript "SharedObject" class, for Gnash.
-//
-//   Copyright (C) 2009 Free Software Foundation, Inc.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -18,17 +18,10 @@
 //
 
 #ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
+#include "gnashconfig.h" // USE_SOL_READ_ONLY
 #endif
 
-#include "flash/net/SharedObject_as.h"
-#include "log.h"
-#include "fn_call.h"
-#include "smart_ptr.h" // for boost intrusive_ptr
-#include "builtin_function.h" // need builtin_function
-#include "GnashException.h" // for ActionException
-
-// ADDED
+#include "movie_root.h"
 #include "GnashSystemNetHeaders.h"
 #include "GnashFileUtilities.h" // stat
 #include "SimpleBuffer.h"
@@ -36,8 +29,12 @@
 #include "amf.h"
 #include "element.h"
 #include "sol.h"
-#include "movie_root.h"
+#include "net/SharedObject_as.h"
 #include "as_object.h" // for inheritance
+#include "log.h"
+#include "fn_call.h"
+#include "smart_ptr.h" // for boost intrusive_ptr
+#include "builtin_function.h" // need builtin_function
 #include "Object.h" // for getObjectInterface
 #include "VM.h"
 #include "Property.h"
@@ -64,41 +61,33 @@
 
 // Forward declarations
 namespace {
-           as_value sharedobject_close(const fn_call& fn);
-           as_value sharedobject_connect(const fn_call& fn);
-           as_value sharedobject_flush(const fn_call& fn);
-           as_value sharedobject_getLocal(const fn_call& fn);
-           as_value sharedobject_getRemote(const fn_call& fn);
-           as_value sharedobject_send(const fn_call& fn);
-           as_value sharedobject_setDirty(const fn_call& fn);
-           as_value sharedobject_setProperty(const fn_call& fn);
-           as_value sharedobject_asyncError(const fn_call& fn);
-           as_value sharedobject_netStatus(const fn_call& fn);
-           as_value sharedobject_sync(const fn_call& fn);
-           as_value sharedobject_ctor(const fn_call& fn);
-           void attachSharedObjectInterface(as_object& o);
-           void attachSharedObjectStaticInterface(as_object& o);
+
+    as_value sharedobject_connect(const fn_call& fn);
+    as_value sharedobject_send(const fn_call& fn);
+    as_value sharedobject_flush(const fn_call& fn);
+    as_value sharedobject_close(const fn_call& fn);
+    as_value sharedobject_getsize(const fn_call& fn);
+    as_value sharedobject_setFps(const fn_call& fn);
+    as_value sharedobject_clear(const fn_call& fn);
+    as_value sharedobject_deleteAll(const fn_call& fn);
+    as_value sharedobject_getDiskUsage(const fn_call& fn);
+    as_value sharedobject_getRemote(const fn_call& fn);
+    as_value sharedobject_data(const fn_call& fn);
+
+    as_value sharedobject_getLocal(const fn_call& fn);
+    as_value sharedobject_ctor(const fn_call& fn);
+
+    as_object* readSOL(VM& vm, const std::string& filespec);
+
     as_object* getSharedObjectInterface();
-
-       // ADDED
-               as_value sharedobject_getsize(const fn_call& fn);
-           as_value sharedobject_setFps(const fn_call& fn);
-           as_value sharedobject_clear(const fn_call& fn);
-           as_value sharedobject_deleteAll(const fn_call& fn);
-           as_value sharedobject_getDiskUsage(const fn_call& fn);
-           as_value sharedobject_data(const fn_call& fn);
-    
-               as_object* readSOL(VM& vm, const std::string& filespec);
-
-           as_object* getSharedObjectInterface();
-           void flushSOL(SharedObjectLibrary::SoLib::value_type& sol);
-           bool validateName(const std::string& solName);
-    
-       
+    void attachSharedObjectStaticInterface(as_object& o);
+    void flushSOL(SharedObjectLibrary::SoLib::value_type& sol);
+    bool validateName(const std::string& solName);
 }
 
-// ADDED
 // Serializer helper
+namespace { 
+
 class PropsSerializer : public AbstractPropertyVisitor
 {
 public:
@@ -228,7 +217,8 @@
     bool _error;
 };
 
-// MODIFIED
+} // anonymous namespace
+
 class SharedObject_as: public as_object 
 {
 public:
@@ -300,10 +290,12 @@
     SOL _sol;
 };
 
+
 SharedObject_as::~SharedObject_as()
 {
 }
 
+
 bool
 SharedObject_as::flush(int space) const
 {
@@ -410,6 +402,7 @@
     return true;
 }
 
+
 SharedObjectLibrary::SharedObjectLibrary(VM& vm)
     :
     _vm(vm)
@@ -610,54 +603,78 @@
     return obj;
 }
 
-
-// UNCHANGED
-// extern (used by Global.cpp)
-void 
+void
 sharedobject_class_init(as_object& global)
 {
     static boost::intrusive_ptr<builtin_function> cl;
-
-    if (!cl) {
-        cl = new builtin_function(&sharedobject_ctor, 
getSharedObjectInterface());
+    
+    if (cl == NULL) {
+        cl=new builtin_function(&sharedobject_ctor, 
getSharedObjectInterface());
         attachSharedObjectStaticInterface(*cl);
     }
-
+    
     // Register _global.SharedObject
-    global.init_member("SharedObject", cl.get());
-}
-
+    global.init_member("SharedObject", cl.get());    
+}
+
+void
+registerSharedObjectNative(as_object& o)
+{
+    VM& vm = o.getVM();
+
+    // ASnative table registration
+       vm.registerNative(sharedobject_connect, 2106, 0);
+       vm.registerNative(sharedobject_send, 2106, 1);
+       vm.registerNative(sharedobject_flush, 2106, 2);
+       vm.registerNative(sharedobject_close, 2106, 3);
+       vm.registerNative(sharedobject_getsize, 2106, 4);
+       vm.registerNative(sharedobject_setFps, 2106, 5);
+       vm.registerNative(sharedobject_clear, 2106, 6);
+
+    // FIXME: getRemote and getLocal use both these methods,
+    // but aren't identical with either of them.
+    // TODO: The first method looks in a library and returns either a
+    // SharedObject or null. The second takes a new SharedObject as
+    // its first argument and populates its data member (more or less
+    // like readSOL). This is only important for ASNative compatibility.
+       vm.registerNative(sharedobject_getLocal, 2106, 202);
+       vm.registerNative(sharedobject_getRemote, 2106, 203);
+       vm.registerNative(sharedobject_getLocal, 2106, 204);
+       vm.registerNative(sharedobject_getRemote, 2106, 205);
+
+       vm.registerNative(sharedobject_deleteAll, 2106, 206);
+       vm.registerNative(sharedobject_getDiskUsage, 2106, 207);
+}
+
+
+/// SharedObject AS interface
 namespace {
 
 void
 attachSharedObjectInterface(as_object& o)
 {
-       //VM& vm = o.getVM();
-
-       o.init_member("close", new builtin_function(sharedobject_close));
-       o.init_member("connect", new builtin_function(sharedobject_connect));
-       o.init_member("flush", new builtin_function(sharedobject_flush));
-       o.init_member("getLocal", new builtin_function(sharedobject_getLocal));
-       o.init_member("getRemote", new 
builtin_function(sharedobject_getRemote));
-       o.init_member("send", new builtin_function(sharedobject_send));
-       o.init_member("setDirty", new builtin_function(sharedobject_setDirty));
-       o.init_member("setProperty", new 
builtin_function(sharedobject_setProperty));
-       o.init_member("asyncError", new 
builtin_function(sharedobject_asyncError));
-       o.init_member("netStatus", new 
builtin_function(sharedobject_netStatus));
-       o.init_member("sync", new builtin_function(sharedobject_sync));
-       
-       // ADDED
-       o.init_member("getSize", new builtin_function(sharedobject_getsize));
-    o.init_member("setFps", new builtin_function(sharedobject_setFps));
-    o.init_member("clear", new builtin_function(sharedobject_clear));
+
+    VM& vm = o.getVM();
+
+    const int flags = as_prop_flags::dontEnum |
+                      as_prop_flags::dontDelete |
+                      as_prop_flags::onlySWF6Up;
+
+    o.init_member("connect", vm.getNative(2106, 0), flags);
+    o.init_member("send", vm.getNative(2106, 1), flags);
+    o.init_member("flush", vm.getNative(2106, 2), flags);
+    o.init_member("close", vm.getNative(2106, 3), flags);
+    o.init_member("getSize", vm.getNative(2106, 4), flags);
+    o.init_member("setFps", vm.getNative(2106, 5), flags);
+    o.init_member("clear", vm.getNative(2106, 6), flags);
 
 }
 
+
 void
 attachSharedObjectStaticInterface(as_object& o)
 {
-       // MODIFIED
-       VM& vm = o.getVM();
+    VM& vm = o.getVM();
 
     const int flags = 0;
 
@@ -672,57 +689,80 @@
     o.init_member("getDiskUsage",  vm.getNative(2106, 207), hiddenOnly);
 }
 
-// ADDED
-as_value
-sharedobject_clear(const fn_call& fn)
-{
-    boost::intrusive_ptr<SharedObject_as> obj = 
-        ensureType<SharedObject_as>(fn.this_ptr);
-    UNUSED(obj);
-    
-    LOG_ONCE(log_unimpl (__FUNCTION__));
-
-    return as_value();
-}
-
-// UNCHANGED
+
 as_object*
 getSharedObjectInterface()
 {
+
     static boost::intrusive_ptr<as_object> o;
     if ( ! o ) {
-        o = new as_object();
+        o = new as_object(getObjectInterface());
         attachSharedObjectInterface(*o);
     }
     return o.get();
 }
 
-// UNCHANGED
+
+as_value
+sharedobject_clear(const fn_call& fn)
+{
+    boost::intrusive_ptr<SharedObject_as> obj = 
+        ensureType<SharedObject_as>(fn.this_ptr);
+    UNUSED(obj);
+    
+    LOG_ONCE(log_unimpl (__FUNCTION__));
+
+    return as_value();
+}
+
+as_value
+sharedobject_connect(const fn_call& fn)
+{
+    boost::intrusive_ptr<SharedObject_as> obj =
+        ensureType<SharedObject_as>(fn.this_ptr);
+    UNUSED(obj);
+
+    LOG_ONCE(log_unimpl("SharedObject.connect"));
+    return as_value();
+}
+
 as_value
 sharedobject_close(const fn_call& fn)
 {
-    boost::intrusive_ptr<SharedObject_as> ptr =
-        ensureType<SharedObject_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-// UNCHANGED
-as_value
-sharedobject_connect(const fn_call& fn)
-{
-    boost::intrusive_ptr<SharedObject_as> ptr =
-        ensureType<SharedObject_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-// MODIFIED
+    boost::intrusive_ptr<SharedObject_as> obj =
+        ensureType<SharedObject_as>(fn.this_ptr);
+    UNUSED(obj);
+
+    LOG_ONCE(log_unimpl("SharedObject.close"));
+    return as_value();
+}
+
+as_value
+sharedobject_setFps(const fn_call& fn)
+{
+    boost::intrusive_ptr<SharedObject_as> obj =
+        ensureType<SharedObject_as>(fn.this_ptr);
+    UNUSED(obj);
+
+    LOG_ONCE(log_unimpl("SharedObject.setFps"));
+    return as_value();
+}
+
+as_value
+sharedobject_send(const fn_call& fn)
+{
+    boost::intrusive_ptr<SharedObject_as> obj =
+        ensureType<SharedObject_as>(fn.this_ptr);
+    UNUSED(obj);
+
+    LOG_ONCE(log_unimpl("SharedObject.send"));
+    return as_value();
+}
+
 as_value
 sharedobject_flush(const fn_call& fn)
 {
+    
     GNASH_REPORT_FUNCTION;
 
     boost::intrusive_ptr<SharedObject_as> obj =
@@ -750,10 +790,11 @@
     return as_value(obj->flush(space));
 }
 
-// MODIFIED
+// Set the file name
 as_value
 sharedobject_getLocal(const fn_call& fn)
 {
+
     VM& vm = fn.env().getVM();
     int swfVersion = vm.getSWFVersion();
 
@@ -788,94 +829,22 @@
     return ret;
 }
 
-// UNCHANGED
+/// Undocumented
 as_value
 sharedobject_getRemote(const fn_call& fn)
 {
-    boost::intrusive_ptr<SharedObject_as> ptr =
-        ensureType<SharedObject_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-// UNCHANGED
-as_value
-sharedobject_send(const fn_call& fn)
-{
-    boost::intrusive_ptr<SharedObject_as> ptr =
-        ensureType<SharedObject_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-// UNCHANGED
-as_value
-sharedobject_setDirty(const fn_call& fn)
-{
-    boost::intrusive_ptr<SharedObject_as> ptr =
-        ensureType<SharedObject_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-// UNCHANGED
-as_value
-sharedobject_setProperty(const fn_call& fn)
-{
-    boost::intrusive_ptr<SharedObject_as> ptr =
-        ensureType<SharedObject_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-// UNCHANGED
-as_value
-sharedobject_asyncError(const fn_call& fn)
-{
-    boost::intrusive_ptr<SharedObject_as> ptr =
-        ensureType<SharedObject_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-// UNCHANGED
-as_value
-sharedobject_netStatus(const fn_call& fn)
-{
-    boost::intrusive_ptr<SharedObject_as> ptr =
-        ensureType<SharedObject_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-// UNCHANGED
-as_value
-sharedobject_sync(const fn_call& fn)
-{
-    boost::intrusive_ptr<SharedObject_as> ptr =
-        ensureType<SharedObject_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-// UNCHANGED
-as_value
-sharedobject_ctor(const fn_call& fn)
-{
-    boost::intrusive_ptr<as_object> obj = new SharedObject_as;
-
-    return as_value(obj.get()); // will keep alive
-}
-
-// ADDED
+    boost::intrusive_ptr<SharedObject_as> obj =
+        ensureType<SharedObject_as>(fn.this_ptr);
+
+    UNUSED(obj);
+
+    LOG_ONCE(log_unimpl("SharedObject.getRemote()"));
+    return as_value();
+}
+
+
 /// Undocumented
+//
 /// Takes a URL argument and deletes all SharedObjects under that URL.
 as_value
 sharedobject_deleteAll(const fn_call& fn)
@@ -889,8 +858,8 @@
     return as_value();
 }
 
-// ADDED
 /// Undocumented
+//
 /// Should be quite obvious what it does.
 as_value
 sharedobject_getDiskUsage(const fn_call& fn)
@@ -904,7 +873,7 @@
     return as_value();
 }
 
-// ADDED
+
 as_value
 sharedobject_data(const fn_call& fn)
 {
@@ -913,7 +882,6 @@
     return as_value(obj->data());
 }
 
-// ADDED
 as_value
 sharedobject_getsize(const fn_call& fn)
 {
@@ -922,19 +890,31 @@
     return as_value(obj->size());
 }
 
-// ADDED
 as_value
-sharedobject_setFps(const fn_call& fn)
-{
-    boost::intrusive_ptr<SharedObject_as> obj =
-        ensureType<SharedObject_as>(fn.this_ptr);
-    UNUSED(obj);
-
-    LOG_ONCE(log_unimpl("SharedObject.setFps"));
-    return as_value();
-}
-
-// ADDED
+sharedobject_ctor(const fn_call& /* fn */)
+{
+    boost::intrusive_ptr<as_object> obj = new SharedObject_as;
+    
+    return as_value(obj.get()); // will keep alive
+}
+
+/// Return true if the name is a valid SOL name.
+//
+/// The official docs claim that '%' is also an invalid DisplayObject,
+/// but that is incorrect (see actionscript.all/SharedObject.as)
+bool
+validateName(const std::string& solName)
+{
+    // A double forward slash isn't allowed
+    std::string::size_type pos = solName.find("//");
+    if (pos != std::string::npos) return false;
+
+    // These DisplayObjects are also illegal
+    pos = solName.find_first_of(",~;\"'<&>?#:\\ ");
+
+    return (pos == std::string::npos);
+}
+
 as_object*
 readSOL(VM& vm, const std::string& filespec)
 {
@@ -1079,6 +1059,7 @@
             case Element::BOOLEAN_AMF0:
                 ptr->set_member(st.string_table::find(el->getName()),
                                             as_value(el->to_bool()));
+                break;
 
             case Element::STRING_AMF0:
             {
@@ -1116,66 +1097,12 @@
 #endif
 }
 
-// ADDED
+
 void
 flushSOL(SharedObjectLibrary::SoLib::value_type& sol)
 {
     sol.second->flush();
 }
 
-// ADDED
-/// Return true if the name is a valid SOL name.
-/// The official docs claim that '%' is also an invalid DisplayObject,
-/// but that is incorrect (see actionscript.all/SharedObject.as)
-bool
-validateName(const std::string& solName)
-{
-    // A double forward slash isn't allowed
-    std::string::size_type pos = solName.find("//");
-    if (pos != std::string::npos) return false;
-
-    // These DisplayObjects are also illegal
-    pos = solName.find_first_of(",~;\"'<&>?#:\\ ");
-
-    return (pos == std::string::npos);
-}
-
-
-
-} // anonymous namespace 
-
-void
-registerSharedObjectNative(as_object& o)
-{
-    VM& vm = o.getVM();
-
-    // ASnative table registration
-       vm.registerNative(sharedobject_connect, 2106, 0);
-       vm.registerNative(sharedobject_send, 2106, 1);
-       vm.registerNative(sharedobject_flush, 2106, 2);
-       vm.registerNative(sharedobject_close, 2106, 3);
-       vm.registerNative(sharedobject_getsize, 2106, 4);
-       vm.registerNative(sharedobject_setFps, 2106, 5);
-       vm.registerNative(sharedobject_clear, 2106, 6);
-
-    // FIXME: getRemote and getLocal use both these methods,
-    // but aren't identical with either of them.
-    // TODO: The first method looks in a library and returns either a
-    // SharedObject or null. The second takes a new SharedObject as
-    // its first argument and populates its data member (more or less
-    // like readSOL). This is only important for ASNative compatibility.
-       vm.registerNative(sharedobject_getLocal, 2106, 202);
-       vm.registerNative(sharedobject_getRemote, 2106, 203);
-       vm.registerNative(sharedobject_getLocal, 2106, 204);
-       vm.registerNative(sharedobject_getRemote, 2106, 205);
-
-       vm.registerNative(sharedobject_deleteAll, 2106, 206);
-       vm.registerNative(sharedobject_getDiskUsage, 2106, 207);
-}
-} // gnash namespace
-
-// local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
-
+} // anonymous namespace
+} // end of gnash namespace

=== modified file 'libcore/asobj/flash/net/SharedObject_as.h'
--- a/libcore/asobj/flash/net/SharedObject_as.h 2009-06-08 21:22:11 +0000
+++ b/libcore/asobj/flash/net/SharedObject_as.h 2009-06-11 20:48:16 +0000
@@ -1,6 +1,5 @@
-// SharedObject_as.h:  ActionScript 3 "SharedObject" class, for Gnash.
-//
-//   Copyright (C) 2009 Free Software Foundation, Inc.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -17,12 +16,8 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-#ifndef GNASH_ASOBJ3_SHAREDOBJECT_H
-#define GNASH_ASOBJ3_SHAREDOBJECT_H
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
+#ifndef GNASH_ASOBJ_SHAREDOBJECT_H
+#define GNASH_ASOBJ_SHAREDOBJECT_H
 
 #include <string>
 #include <map>
@@ -83,25 +78,7 @@
 
 #endif
 
-
-/*namespace gnash {
-
-// Forward declarations
-class as_object;
-
-/// Initialize the global SharedObject class
-void sharedobject_class_init(as_object& global);
-void attachSharedObjectInterface(as_object& o);
-void attachSharedObjectStaticInterface(as_object& o);
-
-
-} // gnash namespace
-
-// GNASH_ASOBJ3_SHAREDOBJECT_H
-#endif*/
-
 // local Variables:
 // mode: C++
 // indent-tabs-mode: t
 // End:
-


reply via email to

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