gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/as_environment.cpp serve...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/as_environment.cpp serve...
Date: Fri, 24 Nov 2006 14:50:31 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/11/24 14:50:30

Modified files:
        .              : ChangeLog 
        server         : as_environment.cpp as_function.cpp 
                         as_function.h impl.cpp swf_function.cpp 
        server/asobj   : GMath.h Global.cpp Global.h Key.cpp Key.h 
                         Makefile.am Math.cpp System.cpp System.h 
        server/vm      : ActionExec.cpp VM.cpp VM.h action.cpp action.h 
Removed files:
        server/asobj   : MovieClip.cpp MovieClip.h 

Log message:
                * server: as_environment.cpp, as_function.cpp, as_function.h,
                  impl.cpp, swf_function.cpp, asobj/GMath.h, asobj/Global.cpp,
                  asobj/Global.h, asobj/Key.cpp, asobj/Key.h, asobj/Makefile.am,
                  asobj/Math.cpp, asobj/MovieClip.cpp, asobj/MovieClip.h,
                  asobj/System.cpp, asobj/System.h, vm/ActionExec.cpp,
                  vm/VM.cpp, vm/VM.h, vm/action.cpp, vm/action.h:
                  Got rid of another global: 's_global'; various cleanups for
                  ActionScript classes.. Whooo!

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1743&r2=1.1744
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_function.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_function.h?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.77&r2=1.78
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/GMath.h?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Key.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Key.h?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Makefile.am?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Math.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/System.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/System.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/MovieClip.cpp?cvsroot=gnash&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/MovieClip.h?cvsroot=gnash&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/action.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/action.h?cvsroot=gnash&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1743
retrieving revision 1.1744
diff -u -b -r1.1743 -r1.1744
--- ChangeLog   24 Nov 2006 14:41:12 -0000      1.1743
+++ ChangeLog   24 Nov 2006 14:50:30 -0000      1.1744
@@ -1,3 +1,14 @@
+2006-11-24 Sandro Santilli <address@hidden>
+
+       * server: as_environment.cpp, as_function.cpp, as_function.h,
+         impl.cpp, swf_function.cpp, asobj/GMath.h, asobj/Global.cpp,
+         asobj/Global.h, asobj/Key.cpp, asobj/Key.h, asobj/Makefile.am,
+         asobj/Math.cpp, asobj/MovieClip.cpp, asobj/MovieClip.h,
+         asobj/System.cpp, asobj/System.h, vm/ActionExec.cpp,
+         vm/VM.cpp, vm/VM.h, vm/action.cpp, vm/action.h:
+         Got rid of another global: 's_global'; various cleanups for
+         ActionScript classes.. Whooo!
+
 2006-11-24 Vitaly Alexeev <address@hidden>
 
        * libbase\sharelib.cpp: fixed VC++ compiler errors

Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- server/as_environment.cpp   24 Nov 2006 08:42:44 -0000      1.31
+++ server/as_environment.cpp   24 Nov 2006 14:50:30 -0000      1.32
@@ -16,7 +16,7 @@
 
 //
 
-/* $Id: as_environment.cpp,v 1.31 2006/11/24 08:42:44 strk Exp $ */
+/* $Id: as_environment.cpp,v 1.32 2006/11/24 14:50:30 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -28,7 +28,7 @@
 #include "shape_character_def.h"
 #include "as_value.h"
 #include "with_stack_entry.h"
-#include "action.h" // for s_global
+#include "VM.h"
 
 #include <string>
 
@@ -109,10 +109,13 @@
     if (varname == "_root" || varname == "_level0") {
        return as_value(m_target->get_root_movie());
     }
+
+    as_object* global = VM::get().getGlobal();
+
     if (varname == "_global") {
-       return as_value(s_global.get());
+       return as_value(global);
     }
-    if (s_global->get_member(varname.c_str(), &val)) {
+    if (global->get_member(varname.c_str(), &val)) {
        return val;
     }
     

Index: server/as_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_function.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/as_function.cpp      11 Nov 2006 22:44:54 -0000      1.10
+++ server/as_function.cpp      24 Nov 2006 14:50:30 -0000      1.11
@@ -130,7 +130,8 @@
 /*
  * Initialize the "Function" member of a _global object.
  */
