gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/Function.cpp server/Movi...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/Function.cpp server/Movi...
Date: Wed, 21 Jun 2006 23:06:41 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/06/21 23:06:41

Modified files:
        .              : ChangeLog 
        server         : Function.cpp MovieClipLoader.cpp action.cpp 
                         as_environment.cpp as_environment.h 
                         sprite_instance.cpp sprite_instance.h 
                         textformat.cpp timers.cpp xml.cpp xmlsocket.cpp 
        server/swf     : ASHandlers.cpp 

Log message:
        Simplified as_environment interface by removing the 'with_stack' arg 
from public versions of set_variable* and get_variable*

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.426&r2=1.427
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Function.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/MovieClipLoader.cpp?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/server/action.cpp?cvsroot=gnash&r1=1.87&r2=1.88
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/textformat.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/timers.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/xml.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/xmlsocket.cpp?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.cpp?cvsroot=gnash&r1=1.11&r2=1.12

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.426
retrieving revision 1.427
diff -u -b -r1.426 -r1.427
--- ChangeLog   21 Jun 2006 20:56:38 -0000      1.426
+++ ChangeLog   21 Jun 2006 23:06:41 -0000      1.427
@@ -1,5 +1,14 @@
 2006-06-22 Sandro Santilli <address@hidden>
 
+       * server/Function.cpp, server/MovieClipLoader.cpp, server/action.cpp,
+       server/as_environment.cpp, server/as_environment.h,
+       server/sprite_instance.cpp, server/sprite_instance.h,
+       server/textformat.cpp, server/timers.cpp, server/xml.cpp,
+       server/xmlsocket.cpp, server/swf/ASHandlers.cpp:
+       Added as_environment::{get,set}_variable{,_raw} versions
+       w/out with_stack argument, those with "with_stack" arg moved
+       to private space. All files updated to avoid use of dummy
+       (empty) with_stack objects.
        * server/Function.cpp, server/Function.h:
        updated doxygen comments, used size_t for action_buffer
        offsets and length.

Index: server/Function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/Function.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/Function.cpp 21 Jun 2006 20:56:38 -0000      1.17
+++ server/Function.cpp 21 Jun 2006 23:06:41 -0000      1.18
@@ -356,8 +356,7 @@
                if (m_function2_flags & 0x80)
                {
                        // Put '_parent' in a register.
-                       std::vector<with_stack_entry>   dummy;
-                       as_value        parent = 
our_env->get_variable("_parent", dummy);
+                       as_value parent = our_env->get_variable("_parent");
                        (*(our_env->local_register_ptr(current_reg))) = parent;
                        current_reg++;
                }

