gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/swf_function.cpp server/...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/swf_function.cpp server/...
Date: Sun, 31 Dec 2006 14:02:36 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/12/31 14:02:36

Modified files:
        .              : ChangeLog 
        server         : swf_function.cpp swf_function.h 
        server/vm      : ActionExec.cpp ActionExec.h 

Log message:
                * server/vm/ActionExec.{h,cpp}: simplified constructor for
                  function calls.
                * server/swf_function.{h,cpp}: updated calls to ActionExec
                  constructor.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2024&r2=1.2025
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.h?cvsroot=gnash&r1=1.4&r2=1.5

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2024
retrieving revision 1.2025
diff -u -b -r1.2024 -r1.2025
--- ChangeLog   31 Dec 2006 13:59:21 -0000      1.2024
+++ ChangeLog   31 Dec 2006 14:02:36 -0000      1.2025
@@ -1,5 +1,9 @@
 2006-12-31 Sandro Santilli <address@hidden>
 
+       * server/vm/ActionExec.{h,cpp}: simplified constructor for 
+         function calls.
+       * server/swf_function.{h,cpp}: updated calls to ActionExec 
+         constructor.
        * testsuite/actionscript.all/Inheritance.as: added test
          for using 'super' from within a function (failing).
        * testsuite/misc-ming.all/ming_utils.h:

