gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/swf/ASHandlers.cpp


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/swf/ASHandlers.cpp
Date: Thu, 19 Oct 2006 12:51:34 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/10/19 12:51:34

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

Log message:
                * server/swf/ASHandlers.cpp (unsupported_action_handler): more
                  verbosity; (ActionWith): cleaned up; (ActionGetVariable): 
added
                  note about probable reason for 'with' failing (will work on
                  that next)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1313&r2=1.1314
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.cpp?cvsroot=gnash&r1=1.77&r2=1.78

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1313
retrieving revision 1.1314
diff -u -b -r1.1313 -r1.1314
--- ChangeLog   19 Oct 2006 11:16:26 -0000      1.1313
+++ ChangeLog   19 Oct 2006 12:51:34 -0000      1.1314
@@ -1,5 +1,12 @@
 2006-10-19 Sandro Santilli <address@hidden>
 
+       * server/swf/ASHandlers.cpp (unsupported_action_handler): more 
+         verbosity; (ActionWith): cleaned up; (ActionGetVariable): added
+         note about probable reason for 'with' failing (will work on
+         that next)
+
+2006-10-19 Sandro Santilli <address@hidden>
+
        * server/ActioExec.{cpp,h}: added getWithStackLimit() method,
          fixed pushWithStackEntry() to use the limit (documented why
          in comments); fixed initialization list ordering.

Index: server/swf/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ASHandlers.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -b -r1.77 -r1.78
--- server/swf/ASHandlers.cpp   19 Oct 2006 10:29:50 -0000      1.77
+++ server/swf/ASHandlers.cpp   19 Oct 2006 12:51:34 -0000      1.78
@@ -34,7 +34,7 @@
 // forward this exception.
 //
 
-/* $Id: ASHandlers.cpp,v 1.77 2006/10/19 10:29:50 strk Exp $ */
+/* $Id: ASHandlers.cpp,v 1.78 2006/10/19 12:51:34 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -172,9 +172,9 @@
 }
 
 
-static void unsupported_action_handler(ActionExec& /*thread*/)
+static void unsupported_action_handler(ActionExec& thread)
 {
-       log_error("Unsupported action handler invoked");
+       log_error("Unsupported action handler invoked, code at pc is %d", 
thread.code[thread.pc]);
 }
 
 ActionHandler::ActionHandler()
@@ -954,8 +954,13 @@
        as_value& top_value = env.top(0);
        tu_string var_string = top_value.to_tu_string();
 
+       // TODO: this call does not use the with_stack
+       //       from ActionExec !! this is probably the
+       //       reason why 'with' doesn't work.
+       //       I think we should add a get_variable
+       //       to the ActionExec class to make thes
+       //       calls simpler.
        top_value = env.get_variable(var_string);
-       //env.top(0) = variable;
 
        IF_VERBOSE_ACTION
        (
@@ -2862,36 +2867,54 @@
     dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
 }
 
+/// See: http://sswf.sourceforge.net/SWFalexref.html#action_with
 void
 SWFHandlers::ActionWith(ActionExec& thread)
 {
 //     GNASH_REPORT_FUNCTION;
-    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
 
        as_environment& env = thread.env;
-
-       ensure_stack(env, 1); 
-
        const action_buffer& code = thread.code;
-       const std::vector<with_stack_entry>& with_stack = thread.getWithStack();
-
        size_t pc = thread.pc;
-       size_t next_pc = thread.next_pc;
 
+       assert( code[pc] == SWF::ACTION_WITH );
+
+       ensure_stack(env, 1);  // the object
+       as_object* with_obj = env.pop().to_object();
+
+       const std::vector<with_stack_entry>& with_stack = thread.getWithStack();
        IF_VERBOSE_ACTION (
        log_action("-------------- with block start: stack size is " SIZET_FMT,
                   with_stack.size());
        );
 
-       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();
-               thread.pushWithEntry(with_stack_entry(with_obj, block_end));
+       ++pc; // skip tag code
+
+       int tag_length = code.read_int16(pc); // read tag len (should be 2)
+       assert(tag_length == 2); // or SWF is malformed !
+       pc += 2; // skip tag len
+
+       int block_length = code.read_int16(pc); // read 'with' body size
+       assert(block_length > 0);
+       pc += 2; // skip with body size
+
+       // now we should be on the first action of the 'with' body
+       assert(thread.next_pc == pc);
+
+       // where does the 'with' block ends ?
+       int block_end = thread.next_pc + block_length;
+
+       if ( ! thread.pushWithEntry(with_stack_entry(with_obj, block_end)) )
+       {
+               // skip the full block
+               log_warning("With block skipped"
+                       " (with stack size exceeds limit of "
+                       SIZET_FMT " elements)",
+                       thread.getWithStackLimit());
+               thread.next_pc += block_length;
        }
-       env.drop(1); 
+
+       dbglogfile << __PRETTY_FUNCTION__ << ": testing" << endl;
 }
 
 void




reply via email to

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