Index: server/MovieClipLoader.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/MovieClipLoader.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- server/MovieClipLoader.cpp  20 May 2006 23:49:33 -0000      1.22
+++ server/MovieClipLoader.cpp  21 Jun 2006 23:06:41 -0000      1.23
@@ -279,7 +279,7 @@
        {
        //log_msg("FIXME: Found onLoadStart!\n");
                as_c_function_ptr       func = method.to_c_function();
-               fn.env->set_variable("success", true, 
std::vector<with_stack_entry>());
+               fn.env->set_variable("success", true);
                if (func)
                {
                        // It's a C function.  Call it.
@@ -303,7 +303,7 @@
        {
        //log_msg("FIXME: Found onLoadStart!\n");
                as_c_function_ptr       func = method.to_c_function();
-               fn.env->set_variable("success", true, 
std::vector<with_stack_entry>());
+               fn.env->set_variable("success", true);
                if (func)
                {
                        // It's a C function.  Call it.
@@ -488,7 +488,7 @@
   if (fn.this_ptr->get_member("onLoadComplete", &method)) {
     //log_msg("FIXME: Found onLoadComplete!\n");
     as_c_function_ptr  func = method.to_c_function();
-    fn.env->set_variable("success", true, std::vector<with_stack_entry>());
+    fn.env->set_variable("success", true);
     if (func)
       {
         // It's a C function.  Call it.
@@ -527,7 +527,7 @@
   if (fn.this_ptr->get_member("onLoadError", &method)) {
     //log_msg("FIXME: Found onLoadError!\n");
     as_c_function_ptr  func = method.to_c_function();
-    fn.env->set_variable("success", true, std::vector<with_stack_entry>());
+    fn.env->set_variable("success", true);
     if (func)
       {
         // It's a C function.  Call it.

Index: server/action.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/action.cpp,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -b -r1.87 -r1.88
--- server/action.cpp   21 Jun 2006 09:06:01 -0000      1.87
+++ server/action.cpp   21 Jun 2006 23:06:41 -0000      1.88
@@ -62,7 +62,6 @@
 #include "sound.h"
 #include "array.h"
 #include "types.h"
-#include "with_stack_entry.h"
 
 #ifdef HAVE_LIBXML
 #include "xml.h"
@@ -447,8 +446,7 @@
                }
        }
 
-    std::vector<with_stack_entry>      dummy_with_stack;
-    as_value   method = env->get_variable(method_name, dummy_with_stack);
+    as_value   method = env->get_variable(method_name);
 
     // check method
 

Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/as_environment.cpp   20 Jun 2006 11:12:36 -0000      1.3
+++ server/as_environment.cpp   21 Jun 2006 23:06:41 -0000      1.4
@@ -72,6 +72,12 @@
     }
 }
 
+as_value
+as_environment::get_variable(const tu_string& varname) const
+{
+       static std::vector<with_stack_entry> empty_with_stack;
+       return get_variable(varname, empty_with_stack);
+}
 
 as_value
 as_environment::get_variable_raw(
@@ -130,6 +136,14 @@
     return as_value();
 }
 
+// varname must be a plain variable name; no path parsing.
+as_value
+as_environment::get_variable_raw(const tu_string& varname) const
+{
+       static std::vector<with_stack_entry> empty_with_stack;
+       return get_variable_raw(varname, empty_with_stack);
+}
+
 // Given a path to variable, set its value.
 void
 as_environment::set_variable(
@@ -154,6 +168,15 @@
     }
 }
 
+void
+as_environment::set_variable(
+               const tu_string& varname,
+               const as_value& val)
+{
+       static std::vector<with_stack_entry> empty_with_stack;
+       set_variable(varname, val, empty_with_stack);
+}
+
 // No path rigamarole.
 void
 as_environment::set_variable_raw(
@@ -162,7 +185,8 @@
     const std::vector<with_stack_entry>& with_stack)
 {
     // Check the with-stack.
-    for (int i = with_stack.size() - 1; i >= 0; i--) {
+       for (int i = with_stack.size() - 1; i >= 0; i--)
+       {
        as_object*      obj = with_stack[i].m_object.get_ptr();
        as_value        dummy;
        if (obj && obj->get_member(varname, &dummy)) {
@@ -185,6 +209,15 @@
     m_target->set_member(varname, val);
 }
 
+void
+as_environment::set_variable_raw(
+               const tu_string& varname,
+               const as_value& val)
+{
+       static std::vector<with_stack_entry> empty_with_stack;
+       set_variable_raw(varname, val, empty_with_stack);
+}
+
 // Set/initialize the value of the local variable.
 void
 as_environment::set_local(const tu_string& varname, const as_value& val)

Index: server/as_environment.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/as_environment.h     16 Jun 2006 00:32:25 -0000      1.3
+++ server/as_environment.h     21 Jun 2006 23:06:41 -0000      1.4
@@ -156,18 +156,16 @@
        /// Return the (possibly UNDEFINED) value of the named var.
        /// Variable name can contain path elements.
        ///
-       as_value get_variable(const tu_string& varname,
-               const std::vector<with_stack_entry>& with_stack) const;
+       as_value get_variable(const tu_string& varname) const;
 
        /// Same of the above, but no support for path.
-       as_value get_variable_raw(const tu_string& varname,
-               const std::vector<with_stack_entry>& with_stack) const;
+       as_value get_variable_raw(const tu_string& varname) const;
 
        /// Given a path to variable, set its value.
-       void    set_variable(const tu_string& path, const as_value& val, const 
std::vector<with_stack_entry>& with_stack);
+       void    set_variable(const tu_string& path, const as_value& val);
 
-       /// Same of the above, but no support for path
-       void    set_variable_raw(const tu_string& path, const as_value& val, 
const std::vector<with_stack_entry>& with_stack);
+       /// Same of the above, but no "with" stack to search for
+       void    set_variable_raw(const tu_string& path, const as_value& val);
 
        /// Set/initialize the value of the local variable.
        void    set_local(const tu_string& varname, const as_value& val);
@@ -225,6 +223,29 @@
                            << m_stack[i].to_string() << std::endl;
                }
        }
+
+private:
+
+       /// Given a variable name, set its value (no support for path)
+       void set_variable_raw(const tu_string& path, const as_value& val,
+               const std::vector<with_stack_entry>& with_stack);
+
+       /// Given a path to variable, set its value.
+       void set_variable(const tu_string& path, const as_value& val,
+               const std::vector<with_stack_entry>& with_stack);
+
+       /// \brief
+       /// Return the (possibly UNDEFINED) value of the named var.
+       /// Variable name can contain path elements.
+       ///
+       as_value get_variable(const tu_string& varname,
+               const std::vector<with_stack_entry>& with_stack) const;
+
+       /// Same of the above, but no support for path.
+       as_value get_variable_raw(const tu_string& varname,
+               const std::vector<with_stack_entry>& with_stack) const;
+
+
 };
 
 

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/sprite_instance.cpp  19 Jun 2006 14:39:48 -0000      1.11
+++ server/sprite_instance.cpp  21 Jun 2006 23:06:41 -0000      1.12
@@ -1056,7 +1056,6 @@
 {
     assert(m_parent == NULL);  // should only be called on the root movie.
 
-    std::vector<with_stack_entry>      empty_with_stack;
     tu_string  path(path_to_var);
 
     // NOTE: this is static so that the string
@@ -1065,7 +1064,7 @@
     // function though!!!  NOT THREAD SAFE!
     static as_value    val;
 
-    val = m_as_environment.get_variable(path, empty_with_stack);
+    val = m_as_environment.get_variable(path);
 
     return val.to_string();    // ack!
 }
@@ -1088,11 +1087,10 @@
        // should only be called on the root movie.
        assert(m_parent == NULL);
 
-       std::vector<with_stack_entry>   empty_with_stack;
        tu_string       path(path_to_var);
        as_value        val(new_value);
 
-       m_as_environment.set_variable(path, val, empty_with_stack);
+       m_as_environment.set_variable(path, val);
 }
 
 void sprite_instance::set_variable(const char* path_to_var,
@@ -1111,11 +1109,10 @@
                    return;
                }
 
-           std::vector<with_stack_entry>       empty_with_stack;
            tu_string   path(path_to_var);
            as_value    val(new_value);
 
-           m_as_environment.set_variable(path, val, empty_with_stack);
+           m_as_environment.set_variable(path, val);
 }
 
 void sprite_instance::has_keypress_event()

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/sprite_instance.h    19 Jun 2006 14:39:48 -0000      1.7
+++ server/sprite_instance.h    21 Jun 2006 23:06:41 -0000      1.8
@@ -467,8 +467,7 @@
                // should only be called on the root movie.
                assert(m_parent == NULL);
 
-               std::vector<with_stack_entry>   dummy;
-               as_value obj = 
m_as_environment.get_variable(tu_string(path_to_object), dummy);
+               as_value obj = 
m_as_environment.get_variable(tu_string(path_to_object));
                as_object*      as_obj = obj.to_object();
                if (as_obj)
                {

Index: server/textformat.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/textformat.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/textformat.cpp       20 Jun 2006 11:12:36 -0000      1.12
+++ server/textformat.cpp       21 Jun 2006 23:06:41 -0000      1.13
@@ -38,8 +38,6 @@
 
 #include "log.h"
 #include "textformat.h"
-//#include "action.h" // for struct with_stack_entry
-#include "with_stack_entry.h"
 #include "fn_call.h"
 
 namespace gnash {  
@@ -146,7 +144,7 @@
   //
   // TODO we should handle setTextFormat as a method on TextField,
   // instead of doing this.
-  fn.env->set_variable("setTextFormat", &textformat_setformat, 
std::vector<with_stack_entry>());
+  fn.env->set_variable("setTextFormat", &textformat_setformat);
   
   fn.result->set_as_object(text_obj);
 }

Index: server/timers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/timers.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/timers.cpp   20 May 2006 23:49:33 -0000      1.8
+++ server/timers.cpp   21 Jun 2006 23:06:41 -0000      1.9
@@ -180,10 +180,9 @@
 
     tu_string local_name;
     as_value local_val;
-    std::vector<with_stack_entry>      dummy_with_stack;
 
     fn.env->add_frame_barrier();
-    //method = env->get_variable("loopvar", dummy_with_stack);
+    //method = env->get_variable("loopvar");
 
 #if 1
     // FIXME: This is pretty gross, but something is broke elsewhere and it 
doesn't
@@ -195,12 +194,12 @@
     // probably a better way to do this... but at least this works.
     for (i=0; i< fn.env->get_local_frame_top(); i++) {
       if (fn.env->m_local_frames[i].m_name.size()) {
-        //method = env->get_variable(env->m_local_frames[i].m_name, 
dummy_with_stack);
+        //method = env->get_variable(env->m_local_frames[i].m_name);
         //if (method.get_type() != as_value::UNDEFINED)
         {
           local_name  = fn.env->m_local_frames[i].m_name;
           local_val = fn.env->m_local_frames[i].m_value;
-          fn.env->set_variable(local_name, local_val, 
std::vector<with_stack_entry>());
+          fn.env->set_variable(local_name, local_val);
         }
       }
     }

Index: server/xml.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/xml.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/xml.cpp      20 May 2006 23:49:33 -0000      1.20
+++ server/xml.cpp      21 Jun 2006 23:06:41 -0000      1.21
@@ -924,8 +924,6 @@
     }
     
     //env->bottom(first_arg) = ret;
