gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/ActionExec.h server/Acti...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/ActionExec.h server/Acti...
Date: Thu, 19 Oct 2006 10:29:50 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/10/19 10:29:50

Modified files:
        .              : ChangeLog 
        server         : ActionExec.h ActionExec.cpp 
        server/swf     : ASHandlers.cpp 

Log message:
                * server/swf/ASHandlers.cpp: fix ActionExec use after 
privatization
                  of some members.
                * server/ActionExec.{cpp,h}: more doxygen comments, with_stack
                  made private and provided interfaces for pushing entries
                  and getting a const ref to it. made _is_function2 data member
                  private.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1311&r2=1.1312
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ActionExec.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ActionExec.cpp?cvsroot=gnash&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.cpp?cvsroot=gnash&r1=1.76&r2=1.77

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1311
retrieving revision 1.1312
diff -u -b -r1.1311 -r1.1312
--- ChangeLog   19 Oct 2006 09:17:06 -0000      1.1311
+++ ChangeLog   19 Oct 2006 10:29:50 -0000      1.1312
@@ -1,5 +1,14 @@
 2006-10-19 Sandro Santilli <address@hidden>
 
+       * server/swf/ASHandlers.cpp: fix ActionExec use after privatization
+         of some members.
+       * server/ActionExec.{cpp,h}: more doxygen comments, with_stack
+         made private and provided interfaces for pushing entries 
+         and getting a const ref to it. made _is_function2 data member
+         private.
+
+2006-10-19 Sandro Santilli <address@hidden>
+
        * gui/gui.cpp: use return value of mouse move and click events
          notifier to decide wheter to trigger redisplay.
        * server/gnash.h: added note in key event handler about the

Index: server/ActionExec.h
===================================================================
RCS file: /sources/gnash/gnash/server/ActionExec.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/ActionExec.h 26 Aug 2006 02:08:31 -0000      1.4
+++ server/ActionExec.h 19 Oct 2006 10:29:50 -0000      1.5
@@ -57,51 +57,100 @@
 /// Executor of an action_buffer 
 class ActionExec {
 
+       /// the 'with' stack associated with this execution thread
+       std::vector<with_stack_entry> with_stack;
+
+       bool _function2_var;
+
 public:
 
+       /// The actual action buffer
+       //
+       /// TODO: provide a getter and make private
+       ///
        const action_buffer& code;
 
        /// Program counter (offset of current action tag)
+       //
+       /// TODO: provide mutator funx and make private
+       ///
        size_t pc;
 
        /// End of current function execution
+       //
+       /// TODO: make private
+       ///
        size_t stop_pc;
 
        /// Offset to next action tag
        size_t next_pc;
 
+       /// TODO: provide a getter and make private ?
        as_environment& env;
 
+       /// TODO: provide a setter and make private ?
        as_value* retval;
-       std::vector<with_stack_entry> with_stack;
-       bool _function2_var;
 
+       /// Create an execution thread 
        ActionExec(const action_buffer& abuf, as_environment& newEnv);
 
-       ActionExec(
-               const action_buffer& abuf, // the action buffer
-               as_environment& newEnv,
-               size_t nStartPC, // where to start execution
-               size_t nExecBytes, // Number of bytes to run
-                                  // this is probably a redundant
-                                  // information, as an ActionEnd
-                                  // should tell us when to stop.
-                                  // We'll keep this parameter as
-                                  // an SWF integrity checker.
-               as_value* nRetval,  // where to return a value, if this
-                                  // is a function call (??)
+       /// Create an execution thread (for a function call ?)
+       //
+       /// @param buf
+       ///     the action code
+       ///
+       /// @param newEnv
+       ///     the execution environment (variables scope, stack etc.)
+       ///
+       /// @param nStartPC
+       ///     where to start execution (offset from start of action code)
+       ///
+       /// @param nExecBytes
+       ///     Number of bytes to run this is probably a redundant
+       ///     information, as an ActionEnd should tell us when to stop.
+       ///     We'll keep this parameter as an SWF integrity checker.
+       ///
+       /// @param nRetval
+       ///     where to return a value, if this is a function call (??)
+       ///
+       /// @param initial_with_stack
+       ///     the 'with' stack to use
+       ///
+       /// @param nIsFunction2
+       ///     wheter the given action code is actually a Function2
+       ///     
+       ActionExec(const action_buffer& abuf, as_environment& newEnv,
+               size_t nStartPC, size_t nExecBytes, as_value* nRetval,  
                const std::vector<with_stack_entry>& initial_with_stack,
-               bool nIsFunction2 // again, this is only for use with functions
-               );
+               bool nIsFunction2);
 
+       /// Is this execution thread a function2 call ?
        bool isFunction2() { return _function2_var; }
 
+       /// Returns 'with' stack associated with this execution thread
+       // 
+       /// If you need to modify it, use the pushWithEntry() function.
+       ///
+       const std::vector<with_stack_entry>& getWithStack() const
+       {
+               return with_stack;
+       }
+
+       /// Push an entry to the with stack
+       //
+       /// @return
+       ///     true if the entry was pushed,
+       ///     false otherwise (the stack is limited to 8 slots)
+       ///     
+       bool pushWithEntry(const with_stack_entry& entry);
+
        /// Skip the specified number of action tags 
        //
        /// The offset is relative to next_pc
        ///
        void skip_actions(size_t offset);
 
+       /// Execute.
        void operator() ();
                
 };