-void function_init(as_object* global)
+void
+function_class_init(as_object& global)
 {
        // This is going to be the global Function "class"/"function"
        // TODO: use Function() instead (where Function derives from 
as_function, being a class)
@@ -143,7 +144,7 @@
                );
 
        // Register _global.Function
-       global->set_member("Function", func.get());
+       global.set_member("Function", func.get());
 
 }
 

Index: server/as_function.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_function.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/as_function.h        3 Nov 2006 08:10:30 -0000       1.5
+++ server/as_function.h        24 Nov 2006 14:50:30 -0000      1.6
@@ -111,7 +111,7 @@
 };
 
 /// Initialize the global Function constructor
-void function_init(as_object* global);
+void function_class_init(as_object& global);
 
 // To be made statics instead
 void function_apply(const fn_call& fn);

Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -b -r1.77 -r1.78
--- server/impl.cpp     24 Nov 2006 11:52:18 -0000      1.77
+++ server/impl.cpp     24 Nov 2006 14:50:30 -0000      1.78
@@ -18,7 +18,7 @@
 //
 //
 
-/* $Id: impl.cpp,v 1.77 2006/11/24 11:52:18 strk Exp $ */
+/* $Id: impl.cpp,v 1.78 2006/11/24 14:50:30 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -543,7 +543,6 @@
 {
     clear_library();
     fontlib::clear();
-    action_clear();
 }
 
 

Index: server/swf_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf_function.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/swf_function.cpp     24 Nov 2006 09:04:24 -0000      1.8
+++ server/swf_function.cpp     24 Nov 2006 14:50:30 -0000      1.9
@@ -29,8 +29,8 @@
 #include <fn_call.h>
 #include <sprite_instance.h>
 #include <action_buffer.h>
-#include <action.h> // for s_global
 #include <ActionExec.h> // for operator()
+#include <VM.h> // for storing _global in a local register
 
 #include <typeinfo>
 #include <iostream>
@@ -225,7 +225,8 @@
                if (m_function2_flags & 0x100)
                {
                        // Put '_global' in a register.
-                       
our_env->local_register(current_reg).set_as_object(s_global.get());
+                       as_object* global = VM::get().getGlobal();
+                       
our_env->local_register(current_reg).set_as_object(global);
                        current_reg++;
                }
        }

Index: server/asobj/GMath.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/GMath.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/asobj/GMath.h        12 Oct 2006 18:16:03 -0000      1.14
+++ server/asobj/GMath.h        24 Nov 2006 14:50:30 -0000      1.15
@@ -95,26 +95,7 @@
        math_as_object();
 };
 
-void math_abs(const fn_call& fn);
-void math_acos(const fn_call& fn);
-void math_asin(const fn_call& fn);
-void math_atan(const fn_call& fn);
-void math_atan2(const fn_call& fn);
-void math_ceil(const fn_call& fn);
-void math_cos(const fn_call& fn);
-void math_exp(const fn_call& fn);
-void math_floor(const fn_call& fn);
-void math_log(const fn_call& fn);
-void math_max(const fn_call& fn);
-void math_min(const fn_call& fn);
-void math_pow(const fn_call& fn);
-void math_random(const fn_call& fn);
-void math_round(const fn_call& fn);
-void math_sin(const fn_call& fn);
-void math_sqrt(const fn_call& fn);
-void math_tan(const fn_call& fn);
-
-void math_init(as_object* s_global);
+void math_class_init(as_object& global);
 
 } // end of gnash namespace
 

Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/asobj/Global.cpp     24 Nov 2006 13:33:21 -0000      1.23
+++ server/asobj/Global.cpp     24 Nov 2006 14:50:30 -0000      1.24
@@ -18,11 +18,12 @@
 
 // Implementation of the Global ActionScript Object
 
-/* $Id: Global.cpp,v 1.23 2006/11/24 13:33:21 strk Exp $ */
+/* $Id: Global.cpp,v 1.24 2006/11/24 14:50:30 strk Exp $ */
 
 #include "as_object.h"
 #include "as_prop_flags.h"
 #include "as_value.h"