-    std::vector<with_stack_entry> with_stack;
-    std::vector<with_stack_entry> dummy_stack;
     //  struct node *first_node = ptr->obj.firstChildGet();
   
     //const char *name = ptr->obj.nodeNameGet();
@@ -938,7 +936,7 @@
 #if 1
     if (fn.this_ptr->get_member("onLoad", &method)) {
         //    log_msg("FIXME: Found onLoad!\n");
-        fn.env->set_variable("success", true, std::vector<with_stack_entry>());
+        fn.env->set_variable("success", true);
         fn.env->bottom(fn.first_arg_bottom_index) = true;
         as_c_function_ptr      func = method.to_c_function();
         if (func)
@@ -977,7 +975,6 @@
     as_value   method;
     as_value      val;
     static bool first = true;     // This event handler should only be 
executed once.
-    std::vector<with_stack_entry>      empty_with_stack;
     xml_as_object*     ptr = (xml_as_object*) (as_object*) fn.this_ptr;
     assert(ptr);
   
@@ -1036,7 +1033,7 @@
         if (fn.this_ptr->get_member("onData", &method)) {
             log_msg("FIXME: Found onData!\n");
             as_c_function_ptr  func = method.to_c_function();
-            fn.env->set_variable("success", true, 
std::vector<with_stack_entry>());
+            fn.env->set_variable("success", true);
             if (func)
                 {
                     // It's a C function.  Call it.

Index: server/xmlsocket.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/xmlsocket.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/xmlsocket.cpp        20 May 2006 23:49:33 -0000      1.15
+++ server/xmlsocket.cpp        21 Jun 2006 23:06:41 -0000      1.16
@@ -503,7 +503,6 @@
   as_value     val;
   static bool first = true;     // This event handler should only be executed 
once.
   bool          ret;
-  const std::vector<with_stack_entry> with_stack;
 
   if (!first) {
     fn.result->set_bool(true);

Index: server/swf/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ASHandlers.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/swf/ASHandlers.cpp   21 Jun 2006 09:06:31 -0000      1.11
+++ server/swf/ASHandlers.cpp   21 Jun 2006 23:06:41 -0000      1.12
@@ -615,11 +615,10 @@
 SWFHandlers::ActionGetVariable(as_environment &env)
 {
 //    GNASH_REPORT_FUNCTION;
-    std::vector<with_stack_entry> with_stack;
     as_value var_name = env.pop();
     tu_string var_string = var_name.to_tu_string();
     
-    as_value variable = env.get_variable(var_string, with_stack);
+    as_value variable = env.get_variable(var_string);
     env.push(variable);
     if (variable.to_object() == NULL) {
         log_action("-- get var: %s=%s\n",
@@ -639,8 +638,7 @@
 SWFHandlers::ActionSetVariable(as_environment &env)
 {
 //    GNASH_REPORT_FUNCTION;
-    std::vector<with_stack_entry> with_stack;
-    env.set_variable(env.top(1).to_tu_string(), env.top(0), with_stack);
+    env.set_variable(env.top(1).to_tu_string(), env.top(0));
     log_action("\n-- set var: %s", env.top(1).to_string());
     
     env.drop(2);
@@ -1014,15 +1012,14 @@
 {
 //    GNASH_REPORT_FUNCTION;
     as_value var = env.top(0);
-    std::vector<with_stack_entry> with_stack;
     
-    as_value oldval = env.get_variable_raw(var.to_tu_string(), with_stack);
+    as_value oldval = env.get_variable_raw(var.to_tu_string()); 
     
     if (!oldval.get_type() == as_value::UNDEFINED) {
         // set variable to 'undefined'
         // that hopefully --ref_count and eventually
         // release memory. 
-        env.set_variable_raw(var.to_tu_string(), as_value(), with_stack);
+        env.set_variable_raw(var.to_tu_string(), as_value());
         env.top(0).set_bool(true);
     } else {
         env.top(0).set_bool(false);
@@ -1045,12 +1042,11 @@
 SWFHandlers::ActionCallFunction(as_environment &env)
 {
 //    GNASH_REPORT_FUNCTION;
-    std::vector<with_stack_entry> with_stack;
     as_value function;
     if (env.top(0).get_type() == as_value::STRING) {
         // Function is a string; lookup the function.
         const tu_string &function_name = env.top(0).to_tu_string();
-        function = env.get_variable(function_name, with_stack);
+        function = env.get_variable(function_name);
         
         if (function.get_type() != as_value::AS_FUNCTION &&
             function.get_type() != as_value::C_FUNCTION) {
@@ -1115,7 +1111,6 @@
 SWFHandlers::ActionNew(as_environment &env)
 {
 //    GNASH_REPORT_FUNCTION;
-    std::vector<with_stack_entry> with_stack;
 //    doActionNew(env, with_stack);
 
     as_value   classname = env.pop();
@@ -1123,7 +1118,7 @@
                classname.to_tu_string().c_str());
     int        nargs = (int) env.pop().to_number();
 
-    as_value constructor = env.get_variable(classname.to_tu_string(), 
with_stack);
+    as_value constructor = env.get_variable(classname.to_tu_string());
     as_value new_obj;
     if (constructor.get_type() == as_value::C_FUNCTION)        {
         log_action("Constructor is a C_FUNCTION\n");
@@ -1297,9 +1292,8 @@
 //    GNASH_REPORT_FUNCTION;
     as_value var_name = env.pop();
     const tu_string& var_string = var_name.to_tu_string();
-    std::vector<with_stack_entry> with_stack;
     
-    as_value variable = env.get_variable(var_string, with_stack);
+    as_value variable = env.get_variable(var_string);
     
     if (variable.to_object() == NULL) {
         return false;




reply via email to

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