Index: server/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/ActionExec.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- server/ActionExec.cpp       2 Oct 2006 16:46:00 -0000       1.32
+++ server/ActionExec.cpp       19 Oct 2006 10:29:50 -0000      1.33
@@ -34,7 +34,7 @@
 // forward this exception.
 //
 
-/* $Id: ActionExec.cpp,v 1.32 2006/10/02 16:46:00 strk Exp $ */
+/* $Id: ActionExec.cpp,v 1.33 2006/10/19 10:29:50 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -100,6 +100,7 @@
        with_stack(initial_with_stack),
        _function2_var(nIsFunction2)
 {
+       GNASH_REPORT_FUNCTION;
 }
 
 ActionExec::ActionExec(const action_buffer& abuf, as_environment& newEnv)
@@ -113,6 +114,7 @@
        with_stack(),
        _function2_var(false)
 {
+       GNASH_REPORT_FUNCTION;
 }
 
 void
@@ -242,6 +244,20 @@
        }
 }
 
+bool
+ActionExec::pushWithEntry(const with_stack_entry& entry)
+{
+       if (with_stack.size() < 8)
+       {
+               with_stack.push_back(entry);
+               return true;
+       }
+       else
+       {
+               return false;
+       }
+}
+
 
 } // end of namespace gnash
 

Index: server/swf/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ASHandlers.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- server/swf/ASHandlers.cpp   17 Oct 2006 22:00:38 -0000      1.76
+++ server/swf/ASHandlers.cpp   19 Oct 2006 10:29:50 -0000      1.77
@@ -34,7 +34,7 @@
 // forward this exception.
 //
 
-/* $Id: ASHandlers.cpp,v 1.76 2006/10/17 22:00:38 tgc Exp $ */
+/* $Id: ASHandlers.cpp,v 1.77 2006/10/19 10:29:50 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -2785,7 +2785,7 @@
        // contains name and args, while next tag is first tag
        // of the function body.
        swf_function* func = new swf_function(
-               &code, &env, thread.next_pc, thread.with_stack);
+               &code, &env, thread.next_pc, thread.getWithStack());
 
        func->set_is_function2();
 
@@ -2873,7 +2873,7 @@
        ensure_stack(env, 1); 
 
        const action_buffer& code = thread.code;
-       std::vector<with_stack_entry>& with_stack = thread.with_stack;
+       const std::vector<with_stack_entry>& with_stack = thread.getWithStack();
 
        size_t pc = thread.pc;
        size_t next_pc = thread.next_pc;
@@ -2886,11 +2886,10 @@
        if (with_stack.size() < 8)
        {
                int block_length = code.read_int16(pc+3);
+               // should this be 'pc + block_lenght' instead of next_pc ?
                int block_end = next_pc + block_length;
                as_object* with_obj = env.top(0).to_object();
-               with_stack.push_back(
-                       with_stack_entry(with_obj, block_end)
-               );
+               thread.pushWithEntry(with_stack_entry(with_obj, block_end));
        }
        env.drop(1); 
 }
@@ -2913,7 +2912,7 @@
        // contains name and args, while next tag is first tag
        // of the function body.
        swf_function* func = new swf_function(
-               &code, &env, thread.next_pc, thread.with_stack);
+               &code, &env, thread.next_pc, thread.getWithStack());
 
        size_t i = thread.pc + 3;
 




reply via email to

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