gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/swf.h server/parser/acti...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/swf.h server/parser/acti...
Date: Wed, 22 Aug 2007 17:32:45 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/08/22 17:32:45

Modified files:
        .              : ChangeLog 
        server         : swf.h 
        server/parser  : action_buffer.h 
        server/vm      : ASHandlers.cpp 
        testsuite/misc-mtasc.all: exception.as 

Log message:
                * server/swf.h: add version and reference url to
                  ACTION_TRY and ACTION_THROW
                * server/parser/action_buffer.h: add read_uint8() method.
                * server/vm/ASHandlers.cpp: stub ACTION_TRY handler
                  (parsed the tag, doesn't do anything with the info yet).
                * testsuite/misc-mtasc.all/exception.as: more tests for
                  try/catch/finally.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4069&r2=1.4070
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf.h?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/action_buffer.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.123&r2=1.124
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-mtasc.all/exception.as?cvsroot=gnash&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4069
retrieving revision 1.4070
diff -u -b -r1.4069 -r1.4070
--- ChangeLog   22 Aug 2007 15:44:52 -0000      1.4069
+++ ChangeLog   22 Aug 2007 17:32:44 -0000      1.4070
@@ -1,5 +1,15 @@
 2007-08-22 Sandro Santilli <address@hidden>
 
+       * server/swf.h: add version and reference url to
+         ACTION_TRY and ACTION_THROW
+       * server/parser/action_buffer.h: add read_uint8() method.
+       * server/vm/ASHandlers.cpp: stub ACTION_TRY handler
+         (parsed the tag, doesn't do anything with the info yet).
+       * testsuite/misc-mtasc.all/exception.as: more tests for
+         try/catch/finally.
+
+2007-08-22 Sandro Santilli <address@hidden>
+
        * testsuite/misc-ming.all/DrawingApiTestRunner.cpp:
          Try another work-around to gcc-4.1.2 bug, commented
          this time.

Index: server/swf.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- server/swf.h        22 Aug 2007 13:09:10 -0000      1.38
+++ server/swf.h        22 Aug 2007 17:32:45 -0000      1.39
@@ -211,6 +211,11 @@
     ACTION_STARTDRAGMOVIE          = 0x27,
     ACTION_STOPDRAGMOVIE           = 0x28,
     ACTION_STRINGCOMPARE           = 0x29,
+
+    /// SWF7
+    ///
+    /// http://sswf.sourceforge.net/SWFalexref.html#action_throw
+    ///
     ACTION_THROW                   = 0x2A,
 
     /// SWF7
@@ -493,7 +498,12 @@
     ///
     ACTION_DEFINEFUNCTION2         = 0x8E,
 
+    /// SWF7
+    ///
+    /// http://sswf.sourceforge.net/SWFalexref.html#action_try
+    ///
     ACTION_TRY                     = 0x8F,
+
     ACTION_WITH                    = 0x94,
     ACTION_DEFINEFUNCTION          = 0x9B,
 

Index: server/parser/action_buffer.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/action_buffer.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/parser/action_buffer.h       1 Jul 2007 10:54:33 -0000       1.15
+++ server/parser/action_buffer.h       22 Aug 2007 17:32:45 -0000      1.16
@@ -139,7 +139,7 @@
                return (const unsigned char*)(&m_buffer[pc]);
        }
 
-       /// Get an integer value from given offset
+       /// Get a signed integer value from given offset
        //
        /// Useful to hide complexity of underlying buffer access.
        ///
@@ -149,6 +149,15 @@
                return ret;
        }
 
+       /// Get an unsigned short integer value from given offset
+       //
+       /// Useful to hide complexity of underlying buffer access.
+       ///
+       uint16_t read_uint16(size_t pc) const
+       {
+               return static_cast<uint16_t>(read_int16(pc));
+       }
+
        /// Read a 32-bit integer starting at given offset.
        //
        /// Useful to hide complexity of underlying buffer access.

Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -b -r1.123 -r1.124
--- server/vm/ASHandlers.cpp    20 Aug 2007 03:25:09 -0000      1.123
+++ server/vm/ASHandlers.cpp    22 Aug 2007 17:32:45 -0000      1.124
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: ASHandlers.cpp,v 1.123 2007/08/20 03:25:09 cmusick Exp $ */
+/* $Id: ASHandlers.cpp,v 1.124 2007/08/22 17:32:45 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -3581,9 +3581,47 @@
 }
 
 void
-SWFHandlers::ActionTry(ActionExec& /*thread*/)
+SWFHandlers::ActionTry(ActionExec& thread)
 {
 //    GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+       size_t pc = thread.pc;
+
+       assert( code[pc] == SWF::ACTION_TRY );
+
+        size_t i = thread.pc + 3; // skip tag id and length
+
+       uint8_t flags = code[i];
+       ++i;
+
+       bool doCatch = flags & 1;
+       bool doFinally = flags & (1<<1);
+       bool catchInRegister = flags&(1<<2);
+       uint8_t reserved = flags&0xE0;
+
+       uint16_t trySize = code.read_uint16(i); i += 2;
+       uint16_t catchSize = code.read_uint16(i); i += 2;
+       uint16_t finallySize = code.read_uint16(i); i += 2;
+
+       const char* catchName = NULL;
+       uint8_t catchRegister = 0;
+
+       if ( catchInRegister )
+       {
+               catchName = code.read_string(i);
+       }
+       else
+       {
+               catchRegister = code[i];
+       }
+
+       IF_VERBOSE_ACTION(
+       log_action(_("ActionTry: reserved:%x doFinally:%d doCatch:%d trySize:%u 
catchSize:%u finallySize:%u catchName:%s catchRegister:%u"),
+               reserved, doFinally, doCatch, trySize, catchSize, finallySize, 
catchName ? catchName : "(null)", catchRegister);
+       );
+
     log_unimpl (__PRETTY_FUNCTION__);
 }
 

Index: testsuite/misc-mtasc.all/exception.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-mtasc.all/exception.as,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/misc-mtasc.all/exception.as       20 Aug 2007 11:13:17 -0000      
1.1
+++ testsuite/misc-mtasc.all/exception.as       22 Aug 2007 17:32:45 -0000      
1.2
@@ -33,17 +33,59 @@
                note("Test constructor called");
        }
 
+       function addOneOnFinal(o)
+       {
+               try {
+                       return 'try';
+               }
+               finally {
+                       o.num += 1;
+                       return 'finally';
+               }
+       }
+
        function test_all()
        {
-               var res;
+               var res = 'string';
                try {
                        throw(1);
                        res = 0;
                } catch (e) {
                        res = e;
                }
-
+               check_equals(typeof(res), 'number');
                xcheck_equals(res, 1);
+
+               res = 'string';
+               try {
+                       throw('thrown');
+                       res = 0;
+               } catch(e) {
+                       res = e;
+               }
+               finally {
+                       res += '_finally';
+               }
+               check_equals(typeof(res), 'string');
+               xcheck_equals(res, 'thrown_finally');
+
+               res = 'string';
+               try {
+                       res = 0;
+               } catch(e) {
+                       res = e;
+               }
+               finally {
+                       res = 3;
+               }
+               check_equals(typeof(res), 'number');
+               check_equals(res, 3);
+
+               var o = new Object();
+               o.num = 1;
+               var ret = addOneOnFinal(o);
+               xcheck_equals(ret, 'finally');
+               xcheck_equals(o.num, 2);
        }
 
        static function main(mc)




reply via email to

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