+#include "as_function.h" // for function_class_init
 #include "array.h"
 #include "Boolean.h"
 #include "Camera.h"
@@ -31,7 +32,6 @@
 #include "CustomActions.h"
 #include "Date.h"
 #include "Error.h"
-#include "as_function.h" // for action_init
 #include "Global.h"
 #include "gstring.h"
 #include "Key.h"
@@ -43,7 +43,6 @@
 #include "GMath.h"
 #include "Mouse.h"
 #include "MovieClipLoader.h"
-#include "MovieClip.h" 
 #include "movie_definition.h"
 #include "NetConnection.h"
 #include "NetStream.h"
@@ -68,7 +67,7 @@
 
 namespace gnash {
 
-void
+static void
 as_global_trace(const fn_call& fn)
 {
     assert(fn.nargs >= 1);
@@ -394,7 +393,7 @@
 
 }
 
-Global::Global()
+Global::Global(VM& vm)
        :
        as_object()
 {
@@ -448,11 +447,10 @@
        number_class_init(*this); 
        string_class_init(*this); 
        array_class_init(*this);
-       function_init(this);
-       movieclip_init(this);
-       math_init(this);
-       key_init(this);
-       system_init(this);
+       function_class_init(*this);
+       math_class_init(*this);
+       key_class_init(*this);
+       system_class_init(*this);
 }
 
 } // namespace gnash

Index: server/asobj/Global.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/asobj/Global.h       24 Nov 2006 13:37:22 -0000      1.1
+++ server/asobj/Global.h       24 Nov 2006 14:50:30 -0000      1.2
@@ -23,14 +23,18 @@
 
 #include "as_object.h" // for inheritance
 
+// Forward declarations
 namespace gnash {
+       class VM;
+       class fn_call;
+}
 
-void as_global_trace(const fn_call& fn);
+namespace gnash {
 
 class Global: public as_object
 {
 public:
-       Global();
+       Global(VM& vm);
        ~Global() {}
 };
 

Index: server/asobj/Key.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Key.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/Key.cpp        11 Nov 2006 22:44:54 -0000      1.4
+++ server/asobj/Key.cpp        24 Nov 2006 14:50:30 -0000      1.5
@@ -23,9 +23,10 @@
 
 #include "log.h"
 #include "Key.h"
-#include "action.h" // for action_init
 #include "fn_call.h"
 #include "movie_root.h"
+#include "action.h" // for call_method
+#include "VM.h"
 
 namespace gnash {
 
@@ -335,8 +336,6 @@
 {
 //         GNASH_REPORT_FUNCTION;
            
-    action_init();     // @@ put this in some global init somewhere else...
-
        // Notify keypress listeners.
        if (down) 
        {
@@ -347,7 +346,8 @@
     static tu_string   key_obj_name("Key");
 
     as_value   kval;
-    s_global->get_member(key_obj_name, &kval);
+    as_object* global = VM::get().getGlobal();
+    global->get_member(key_obj_name, &kval);
     if (kval.get_type() == as_value::OBJECT)
        {
            key_as_object*      ko = static_cast<key_as_object*>( 
kval.to_object() );
@@ -362,10 +362,12 @@
        }
 }
 
-// This has to be moved to Key.{cpp,h}
-void key_init(as_object* s_global)
+void key_class_init(as_object& global)
 {
+       // FIXME: conform to getKeyInterface/attachKeyInterface
+
 //         GNASH_REPORT_FUNCTION;
+
     // Create built-in key object.
     as_object* key_obj = new key_as_object;
 
@@ -398,7 +400,7 @@
     key_obj->set_member("isToggled", &key_is_toggled);
     key_obj->set_member("removeListener", &key_remove_listener);
 
-    s_global->set_member("Key", key_obj);
+    global.set_member("Key", key_obj);
 }
 
 } // end of gnash namespace

Index: server/asobj/Key.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Key.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/asobj/Key.h  20 Nov 2006 21:38:11 -0000      1.9
+++ server/asobj/Key.h  24 Nov 2006 14:50:30 -0000      1.10
@@ -16,7 +16,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 // 
 
-/* $Id: Key.h,v 1.9 2006/11/20 21:38:11 strk Exp $ */
+/* $Id: Key.h,v 1.10 2006/11/24 14:50:30 strk Exp $ */
 
 #ifndef __KEY_H__
 #define __KEY_H__
@@ -116,7 +116,7 @@
        int get_last_key_pressed() const;
 };
 
-void key_init(as_object* global);
+void key_class_init(as_object& global);
 
 } // end of gnash namespace
 

