gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Mous...


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Mous...
Date: Tue, 15 Apr 2008 10:06:46 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/04/15 10:06:46

Modified files:
        .              : ChangeLog 
        testsuite/actionscript.all: Mouse.as 
        server/asobj   : Mouse.cpp 

Log message:
                * testsuite/actionscript.all/Mouse.as: tests for mouse prototype
                  (one fail before this commit).
                * server/asobj/Mouse.cpp: Mouse is not an instantiatable class.
                  Drop unused mouse_ctor, drop class constructor. Attach 
interface
                  to singleton Mouse object. The new test passes.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6279&r2=1.6280
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Mouse.as?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Mouse.cpp?cvsroot=gnash&r1=1.19&r2=1.20

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6279
retrieving revision 1.6280
diff -u -b -r1.6279 -r1.6280
--- ChangeLog   15 Apr 2008 09:58:45 -0000      1.6279
+++ ChangeLog   15 Apr 2008 10:06:44 -0000      1.6280
@@ -1,3 +1,11 @@
+2008-04-15 Benjamin Wolsey <address@hidden>
+       
+       * testsuite/actionscript.all/Mouse.as: tests for mouse prototype
+         (one fail before this commit).
+       * server/asobj/Mouse.cpp: Mouse is not an instantiatable class.
+         Drop unused mouse_ctor, drop class constructor. Attach interface
+         to singleton Mouse object. The new test passes.
+
 2008-04-15 Udo Giacomozzi <address@hidden>
 
        * gui/gtk.cpp: refresh view when leaving "show updated regions" mode

Index: testsuite/actionscript.all/Mouse.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Mouse.as,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- testsuite/actionscript.all/Mouse.as 11 Mar 2008 19:31:47 -0000      1.17
+++ testsuite/actionscript.all/Mouse.as 15 Apr 2008 10:06:45 -0000      1.18
@@ -21,7 +21,7 @@
 // execute it like this gnash -1 -r 0 -v out.swf
 
 
-rcsid="$Id: Mouse.as,v 1.17 2008/03/11 19:31:47 strk Exp $";
+rcsid="$Id: Mouse.as,v 1.18 2008/04/15 10:06:45 bwy Exp $";
 #include "check.as"
 
 check_equals ( typeof(Mouse), 'object' );
@@ -30,9 +30,12 @@
 var mouseObj = new Mouse;
 check_equals(mouseObj, undefined);
 
+check_equals (typeof(Mouse.__proto__), 'object');
+check_equals (Mouse.__proto__, Object.prototype);
+
 // test the Mouse::hide method
 check_equals ( typeof(Mouse.hide), 'function' );
-
+check_equals ( typeof(Mouse.show), 'function' );
 #if OUTPUT_VERSION > 5
 
  // Mouse was implicitly initialized by ASBroadcaster.initialize !
@@ -49,4 +52,8 @@
 
 // test the Mouse::show method
 check_equals ( typeof(Mouse.show), 'function' );
-totals();
+#if OUTPUT_VERSION > 5
+check_totals(13);
+#else
+check_totals(7);
+#endif

Index: server/asobj/Mouse.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Mouse.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/asobj/Mouse.cpp      7 Apr 2008 21:44:56 -0000       1.19
+++ server/asobj/Mouse.cpp      15 Apr 2008 10:06:45 -0000      1.20
@@ -17,10 +17,6 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
 #include "Mouse.h"
 #include "as_object.h" // for inheritance
 #include "log.h"
@@ -34,64 +30,33 @@
 
 namespace gnash {
 
-as_value mouse_hide(const fn_call& fn);
-as_value mouse_show(const fn_call& fn);
-as_value mouse_ctor(const fn_call& fn);
+// Forward declarations
+static as_value mouse_hide(const fn_call& fn);
+static as_value mouse_show(const fn_call& fn);
+static void attachMouseInterface(as_object& o);
 
 static void
 attachMouseInterface(as_object& o)
 {
        VM& vm = o.getVM();
 
-       // TODO: Mouse is an object, not a constructor ! Attach these interface 
to
-       //       the singleton Mouse object then !
        vm.registerNative(mouse_show, 5, 0);
        o.init_member("show", vm.getNative(5, 0));
 
        vm.registerNative(mouse_hide, 5, 1);
        o.init_member("hide", vm.getNative(5, 1));
-}
 
-static as_object*
-getMouseInterface()
-{
-       static boost::intrusive_ptr<as_object> o;
-       if ( ! o )
+       if (vm.getSWFVersion() > 5)
        {
-               o = new as_object(getObjectInterface());
-               attachMouseInterface(*o);
+               AsBroadcaster::initialize(o);
        }
-       return o.get();
 }
 
-class mouse_as_object: public as_object
-{
-
-public:
-
-       mouse_as_object()
-               :
-               as_object(getMouseInterface())
-       {
-               int swfversion = _vm.getSWFVersion();
-               if ( swfversion > 5 )
-               {
-                       AsBroadcaster::initialize(*this);
-               }
-       }
-
-       // override from as_object ?
-       //std::string get_text_value() const { return "Mouse"; }
-
-       // override from as_object ?
-       //double get_numeric_value() const { return 0; }
 
-};
-
-as_value mouse_hide(const fn_call& fn)
+as_value
+mouse_hide(const fn_call& fn)
 {
-
-    boost::intrusive_ptr<mouse_as_object> 
obj=ensureType<mouse_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<as_object> obj = ensureType<as_object>(fn.this_ptr);
     UNUSED(obj);
 
     int success = 0;
@@ -109,9 +74,11 @@
     return as_value(success);
 }
 
-as_value mouse_show(const fn_call& fn)
+
+as_value
+mouse_show(const fn_call& fn)
 {
-    boost::intrusive_ptr<mouse_as_object> 
obj=ensureType<mouse_as_object>(fn.this_ptr);
+    boost::intrusive_ptr<as_object> obj=ensureType<as_object>(fn.this_ptr);
     UNUSED(obj);
 
     int success = 0;
@@ -129,27 +96,14 @@
     return as_value(success);
 }
 
-as_value
-mouse_ctor(const fn_call& /* fn */)
-{
-       boost::intrusive_ptr<as_object> obj = new mouse_as_object;
-       
-       return as_value(obj.get()); // will keep alive
-}
 
 // extern (used by Global.cpp)
-void mouse_class_init(as_object& global)
+void
+mouse_class_init(as_object& global)
 {
        // This is going to be the global Mouse "class"/"function"
-       static boost::intrusive_ptr<as_object> obj;
-
-       if ( ! obj )
-       {
-               obj = new mouse_as_object();
-               // we shouldn't keep the Mouse object
-               // alive, I think.
-               //VM::get().addStatic(obj.get());
-       }
+       static boost::intrusive_ptr<as_object> obj = new 
as_object(getObjectInterface());
+       attachMouseInterface(*obj);
 
        // Register _global.Mouse
        global.init_member("Mouse", obj.get());




reply via email to

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