Index: server/swf_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf_function.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/swf_function.cpp     28 Nov 2006 12:10:27 -0000      1.10
+++ server/swf_function.cpp     31 Dec 2006 14:02:36 -0000      1.11
@@ -191,7 +191,8 @@
                if (m_function2_flags & 0x10)
                {
                        // Put 'super' in a register.
-                       log_error("TODO: implement 'super' in function2 
dispatch (reg)\n");
+                       
our_env->local_register(current_reg).set_as_object(m_prototype);
+                       log_warning("TESTING: implement 'super' in function2 
dispatch (reg)\n");
 
                        current_reg++;
                }
@@ -203,7 +204,8 @@
                else
                {
                        // Put 'super' in a local var.
-                       log_error("TODO: implement 'super' in function2 
dispatch (var)\n");
+                       our_env->add_local("super", as_value(m_prototype));
+                       log_warning("TESTING: implement 'super' in function2 
dispatch (var)\n");
                }
 
                if (m_function2_flags & 0x40)
@@ -232,8 +234,8 @@
        }
 
        // Execute the actions.
-       ActionExec exec(*m_action_buffer, *our_env, m_start_pc, m_length,
-                       fn.result, m_with_stack, m_is_function2);
+       //ActionExec exec(*m_action_buffer, *our_env, m_start_pc, m_length, 
fn.result, m_with_stack, m_is_function2);
+       ActionExec exec(*this, *our_env, fn.result);
        exec();
 
        // Clean up stack frame.

Index: server/swf_function.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf_function.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/swf_function.h       3 Nov 2006 14:03:37 -0000       1.4
+++ server/swf_function.h       31 Dec 2006 14:02:36 -0000      1.5
@@ -121,6 +121,32 @@
                size_t start,
                const std::vector<with_stack_entry>& with_stack);
 
+       const std::vector<with_stack_entry>& getWithStack() const
+       {
+               return m_with_stack;
+       }
+
+       const action_buffer& getActionBuffer() const
+       {
+               assert(m_action_buffer);
+               return *m_action_buffer;
+       }
+
+       size_t getStartPC() const
+       {
+               return m_start_pc;
+       }
+
+       size_t getLength() const
+       {
+               return m_length;
+       }
+
+       bool isFunction2() const
+       {
+               return m_is_function2;
+       }
+
        void    set_is_function2() { m_is_function2 = true; }
 
        void    set_local_register_count(uint8 ct) { assert(m_is_function2); 
m_local_register_count = ct; }

Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/vm/ActionExec.cpp    19 Dec 2006 18:00:12 -0000      1.7
+++ server/vm/ActionExec.cpp    31 Dec 2006 14:02:36 -0000      1.8
@@ -16,7 +16,7 @@
 
 //
 
-/* $Id: ActionExec.cpp,v 1.7 2006/12/19 18:00:12 strk Exp $ */
+/* $Id: ActionExec.cpp,v 1.8 2006/12/31 14:02:36 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -68,20 +68,18 @@
     s_fscommand_handler = handler;
 }
 
-ActionExec::ActionExec(const action_buffer& abuf, as_environment& newEnv,
-               size_t nStartPC, size_t exec_bytes, as_value* retval, 
-               const std::vector<with_stack_entry>& initial_with_stack,
-               bool nIsFunction2)
+ActionExec::ActionExec(const swf_function& func, as_environment& newEnv, 
as_value* nRetVal)
        :
-       with_stack(initial_with_stack),
+       with_stack(func.getWithStack()),
        _with_stack_limit(7),
-       _function_var(nIsFunction2?2:1),
-       code(abuf),
-       pc(nStartPC),
-       stop_pc(nStartPC+exec_bytes),
-       next_pc(nStartPC),
+       _function_var(func.isFunction2() ? 2 : 1),
+       _func(&func),
+       code(func.getActionBuffer()),
+       pc(func.getStartPC()),
+       stop_pc(pc+func.getLength()),
+       next_pc(pc), 
        env(newEnv),
-       retval(retval)
+       retval(nRetVal)
 {
        //GNASH_REPORT_FUNCTION;
 
@@ -94,6 +92,7 @@
        with_stack(),
        _with_stack_limit(7),
        _function_var(0),
+       _func(NULL),
        code(abuf),
        pc(0),
        stop_pc(code.size()),
@@ -300,6 +299,13 @@
 as_value
 ActionExec::getVariable(const std::string& name)
 {
+#if 0
+       if ( isFunction() && name == "super" )
+       {
+               log_msg("Should return Base class of current function here... 
");
+               // this is likely NOT the constructor NOR the prototype
+       }
+#endif
        return env.get_variable(name, getWithStack());
 }
 

Index: server/vm/ActionExec.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/vm/ActionExec.h      19 Dec 2006 18:00:12 -0000      1.4
+++ server/vm/ActionExec.h      31 Dec 2006 14:02:36 -0000      1.5
@@ -32,6 +32,7 @@
        class action_buffer;
        class as_environment;
        class as_value;
+       class swf_function;
 }
 
 namespace gnash {
@@ -51,6 +52,16 @@
        /// 1 for function execution, 2 for function2 execution, 0 otherwise.
        int _function_var;
 
+       /// A pointer to the function being executed, or NULL
+       /// for non-function execution
+       ///
+       /// TODO: 
+       /// This should likely be put in a larger
+       /// structure including return address 
+       /// and maintained in a stack (the call stack)
+       ///
+       const swf_function* _func;
+
 public:
 
        /// The actual action buffer
@@ -81,10 +92,31 @@
        as_value* retval;
 
        /// Create an execution thread 
+       //
+       /// @param abuf
+       ///     the action code
+       ///
+       /// @param newEnv
+       ///     the execution environment (variables scope, stack etc.)
+       ///
        ActionExec(const action_buffer& abuf, as_environment& newEnv);
 
        /// Create an execution thread for a function call.
        //
+       /// @param func
+       ///     The function 
+       ///
+       /// @param newEnv
+       ///     The execution environment (variables scope, stack etc.)
+       ///
+       /// @param nRetval
+       ///     Where to return a value. If NULL any return will be discarded.
+       ///
+       ActionExec(const swf_function& func, as_environment& newEnv, as_value* 
nRetVal);
+
+#if 0
+       /// Create an execution thread for a function call.
+       //
        /// @param abuf
        ///     the action code
        ///
@@ -112,6 +144,7 @@
                size_t nStartPC, size_t nExecBytes, as_value* nRetval,  
                const std::vector<with_stack_entry>& initial_with_stack,
                bool nIsFunction2);
+#endif
 
        /// Is this execution thread a function2 call ?
        bool isFunction2() { return _function_var==2; }




reply via email to

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