Index: server/asobj/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Makefile.am,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/asobj/Makefile.am    24 Nov 2006 13:37:22 -0000      1.21
+++ server/asobj/Makefile.am    24 Nov 2006 14:50:30 -0000      1.22
@@ -18,7 +18,7 @@
 # 
 #
 
-# $Id: Makefile.am,v 1.21 2006/11/24 13:37:22 strk Exp $
+# $Id: Makefile.am,v 1.22 2006/11/24 14:50:30 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -58,7 +58,6 @@
        Math.cpp        \
        Microphone.cpp  \
        Mouse.cpp       \
-       MovieClip.cpp   \
        NetConnection.cpp\
        NetStream.cpp   \
        Number.cpp      \
@@ -93,7 +92,6 @@
        LocalConnection.h\
        Microphone.h    \
        Mouse.h         \
-       MovieClip.h     \
        MovieClipLoader.h \
        NetConnection.h \
        NetStream.h     \

Index: server/asobj/Math.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Math.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/asobj/Math.cpp       3 Nov 2006 15:24:17 -0000       1.12
+++ server/asobj/Math.cpp       24 Nov 2006 14:50:30 -0000      1.13
@@ -16,7 +16,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: Math.cpp,v 1.12 2006/11/03 15:24:17 nihilus Exp $ */
+/* $Id: Math.cpp,v 1.13 2006/11/24 14:50:30 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -31,6 +31,25 @@
 
 namespace gnash {
 
+void math_abs(const fn_call& fn);
+void math_acos(const fn_call& fn);
+void math_asin(const fn_call& fn);
+void math_atan(const fn_call& fn);
+void math_atan2(const fn_call& fn);
+void math_ceil(const fn_call& fn);
+void math_cos(const fn_call& fn);
+void math_exp(const fn_call& fn);
+void math_floor(const fn_call& fn);
+void math_log(const fn_call& fn);
+void math_max(const fn_call& fn);
+void math_min(const fn_call& fn);
+void math_pow(const fn_call& fn);
+void math_random(const fn_call& fn);
+void math_round(const fn_call& fn);
+void math_sin(const fn_call& fn);
+void math_sqrt(const fn_call& fn);
+void math_tan(const fn_call& fn);
+
 Math::Math() {
 }
 
@@ -147,12 +166,12 @@
 }
 
 void
-math_init(as_object* s_global)
+math_class_init(as_object& global)
 {
     // Create built-in math object.
     as_object* math_obj = new math_as_object;
 
-    s_global->set_member("math", math_obj);
+    global.set_member("Math", math_obj);
 }
 
 //

Index: server/asobj/System.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/System.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/asobj/System.cpp     11 Nov 2006 22:44:54 -0000      1.5
+++ server/asobj/System.cpp     24 Nov 2006 14:50:30 -0000      1.6
@@ -161,7 +161,7 @@
 }
 
 void
-system_init(as_object* glob)
+system_class_init(as_object& glob)
 {
        // This is going to be the global System "class"/"function"
        static boost::intrusive_ptr<as_function> sys;
@@ -175,7 +175,7 @@
        }
 
        // Register _global.System
-       glob->set_member("System", sys.get());
+       glob.set_member("System", sys.get());
 
 }
 

Index: server/asobj/System.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/System.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/asobj/System.h       20 Nov 2006 21:44:24 -0000      1.4
+++ server/asobj/System.h       24 Nov 2006 14:50:30 -0000      1.5
@@ -87,7 +87,7 @@
 void system_setclipboard(const fn_call& fn);
 void system_showsettings(const fn_call& fn);
 
-void system_init(as_object* global);
+void system_class_init(as_object& global);
 
 } // end of gnash namespace
 

Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/vm/ActionExec.cpp    24 Nov 2006 09:04:25 -0000      1.1
+++ server/vm/ActionExec.cpp    24 Nov 2006 14:50:30 -0000      1.2
@@ -16,7 +16,7 @@
 
 //
 
-/* $Id: ActionExec.cpp,v 1.1 2006/11/24 09:04:25 strk Exp $ */
+/* $Id: ActionExec.cpp,v 1.2 2006/11/24 14:50:30 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -110,7 +110,6 @@
 void
 ActionExec::operator() ()
 {
-    action_init();     // @@ stick this somewhere else; need some global 
static init function
 
 #if 0
     // Check the time

Index: server/vm/VM.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/vm/VM.cpp    24 Nov 2006 11:49:18 -0000      1.1
+++ server/vm/VM.cpp    24 Nov 2006 14:50:30 -0000      1.2
@@ -16,7 +16,7 @@
 
 //
 
-/* $Id: VM.cpp,v 1.1 2006/11/24 11:49:18 strk Exp $ */
+/* $Id: VM.cpp,v 1.2 2006/11/24 14:50:30 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -25,6 +25,7 @@
 #include "VM.h"
 #include "movie_definition.h"
 #include "sprite_instance.h"
+#include "Global.h"
 
 #include <memory>
 
@@ -42,9 +43,14 @@
 
        _singleton.reset(new VM(movie));
 
+       assert(_singleton.get());
+
        _singleton->setRoot(movie.create_instance());
+       assert(_singleton->getRoot());
+
+       _singleton->setGlobal(new gnash::Global(*_singleton));
+       assert(_singleton->getGlobal());
 
-       assert(_singleton.get());
        return *_singleton;
 }
 
@@ -91,6 +97,13 @@
        return _root_movie.get();
 }
 
+/*public*/
+as_object*
+VM::getGlobal() const
+{
+       return _global.get();
+}
+
 /*private*/
 void
 VM::setRoot(sprite_instance* inst)
@@ -99,6 +112,14 @@
        _root_movie = inst;
 }
 
+/*private*/
+void
+VM::setGlobal(as_object* o)
+{
+       assert(!_global);
+       _global = o;
+}
+
 
 } // end of namespace gnash
 

Index: server/vm/VM.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/vm/VM.h      24 Nov 2006 11:49:18 -0000      1.1
+++ server/vm/VM.h      24 Nov 2006 14:50:30 -0000      1.2
@@ -32,6 +32,7 @@
 namespace gnash {
        class movie_definition;
        class sprite_instance;
+       class as_object;
 }
 
 namespace gnash {
@@ -79,6 +80,9 @@
        /// given to the init() function.
        boost::intrusive_ptr<sprite_instance> _root_movie;
 
+       /// The _global ActionScript object
+       boost::intrusive_ptr<as_object> _global;
+
        /// Target SWF version
        int _swfversion;
 
@@ -88,6 +92,12 @@
        /// 
        void setRoot(sprite_instance*);
 
+       /// Set the _global Object for actions run by Virtual Machine
+       //
+       /// Will be called by the init() function
+       /// 
+       void setGlobal(as_object*);
+
 public:
 
        /// \brief
@@ -118,9 +128,12 @@
        ///
        int getSWFVersion() const;
 
-       /// Get a pointer to the current Root movie 
+       /// Get a pointer to this VM's Root movie 
        sprite_instance* getRoot() const;
 
+       /// Get a pointer to this VM's _global Object
+       as_object* getGlobal() const;
+
        /// Get the SWF locale to use 
        std::locale& getLocale() const;
 

Index: server/vm/action.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/action.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/vm/action.cpp        24 Nov 2006 09:04:25 -0000      1.1
+++ server/vm/action.cpp        24 Nov 2006 14:50:30 -0000      1.2
@@ -20,22 +20,11 @@
 #include "config.h"
 #endif
 
-#include <typeinfo> 
-
-#if !defined(_WIN32) && !defined(WIN32)
-# include <pthread.h> 
-#endif
-
-#include <string>
-
 #include "action.h"
 #include "as_object.h"
-#include "impl.h"
+//#include "impl.h"
 #include "log.h"
-//#include "stream.h"
 #include "tu_random.h"
-
-//#include "gstring.h"
 #include "movie_definition.h"
 #include "MovieClipLoader.h"
 #include "as_function.h"
@@ -45,19 +34,27 @@
 #include "array.h"
 #include "types.h"
 #include "sprite_instance.h"
-
-#ifdef HAVE_LIBXML
-#include "xml.h"
-#include "xmlsocket.h"
-#endif
-
 #include "Global.h"
 #include "swf.h"
-//#include "ASHandlers.h"
 #include "URL.h"
 #include "GnashException.h"
 #include "as_environment.h"
 #include "fn_call.h"
+#include "VM.h"
+
+#ifdef HAVE_LIBXML
+#include "xml.h"
+#include "xmlsocket.h"
+#endif
+
+
+#include <typeinfo> 
+#include <string>
+
+#if !defined(_WIN32) && !defined(WIN32)
+# include <pthread.h> 
+#endif
+
 
 using namespace gnash;
 using namespace SWF;
@@ -126,17 +123,13 @@
 // action stuff
 //
 
-void   action_init();
-
 // Statics.
 bool   s_inited = false;
-boost::intrusive_ptr<as_object>        s_global;
 
 void register_component(const tu_stringi& name, as_c_function_ptr handler)
 {
-       action_init();
-       assert(s_global != NULL);
-       s_global->set_member(name, handler);
+       as_object* global = VM::get().getGlobal();
+       global->set_member(name, handler);
 }
 
 void
@@ -475,35 +468,6 @@
 
 
 
-void
-action_init()
-    // Create/hook built-ins.
-{
-    if (s_inited == false) {
-       s_inited = true;
-       
-       // @@ s_global should really be a
-       // client-visible player object, which
-       // contains one or more actual movie
-       // instances.  We're currently just hacking it
-       // in as an app-global mutable object :(
-       assert(s_global == NULL);
-       s_global = new gnash::Global();
-    }
-}
-
-
-void
-action_clear()
-{
-    if (s_inited) {
-       s_inited = false;
-       
-       s_global->clear();
-       s_global = NULL;
-    }
-}
-
 //
 // event_id
 //

Index: server/vm/action.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/action.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/vm/action.h  24 Nov 2006 09:04:25 -0000      1.1
+++ server/vm/action.h  24 Nov 2006 14:50:30 -0000      1.2
@@ -60,12 +60,6 @@
        // Some handy helpers
        //
 
-       /// Create/hook built-ins.
-       DSOEXPORT void  action_init();
-
-       // Clean up any stray heap stuff we've allocated.
-       void    action_clear();
-
        // Dispatching methods from C++.
        as_value        call_method0(const as_value& method, as_environment* 
env, as_object* this_ptr);
        as_value        call_method1(

Index: server/asobj/MovieClip.cpp
===================================================================
RCS file: server/asobj/MovieClip.cpp
diff -N server/asobj/MovieClip.cpp
--- server/asobj/MovieClip.cpp  8 Nov 2006 08:25:28 -0000       1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,44 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006 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
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-// 
-//
-
-#ifdef HAVE_PTHREADS
-#include <pthread.h>
-#endif
-
-#include <iostream>
-#include <string>
-
-#include "MovieClip.h"
-
-using namespace std;
-
-namespace gnash
-{
-
-// Forward declarations
-
-// @@ should be found somewhere else I guess..
-//movie_interface* create_instance();
-
-void
-movieclip_init(as_object* /* global */)
-{
-}
-
-} // namespace gnash
-

Index: server/asobj/MovieClip.h
===================================================================
RCS file: server/asobj/MovieClip.h
diff -N server/asobj/MovieClip.h
--- server/asobj/MovieClip.h    29 Oct 2006 18:34:12 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,33 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006 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
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-// 
-//
-
-#ifndef GNASH_MOVIECLIP_H
-#define GNASH_MOVIECLIP_H
-
-namespace gnash
-{
-
-class as_object;
-
-/// Initialize the global MovieClip constructor
-void movieclip_init(as_object* global);
-
-} // namespace gnash
-
-#endif // GNASH_MOVIECLIP_H




reply via email to

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