gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog configure.ac server/Makefile.am...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog configure.ac server/Makefile.am...
Date: Fri, 24 Nov 2006 09:04:25 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/11/24 09:04:25

Modified files:
        .              : ChangeLog configure.ac 
        server         : Makefile.am array.h 
                         button_character_instance.cpp 
                         edit_text_character.cpp gnash.h 
                         sprite_instance.cpp sprite_instance.h 
                         swf_function.cpp 
        server/asobj   : Makefile.am MovieClipLoader.cpp 
        server/parser  : Makefile.am action_buffer.cpp action_buffer.h 
        testsuite/server: Makefile.am 
Added files:
        server/vm      : .cvsignore ASHandlers.cpp ASHandlers.h 
                         ActionExec.cpp ActionExec.h Makefile.am 
                         action.cpp action.h fn_call.h 
                         with_stack_entry.h 
Removed files:
        server         : ActionExec.cpp ActionExec.h action.cpp action.h 
                         fn_call.h with_stack_entry.h 
        server/swf     : ASHandlers.cpp ASHandlers.h 

Log message:
                * configure.ac, server/ActionExec.cpp, server/ActionExec.h,
                  server/Makefile.am, server/action.cpp, server/action.h,
                  server/array.h, server/button_character_instance.cpp,
                  server/edit_text_character.cpp, server/fn_call.h, 
server/gnash.h,                                                             
server/sprite_instance.cpp, server/sprite_instance.h,
                  server/swf_function.cpp, server/with_stack_entry.h,
                  server/asobj/Makefile.am, server/asobj/MovieClipLoader.cpp,
                  server/parser/Makefile.am, server/parser/action_buffer.cpp,
                  server/parser/action_buffer.h, server/swf/ASHandlers.cpp,
                  server/swf/ASHandlers.h, server/vm/.cvsignore,
                  server/vm/ASHandlers.cpp, server/vm/ASHandlers.h,
                  server/vm/ActionExec.cpp, server/vm/ActionExec.h,
                  server/vm/Makefile.am, server/vm/action.cpp,
                  server/vm/action.h, server/vm/fn_call.h,
                  server/vm/with_stack_entry.h, testsuite/server/Makefile.am:
                  New vm/ dir and libgnashvm.so convenience library;
                  Obsoleted as_environment::execute (use ActionExec instead).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1734&r2=1.1735
http://cvs.savannah.gnu.org/viewcvs/gnash/configure.ac?cvsroot=gnash&r1=1.197&r2=1.198
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.88&r2=1.89
http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.h?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.75&r2=1.76
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.84&r2=1.85
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ActionExec.cpp?cvsroot=gnash&r1=1.36&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ActionExec.h?cvsroot=gnash&r1=1.7&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/action.cpp?cvsroot=gnash&r1=1.109&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/action.h?cvsroot=gnash&r1=1.50&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fn_call.h?cvsroot=gnash&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/with_stack_entry.h?cvsroot=gnash&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Makefile.am?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/MovieClipLoader.cpp?cvsroot=gnash&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/Makefile.am?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/action_buffer.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/action_buffer.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.cpp?cvsroot=gnash&r1=1.98&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.h?cvsroot=gnash&r1=1.10&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/.cvsignore?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/Makefile.am?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/action.cpp?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/action.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/fn_call.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/with_stack_entry.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/Makefile.am?cvsroot=gnash&r1=1.13&r2=1.14

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1734
retrieving revision 1.1735
diff -u -b -r1.1734 -r1.1735
--- ChangeLog   24 Nov 2006 08:42:44 -0000      1.1734
+++ ChangeLog   24 Nov 2006 09:04:24 -0000      1.1735
@@ -1,5 +1,25 @@
 2006-11-24 Sandro Santilli <address@hidden>
 
+       * configure.ac, server/ActionExec.cpp, server/ActionExec.h,
+         server/Makefile.am, server/action.cpp, server/action.h,
+         server/array.h, server/button_character_instance.cpp,
+         server/edit_text_character.cpp, server/fn_call.h, server/gnash.h,
+         server/sprite_instance.cpp, server/sprite_instance.h,
+         server/swf_function.cpp, server/with_stack_entry.h,
+         server/asobj/Makefile.am, server/asobj/MovieClipLoader.cpp,
+         server/parser/Makefile.am, server/parser/action_buffer.cpp,
+         server/parser/action_buffer.h, server/swf/ASHandlers.cpp,
+         server/swf/ASHandlers.h, server/vm/.cvsignore,
+         server/vm/ASHandlers.cpp, server/vm/ASHandlers.h,
+         server/vm/ActionExec.cpp, server/vm/ActionExec.h,
+         server/vm/Makefile.am, server/vm/action.cpp,
+         server/vm/action.h, server/vm/fn_call.h,
+         server/vm/with_stack_entry.h, testsuite/server/Makefile.am:
+         New vm/ dir and libgnashvm.so convenience library;
+         Obsoleted as_environment::execute (use ActionExec instead).
+
+2006-11-24 Sandro Santilli <address@hidden>
+
        * configure.ac: comment out extension dir (no Makefile.am
          in there atm)
        * testsuite/actionscript.all/: Object.as, Date.as:

Index: configure.ac
===================================================================
RCS file: /sources/gnash/gnash/configure.ac,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -b -r1.197 -r1.198
--- configure.ac        24 Nov 2006 08:42:44 -0000      1.197
+++ configure.ac        24 Nov 2006 09:04:24 -0000      1.198
@@ -15,7 +15,7 @@
 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 dnl  
 
-dnl $Id: configure.ac,v 1.197 2006/11/24 08:42:44 strk Exp $
+dnl $Id: configure.ac,v 1.198 2006/11/24 09:04:24 strk Exp $
 
 AC_PREREQ(2.50)
 AC_INIT(gnash, cvs)
@@ -771,6 +771,7 @@
 libgeometry/Makefile
 server/Makefile
 server/asobj/Makefile
+server/vm/Makefile
 server/parser/Makefile
 libamf/Makefile
 backend/Makefile

Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -b -r1.88 -r1.89
--- server/Makefile.am  21 Nov 2006 08:12:01 -0000      1.88
+++ server/Makefile.am  24 Nov 2006 09:04:24 -0000      1.89
@@ -18,13 +18,13 @@
 # 
 #
 
-# $Id: Makefile.am,v 1.88 2006/11/21 08:12:01 strk Exp $
+# $Id: Makefile.am,v 1.89 2006/11/24 09:04:24 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
 AM_CPPFLAGS = 
 
-SUBDIRS = asobj parser
+SUBDIRS = asobj parser vm
 
 # noinst_LTLIBRARIES = libserver.la 
 lib_LTLIBRARIES = libgnashserver.la
@@ -36,6 +36,7 @@
        -I$(top_srcdir)/server/swf \
        -I$(top_srcdir)/server/asobj \
        -I$(top_srcdir)/server/parser \
+       -I$(top_srcdir)/server/vm \
         -I$(top_srcdir)/libbase \
         -I$(top_srcdir)        \
        $(PTHREAD_CFLAGS) \
@@ -59,8 +60,6 @@
         xmlnode.cpp \
        movie_root.cpp \
         xmlsocket.cpp \
-        action.cpp \
-       ActionExec.cpp \
         button_character_instance.cpp \
         dlist.cpp \
        edit_text_character.cpp \
@@ -84,7 +83,6 @@
         tesselate.cpp \
         text.cpp \
         array.cpp \
-       swf/ASHandlers.cpp \
        swf/TagLoadersTable.cpp \
        swf/tag_loaders.cpp     \
         types.cpp      \
@@ -93,8 +91,6 @@
        $(NULL)
 
 noinst_HEADERS = \
-       action.h \
-       ActionExec.h \
        array.h \
        as_value.h \
        as_environment.h \
@@ -145,18 +141,18 @@
         xmlattrs.h \
        xml.h \
         xmlnode.h \
-       swf/ASHandlers.h \
        swf/TagLoadersTable.h \
        swf/tag_loaders.h \
        xmlsocket.h \
-       with_stack_entry.h \
-       fn_call.h
+       $(NULL)
 
 libgnashserver_la_LIBADD = \
        $(top_builddir)/libbase/libgnashbase.la \
        $(top_builddir)/server/asobj/libgnashasobjs.la \
        $(top_builddir)/server/parser/libgnashparser.la \
-       $(LIBXML_LIBS)
+       $(top_builddir)/server/vm/libgnashvm.la \
+       $(LIBXML_LIBS) \
+       $(NULL)
 
 #      $(ZLIB_LIBS) \
 #      $(OPENGL_LIBS)

Index: server/array.h
===================================================================
RCS file: /sources/gnash/gnash/server/array.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/array.h      21 Nov 2006 10:53:08 -0000      1.17
+++ server/array.h      24 Nov 2006 09:04:24 -0000      1.18
@@ -21,8 +21,8 @@
 #ifndef GNASH_ARRAY_H
 #define GNASH_ARRAY_H
 
-//#include "action.h"
 #include "as_object.h" // for inheritance
+
 #include <deque>
 #include <memory> // for auto_ptr
 

Index: server/button_character_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/button_character_instance.cpp        21 Nov 2006 00:25:46 -0000      
1.16
+++ server/button_character_instance.cpp        24 Nov 2006 09:04:24 -0000      
1.17
@@ -8,6 +8,7 @@
 
 #include "button_character_instance.h"
 #include "button_character_def.h"
+#include "action.h" // for as_standard_member enum
 
 #include "ActionExec.h"
 #include "sprite_instance.h"

Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- server/edit_text_character.cpp      21 Nov 2006 00:25:46 -0000      1.31
+++ server/edit_text_character.cpp      24 Nov 2006 09:04:24 -0000      1.32
@@ -3,7 +3,7 @@
 // This source code has been donated to the Public Domain.  Do
 // whatever you want with it.
 
-/* $Id: edit_text_character.cpp,v 1.31 2006/11/21 00:25:46 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.32 2006/11/24 09:04:24 strk Exp $ */
 
 #include "utf8.h"
 #include "log.h"
@@ -14,6 +14,7 @@
 #include "Key.h"
 #include "movie_root.h"        
 #include "as_environment.h" // for parse_path
+#include "action.h" // for as_standard_member enum
 
 #include <algorithm>
 #include <string>

Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- server/gnash.h      21 Nov 2006 00:25:46 -0000      1.75
+++ server/gnash.h      24 Nov 2006 09:04:24 -0000      1.76
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: gnash.h,v 1.75 2006/11/21 00:25:46 strk Exp $ */
+/* $Id: gnash.h,v 1.76 2006/11/24 09:04:24 strk Exp $ */
 
 /// \mainpage
 ///
@@ -39,7 +39,8 @@
 
 #include "ref_counted.h" // for bitmap_info inheritance
 
-#include "as_value.h" // for register_component(...)
+// include in .cpp files, use only forward declarations in header if possible
+//#include "as_value.h" // for register_component(...)
 
 // FIXME: The local usage of these constants should probably be renamed in this
 // file because they conflict with definitions in the system header files. 
Luckily

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -b -r1.84 -r1.85
--- server/sprite_instance.cpp  23 Nov 2006 20:14:13 -0000      1.84
+++ server/sprite_instance.cpp  24 Nov 2006 09:04:24 -0000      1.85
@@ -23,24 +23,9 @@
 #include "config.h"
 #endif
 
-// This needs to be included first for NetBSD systems or we get a weird
-// problem with pthread_t being defined too many times if we use any
-// STL containers.
-#ifdef HAVE_PTHREADS
-#include <pthread.h>
-#endif
-
-#include <vector>
-#include <string>
-#include <cmath>
-
-#include <functional> // for mem_fun, bind1st
-#include <algorithm> // for for_each
-
 #include "log.h" 
-//#include "action.h" 
+#include "action.h" // for call_method_parsed (call_method_args)
 #include "gnash.h"
-//#include "Sprite.h"
 #include "sprite_instance.h"
 #include "movie_definition.h"
 #include "MovieClipLoader.h" // @@ temp hack for loading tests
@@ -49,11 +34,26 @@
 #include "text_character_def.h" // @@ temp hack for createTextField exp.
 #include "execute_tag.h"
 #include "fn_call.h"
-//#include "tu_random.h"
 #include "Key.h"
 #include "movie_root.h"
 #include "swf_event.h"
 #include "sprite_definition.h"
+#include "ActionExec.h"
+
+#include <vector>
+#include <string>
+#include <cmath>
+
+#include <functional> // for mem_fun, bind1st
+#include <algorithm> // for for_each
+
+// This needs to be included first for NetBSD systems or we get a weird
+// problem with pthread_t being defined too many times if we use any
+// STL containers.
+#ifdef HAVE_PTHREADS
+#include <pthread.h>
+#endif
+
 namespace gnash {
 
 //------------------------------------------------
@@ -64,9 +64,8 @@
 // environment. The list of action will be consumed
 // starting from the first element. When the function returns
 // the list should be empty.
-static void
-execute_actions(as_environment* env,
-               sprite_instance::ActionList& action_list)
+void
+sprite_instance::execute_actions(sprite_instance::ActionList& action_list)
 {
        // action_list may be changed due to actions (appended-to)
        // this loop might be optimized by using an iterator
@@ -75,7 +74,8 @@
        {
                action_buffer* ab = action_list.front();
                action_list.pop_front(); 
-               ab->execute(env);
+
+               execute_action(*ab);
        }
 }
 
@@ -188,7 +188,7 @@
        }
 
        std::string newname = fn.arg(1).to_std_string();
-       int depth_val = int(fn.arg(2).to_number());
+       //int depth_val = int(fn.arg(2).to_number());
 
        if (fn.nargs > 3 )
        {
@@ -1153,7 +1153,7 @@
 {
        testInvariant();
 
-       execute_actions(&m_as_environment, m_action_list);
+       execute_actions(m_action_list);
        assert(m_action_list.empty());
 
        testInvariant();
@@ -1230,7 +1230,7 @@
        ActionList::const_iterator it = top_iterator;
        while (it != m_action_list.end())
        {
-               (*it)->execute(&m_as_environment);
+               execute_action(*(*it));
                ++it;
        }
        m_action_list.erase(top_iterator, m_action_list.end());
@@ -1746,7 +1746,7 @@
        // Advance everything in the display list.
        m_display_list.advance(delta_time);
 
-       execute_actions(&m_as_environment, m_goto_frame_action_list);
+       execute_actions(m_goto_frame_action_list);
        assert(m_goto_frame_action_list.empty());
 }
 
@@ -1775,6 +1775,21 @@
 }
 
 void
+sprite_instance::execute_action(action_buffer& ab)
+{
+       as_environment& env = m_as_environment; // just type less
+
+       int local_stack_top = env.get_local_frame_top();
+
+       env.add_frame_barrier();
+
+       ActionExec exec(ab, env);
+       exec();
+
+       env.set_local_frame_top(local_stack_top);
+}
+
+void
 sprite_instance::execute_frame_tags(size_t frame, bool state_only)
 {
        testInvariant();
@@ -2482,5 +2497,15 @@
   m_display_list.get_invalidated_bounds(bounds, force||m_invalidated);
 }
 
+const char*
+sprite_instance::call_method_args(const char* method_name,
+               const char* method_arg_fmt, va_list args)
+{
+    // Keep m_as_environment alive during any method calls!
+    boost::intrusive_ptr<as_object>    this_ptr(this);
+
+    return call_method_parsed(&m_as_environment, this,
+               method_name, method_arg_fmt, args);
+}
 
 } // namespace gnash

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- server/sprite_instance.h    23 Nov 2006 20:14:13 -0000      1.41
+++ server/sprite_instance.h    24 Nov 2006 09:04:24 -0000      1.42
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: sprite_instance.h,v 1.41 2006/11/23 20:14:13 strk Exp $ */
+/* $Id: sprite_instance.h,v 1.42 2006/11/24 09:04:24 strk Exp $ */
 
 // Stateful live Sprite instance
 
@@ -28,7 +28,6 @@
 #include "config.h"
 #endif
 
-#include "action.h" // for call_method_parsed (call_method_args)
 #include "edit_text_character.h" // temp hack
 #include "movie_definition.h" // for inlines
 #include "dlist.h" // DisplayList 
@@ -448,14 +447,7 @@
 
        /// Call a method with a list of arguments
        virtual const char* call_method_args(const char* method_name,
-               const char* method_arg_fmt, va_list args)
-       {
-           // Keep m_as_environment alive during any method calls!
-           boost::intrusive_ptr<as_object>     this_ptr(this);
-
-           return call_method_parsed(&m_as_environment, this,
-                       method_name, method_arg_fmt, args);
-       }
+               const char* method_arg_fmt, va_list args);
 
        virtual void    attach_display_callback(
                const char* path_to_object,
@@ -521,6 +513,19 @@
 
 private:
 
+       /// Execute a single action buffer (DOACTION block)
+       //
+       /// The function will take care of cleaning up
+       /// the environment's frames stack after execution
+       ///
+       void execute_action(action_buffer& ab);
+
+       /// Execute the actions in the action list
+       //
+       /// The list of action will be consumed starting from the first
+       /// element. When the function returns the list should be empty.
+       ///
+       void execute_actions(ActionList& action_list);
 
        mouse_state m_mouse_state;
 

Index: server/swf_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf_function.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/swf_function.cpp     24 Nov 2006 08:42:44 -0000      1.7
+++ server/swf_function.cpp     24 Nov 2006 09:04:24 -0000      1.8
@@ -30,6 +30,7 @@
 #include <sprite_instance.h>
 #include <action_buffer.h>
 #include <action.h> // for s_global
+#include <ActionExec.h> // for operator()
 
 #include <typeinfo>
 #include <iostream>
@@ -230,7 +231,9 @@
        }
 
        // Execute the actions.
-       m_action_buffer->execute(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);
+       exec();
 
        // Clean up stack frame.
        our_env->set_local_frame_top(local_stack_top);

Index: server/asobj/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Makefile.am,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/asobj/Makefile.am    21 Nov 2006 20:13:26 -0000      1.18
+++ server/asobj/Makefile.am    24 Nov 2006 09:04:24 -0000      1.19
@@ -18,7 +18,7 @@
 # 
 #
 
-# $Id: Makefile.am,v 1.18 2006/11/21 20:13:26 strk Exp $
+# $Id: Makefile.am,v 1.19 2006/11/24 09:04:24 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -26,12 +26,12 @@
 
 noinst_LTLIBRARIES = libgnashasobjs.la 
 
-# Only enable if we're configured with --enable-mp3
 INCLUDES = \
        -I$(top_srcdir)/backend \
        -I$(top_srcdir)/server \
        -I$(top_srcdir)/server/swf \
        -I$(top_srcdir)/server/parser \
+       -I$(top_srcdir)/server/vm \
         -I$(top_srcdir)/libbase \
         -I$(top_srcdir)/libamf \
         -I$(top_srcdir)        \
@@ -42,18 +42,6 @@
        $(FFMPEG_CFLAGS) \
        $(NULL)
 
-#        $(ZLIB_CFLAGS) \
-#        $(OGG_CFLAGS) \
-#        $(JPEG_CFLAGS) \
-#        $(SDL_CFLAGS) \
-#        $(OPENGL_CFLAGS) \
-#      $(GTK2_CFLAGS) \
-#      $(PANGO_CFLAGS) \
-#      $(GLIB_CFLAGS) \
-#      $(CAIRO_CFLAGS) \
-#      $(ATK_CFLAGS) \
-#
-
 libgnashasobjs_la_SOURCES = \
        Boolean.cpp     \
        Camera.cpp      \

Index: server/asobj/MovieClipLoader.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/MovieClipLoader.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- server/asobj/MovieClipLoader.cpp    21 Nov 2006 00:25:46 -0000      1.11
+++ server/asobj/MovieClipLoader.cpp    24 Nov 2006 09:04:24 -0000      1.12
@@ -26,6 +26,7 @@
 
 #include "tu_config.h"
 
+#include "action.h" // for call_method
 #include "as_value.h"
 #include "as_object.h" // for inheritance
 #include "fn_call.h"

Index: server/parser/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/parser/Makefile.am,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/parser/Makefile.am   14 Nov 2006 10:37:40 -0000      1.15
+++ server/parser/Makefile.am   24 Nov 2006 09:04:24 -0000      1.16
@@ -18,7 +18,7 @@
 # 
 #
 
-# $Id: Makefile.am,v 1.15 2006/11/14 10:37:40 bjacques Exp $
+# $Id: Makefile.am,v 1.16 2006/11/24 09:04:24 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -36,6 +36,7 @@
        -I$(top_srcdir)/server \
        -I$(top_srcdir)/server/swf \
        -I$(top_srcdir)/server/parser \
+       -I$(top_srcdir)/server/vm \
         -I$(top_srcdir)/libbase \
         -I$(top_srcdir)/libamf \
         -I$(top_srcdir)        \

Index: server/parser/action_buffer.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/action_buffer.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/parser/action_buffer.cpp     11 Nov 2006 14:36:33 -0000      1.9
+++ server/parser/action_buffer.cpp     24 Nov 2006 09:04:24 -0000      1.10
@@ -16,14 +16,13 @@
 
 //
 
-/* $Id: action_buffer.cpp,v 1.9 2006/11/11 14:36:33 strk Exp $ */
+/* $Id: action_buffer.cpp,v 1.10 2006/11/24 09:04:24 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include "action_buffer.h"
-#include "ActionExec.h"
 #include "log.h"
 #include "stream.h"
 #include "swf.h"
@@ -148,6 +147,7 @@
     }
 }
 
+#if 0
 // Interpret the actions in this action buffer, and evaluate
 // them in the given environment.  Execute our whole buffer,
 // without any arguments passed in.
@@ -185,6 +185,7 @@
                initial_with_stack, is_function2);
        exec();
 }
+#endif
 
 // Disassemble one instruction to the log.
 static void

Index: server/parser/action_buffer.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/action_buffer.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/parser/action_buffer.h       29 Oct 2006 18:34:15 -0000      1.6
+++ server/parser/action_buffer.h       24 Nov 2006 09:04:24 -0000      1.7
@@ -33,7 +33,6 @@
 
 #include "container.h"
 #include "smart_ptr.h"
-#include "with_stack_entry.h"
 
 // Forward declarations
 namespace gnash {
@@ -66,6 +65,7 @@
        /// Read action bytes from input stream
        void    read(stream* in);
 
+#if 0
        /// \brief
        /// Interpret the actions in this action buffer, and evaluate
        /// them in the given environment. 
@@ -92,6 +92,7 @@
                as_value* retval, // we should probably drop this parameter
                const std::vector<with_stack_entry>& initial_with_stack,
                bool is_function2) const;
+#endif
 
        bool is_null() const
        {

Index: testsuite/server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/server/Makefile.am,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- testsuite/server/Makefile.am        14 Nov 2006 11:12:07 -0000      1.13
+++ testsuite/server/Makefile.am        24 Nov 2006 09:04:25 -0000      1.14
@@ -26,6 +26,7 @@
         -I$(top_srcdir)/testsuite  \
         -I$(top_srcdir)/libbase  \
         -I$(top_srcdir)/server  \
+        -I$(top_srcdir)/server/vm  \
        $(BOOST_CFLAGS) \
        $(NULL)
 

Index: server/vm/.cvsignore
===================================================================
RCS file: server/vm/.cvsignore
diff -N server/vm/.cvsignore
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/vm/.cvsignore        24 Nov 2006 09:04:25 -0000      1.1
@@ -0,0 +1,6 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.lo
+*.la

Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: server/vm/ASHandlers.cpp
diff -N server/vm/ASHandlers.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/vm/ASHandlers.cpp    24 Nov 2006 09:04:25 -0000      1.1
@@ -0,0 +1,3150 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+//
+
+/* $Id: ASHandlers.cpp,v 1.1 2006/11/24 09:04:25 strk Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "log.h"
+#include "swf.h"
+#include "rc.h"
+#include "ASHandlers.h"
+#include "movie_definition.h"
+#include "array.h"
+#include "swf_function.h"
+#include "as_function.h"
+#include "tu_random.h"
+#include "fn_call.h"
+#include "ActionExec.h"
+#include "sprite_instance.h"
+#include "as_environment.h"
+#include "URL.h"
+#include "URLAccessManager.h" // for GetUrl actions
+#include "action_buffer.h"
+#include "as_object.h"
+#include "Object.h"
+#include "gstring.h" // for automatic as_value::STRING => String as object
+#include "Number.h" // for automatic as_value::NUMBER => Number as object
+
+#include <string>
+#include <map>
+#include <set>
+#include <vector>
+
+using namespace std;
+
+namespace {
+gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+}
+
+// Define this to have WaitForFrame actions really
+// wait for target frame (and never skip actions)
+// See:
+//  http://sswf.sourceforge.net/SWFalexref.html#action_wait_for_frame
+//
+#undef REALLY_WAIT_ON_WAIT_FOR_FRAME
+
+// Forward declarations
+namespace gnash {
+       extern fscommand_callback s_fscommand_handler;
+}
+
+namespace gnash {
+
+namespace SWF { // gnash::SWF
+
+// Utility.  Try to convert str to a number.  If successful,
+// put the result in *result, and return true.  If not
+// successful, put 0 in *result, and return false.
+static bool string_to_number(double* result, const char* str)
+{
+    char* tail = 0;
+    *result = strtod(str, &tail);
+    if (tail == str || *tail != 0)
+       {
+           // Failed conversion to Number.
+           return false;
+       }
+    return true;
+}
+
+// 
+// Utility: construct an object using given constructor.
+// This is used by both ActionNew and ActionNewMethod and
+// hides differences between builtin and actionscript-defined
+// constructors.
+//
+static as_value
+construct_object(const as_value& constructor,
+       as_environment& env, unsigned int nargs,
+       unsigned int first_arg_index)
+{
+
+    as_value new_obj;
+
+    if (constructor.get_type() == as_value::C_FUNCTION)
+    {
+               IF_VERBOSE_ACTION (
+        log_action("Constructor is a C_FUNCTION");
+               );
+
+        // C function is responsible for creating the new object and setting 
members.
+        fn_call call(&new_obj, NULL, &env, nargs, first_arg_index);
+
+        (constructor.to_c_function())(call);
+    }
+
+    else if (as_function* ctor_as_func = constructor.to_as_function())
+    {
+        // This function is being used as a constructor; make sure
+        // it has a prototype object.
+               IF_VERBOSE_ACTION (
+        log_action("Constructor is an AS_FUNCTION");
+               );
+        
+        // a built-in class takes care of assigning a prototype
+       // TODO: change this
+        if ( ctor_as_func->isBuiltin() )
+       {
+
+               IF_VERBOSE_ACTION (
+            log_action("it's a built-in class");
+               );
+
+            fn_call call(&new_obj, NULL, &env, nargs, first_arg_index);
+            (*ctor_as_func)(call);
+        }
+       else
+       {
+            // Set up the prototype.
+            as_value   proto;
+            bool func_has_prototype = ctor_as_func->get_member("prototype", 
&proto);
+            assert(func_has_prototype);
+            
+               IF_VERBOSE_ACTION (
+            log_action("constructor prototype is %s", proto.to_string());
+               );
+            
+            // Create an empty object, with a ref to the constructor's 
prototype.
+            boost::intrusive_ptr<as_object> new_obj_ptr(new 
as_object(proto.to_object()));
+            
+            new_obj.set_as_object(new_obj_ptr.get());
+            
+            // Call the actual constructor function; new_obj is its 'this'.
+            // We don't need the function result.
+            call_method(constructor, &env, new_obj_ptr.get(), nargs, 
first_arg_index);
+        }
+    }
+//     Vitaly: no actionscript operation should lead to crash player, 
including "x=new MyClass();".
+//    else
+//    {
+//     assert(0);
+//    }
+
+    return new_obj;
+}
+
+
+static void unsupported_action_handler(ActionExec& thread)
+{
+       log_error("Unsupported action handler invoked, code at pc is %d", 
thread.code[thread.pc]);
+}
+
+ActionHandler::ActionHandler()
+       :
+       _name("unsupported"),
+       _callback(unsupported_action_handler),
+       _debug(false),
+       _stack_args(0),
+       _arg_format(ARG_NONE)
+{
+//    GNASH_REPORT_FUNCTION;    
+}
+
+ActionHandler::ActionHandler(action_type type, action_callback_t func)
+       :
+       _type(type),
+       _callback(func),
+       _debug(false),
+       _stack_args(0),
+       _arg_format(ARG_NONE)
+{
+//     GNASH_REPORT_FUNCTION;
+}
+
+ActionHandler::ActionHandler(action_type type, string name,
+                             action_callback_t func)
+       :
+       _type(type),
+       _name(name),
+       _callback(func),
+       _debug(false),
+       _stack_args(0),
+       _arg_format(ARG_NONE)
+{
+//     GNASH_REPORT_FUNCTION;
+}
+
+ActionHandler::ActionHandler(action_type type, string name,
+                             action_callback_t func, as_arg_t format)
+    : _debug(false), _stack_args(0)
+{
+//    GNASH_REPORT_FUNCTION;
+    _name = name;
+    _type = type;
+    _callback = func;
+    _arg_format = format;
+}
+
+ActionHandler::ActionHandler(action_type type, string name,
+                             action_callback_t func, as_arg_t format, int 
nargs)
+    : _debug(false)
+{
+//    GNASH_REPORT_FUNCTION;
+    _name = name;
+    _type = type;
+    _callback = func;
+    _stack_args = nargs;
+    _arg_format = format;
+}
+
+ActionHandler::~ActionHandler()
+{
+//    GNASH_REPORT_FUNCTION;
+}
+
+void
+ActionHandler::execute(ActionExec& thread) const
+{
+//    GNASH_REPORT_FUNCTION;
+    return _callback(thread);
+}
+
+SWFHandlers::SWFHandlers()
+{
+//    GNASH_REPORT_FUNCTION;
+
+    std::vector<std::string> & property_names = get_property_names();
+
+    property_names.reserve(32);
+    property_names.push_back("_x");
+    property_names.push_back("_y");
+    property_names.push_back("_xscale");
+    property_names.push_back("_yscale");
+    property_names.push_back("_currentframe");
+    property_names.push_back("_totalframes");
+    property_names.push_back("_alpha");
+    property_names.push_back("_visible");
+    property_names.push_back("_width");
+    property_names.push_back("_height");
+    property_names.push_back("_rotation");
+    property_names.push_back("_target");
+    property_names.push_back("_framesloaded");
+    property_names.push_back("_name");
+    property_names.push_back("_droptarget");
+    property_names.push_back("_url");
+    property_names.push_back("_highquality");
+    property_names.push_back("_focusrect");
+    property_names.push_back("_soundbuftime");
+    property_names.push_back("@@ mystery quality member");
+    property_names.push_back("_xmouse");
+    property_names.push_back("_ymouse");
+
+    container_type & handlers = get_handlers();
+    handlers[ACTION_END] = ActionHandler(ACTION_END,
+             string("<End>"), SWFHandlers::ActionEnd);
+    handlers[ACTION_NEXTFRAME] = ActionHandler(ACTION_NEXTFRAME,
+             string("NextFrame"), SWFHandlers::ActionNextFrame);
+    handlers[ACTION_PREVFRAME] =  ActionHandler(ACTION_PREVFRAME,
+             string("PreviousFrame"), SWFHandlers::ActionPrevFrame);
+    handlers[ACTION_PLAY] = ActionHandler(ACTION_PLAY,
+             string("Play"), SWFHandlers::ActionPlay);
+    handlers[ACTION_STOP] = ActionHandler(ACTION_STOP,
+             string("Stop"), SWFHandlers::ActionStop);
+    handlers[ACTION_TOGGLEQUALITY] = ActionHandler(ACTION_TOGGLEQUALITY,
+             string("ToggleQuality"), SWFHandlers::ActionToggleQuality);
+    handlers[ACTION_STOPSOUNDS] = ActionHandler(ACTION_STOPSOUNDS,
+             string("StopSounds"), SWFHandlers::ActionStopSounds);
+    handlers[ACTION_GOTOFRAME] = ActionHandler(ACTION_GOTOFRAME,
+             string("GotoFrame"), SWFHandlers::ActionGotoFrame, ARG_U16);
+    handlers[ACTION_GETURL] = ActionHandler(ACTION_GETURL,
+             string("GetUrl"), SWFHandlers::ActionGetUrl, ARG_STR);
+    handlers[ACTION_WAITFORFRAME] = ActionHandler(ACTION_WAITFORFRAME,
+             string("WaitForFrame"), SWFHandlers::ActionWaitForFrame, ARG_HEX);
+    handlers[ACTION_SETTARGET] = ActionHandler(ACTION_SETTARGET,
+             string("SetTarget"), SWFHandlers::ActionSetTarget, ARG_STR);
+    handlers[ACTION_GOTOLABEL] = ActionHandler(ACTION_GOTOLABEL,
+             string("GotoLabel"), SWFHandlers::ActionGotoLabel, ARG_STR);
+    handlers[ACTION_ADD] = ActionHandler(ACTION_ADD,
+             string("Add"), SWFHandlers::ActionAdd);
+    handlers[ACTION_SUBTRACT] = ActionHandler(ACTION_SUBTRACT,
+             string("Subtract"), SWFHandlers::ActionSubtract);
+    handlers[ACTION_MULTIPLY] = ActionHandler(ACTION_MULTIPLY,
+             string("Multiply"), SWFHandlers::ActionMultiply);
+    handlers[ACTION_DIVIDE] = ActionHandler(ACTION_DIVIDE,
+             string("Divide"), SWFHandlers::ActionDivide);
+    handlers[ACTION_EQUAL] = ActionHandler(ACTION_EQUAL,
+             string("Equal"), SWFHandlers::ActionEqual);
+    handlers[ACTION_LESSTHAN] = ActionHandler(ACTION_LESSTHAN,
+             string("LessThan"), SWFHandlers::ActionLessThan);
+    handlers[ACTION_LOGICALAND] = ActionHandler(ACTION_LOGICALAND,
+             string("LogicalAnd"), SWFHandlers::ActionLogicalAnd);
+    handlers[ACTION_LOGICALOR] = ActionHandler(ACTION_LOGICALOR,
+             string("LogicalOr"), SWFHandlers::ActionLogicalOr);
+    handlers[ACTION_LOGICALNOT] = ActionHandler(ACTION_LOGICALNOT,
+             string("LogicalNot"), SWFHandlers::ActionLogicalNot);
+    handlers[ACTION_STRINGEQ] = ActionHandler(ACTION_STRINGEQ,
+             string("StringEq"), SWFHandlers::ActionStringEq);    
+    handlers[ACTION_STRINGLENGTH] = ActionHandler(ACTION_STRINGLENGTH,
+             string("ActionStringLength"), SWFHandlers::ActionStringLength);
+    handlers[ACTION_SUBSTRING] = ActionHandler(ACTION_SUBSTRING,
+             string("ActionSubString"), SWFHandlers::ActionSubString);
+    handlers[ACTION_POP] = ActionHandler(ACTION_POP,
+             string("ActionPop"), SWFHandlers::ActionPop);
+    handlers[ACTION_INT] = ActionHandler(ACTION_INT,
+             string("ActionInt"), SWFHandlers::ActionInt);
+    handlers[ACTION_GETVARIABLE] = ActionHandler(ACTION_GETVARIABLE,
+             string("ActionGetVariable"), SWFHandlers::ActionGetVariable);
+    handlers[ACTION_SETVARIABLE] = ActionHandler(ACTION_SETVARIABLE,
+             string("ActionSetVariable"), SWFHandlers::ActionSetVariable);
+    handlers[ACTION_SETTARGETEXPRESSION] = 
ActionHandler(ACTION_SETTARGETEXPRESSION,
+             string("ActionSetTargetExpression"), 
SWFHandlers::ActionSetTargetExpression);
+    handlers[ACTION_STRINGCONCAT] = ActionHandler(ACTION_STRINGCONCAT,
+             string("ActionStringConcat"), SWFHandlers::ActionStringConcat);
+    handlers[ACTION_GETPROPERTY] = ActionHandler(ACTION_GETPROPERTY,
+             string("ActionGetProperty"), SWFHandlers::ActionGetProperty);
+    handlers[ACTION_SETPROPERTY] = ActionHandler(ACTION_SETPROPERTY,
+             string("ActionSetpProperty"), SWFHandlers::ActionSetProperty);
+    handlers[ACTION_DUPLICATECLIP] = ActionHandler(ACTION_DUPLICATECLIP,
+             string("ActionDuplicateClip"), SWFHandlers::ActionDuplicateClip);
+    handlers[ACTION_REMOVECLIP] = ActionHandler(ACTION_REMOVECLIP,
+             string("ActionRemoveClip"), SWFHandlers::ActionRemoveClip);
+    handlers[ACTION_TRACE] = ActionHandler(ACTION_TRACE,
+             string("ActionTrace"), SWFHandlers::ActionTrace);
+    handlers[ACTION_STARTDRAGMOVIE] = ActionHandler(ACTION_STARTDRAGMOVIE,
+             string("ActionStartDragMovie"), 
SWFHandlers::ActionStartDragMovie);
+    handlers[ACTION_STOPDRAGMOVIE] = ActionHandler(ACTION_STOPDRAGMOVIE,
+             string("ActionStopDragMovie"), SWFHandlers::ActionStopDragMovie);
+    handlers[ACTION_STRINGCOMPARE] = ActionHandler(ACTION_STRINGCOMPARE,
+             string("ActionStringCompare"), SWFHandlers::ActionStringCompare);
+    handlers[ACTION_THROW] = ActionHandler(ACTION_THROW,
+             string("ActionThrow"), SWFHandlers::ActionThrow);
+    handlers[ACTION_CASTOP] = ActionHandler(ACTION_CASTOP,
+             string("ActionCastOp"), SWFHandlers::ActionCastOp);
+    handlers[ACTION_IMPLEMENTSOP] = ActionHandler(ACTION_IMPLEMENTSOP,
+             string("ActionImplementsOp"), SWFHandlers::ActionImplementsOp);
+    handlers[ACTION_RANDOM] = ActionHandler(ACTION_RANDOM,
+             string("ActionRandom"), SWFHandlers::ActionRandom);
+    handlers[ACTION_MBLENGTH] = ActionHandler(ACTION_MBLENGTH,
+             string("ActionMbLength"), SWFHandlers::ActionMbLength);
+    handlers[ACTION_ORD] = ActionHandler(ACTION_ORD,
+             string("ActionOrd"), SWFHandlers::ActionOrd);
+    handlers[ACTION_CHR] = ActionHandler(ACTION_CHR,
+             string("ActionChr"), SWFHandlers::ActionChr);
+    handlers[ACTION_GETTIMER] = ActionHandler(ACTION_GETTIMER,
+             string("ActionGetTimer"), SWFHandlers::ActionGetTimer);
+    handlers[ACTION_MBSUBSTRING] = ActionHandler(ACTION_MBSUBSTRING,
+             string("ActionMbSubString"), SWFHandlers::ActionMbSubString);
+    handlers[ACTION_MBORD] = ActionHandler(ACTION_MBORD,
+             string("ActionMbOrd"), SWFHandlers::ActionMbOrd);
+    handlers[ACTION_MBCHR] = ActionHandler(ACTION_MBCHR,
+             string("ActionMbChr"), SWFHandlers::ActionMbChr);
+    handlers[ACTION_WAITFORFRAMEEXPRESSION] = 
ActionHandler(ACTION_WAITFORFRAMEEXPRESSION,
+             string("ActionWaitForFrameExpression"),
+             SWFHandlers::ActionWaitForFrameExpression, ARG_HEX);
+    handlers[ACTION_PUSHDATA] = ActionHandler(ACTION_PUSHDATA,
+             string("ActionPushData"), SWFHandlers::ActionPushData, 
ARG_PUSH_DATA);
+    handlers[ACTION_BRANCHALWAYS] = ActionHandler(ACTION_BRANCHALWAYS,
+             string("ActionBranchAlways"), SWFHandlers::ActionBranchAlways, 
ARG_S16);
+    handlers[ACTION_GETURL2] = ActionHandler(ACTION_GETURL2,
+             string("ActionGetUrl2"), SWFHandlers::ActionGetUrl2, ARG_HEX);
+    handlers[ACTION_BRANCHIFTRUE] = ActionHandler(ACTION_BRANCHIFTRUE,
+             string("ActionBranchIfTrue"), SWFHandlers::ActionBranchIfTrue, 
ARG_S16);
+    handlers[ACTION_CALLFRAME] = ActionHandler(ACTION_CALLFRAME,
+             string("ActionCallFrame"), SWFHandlers::ActionCallFrame, ARG_HEX);
+    handlers[ACTION_GOTOEXPRESSION] = ActionHandler(ACTION_GOTOEXPRESSION,
+             string("ActionGotoExpression"), 
SWFHandlers::ActionGotoExpression, ARG_HEX);
+    handlers[ACTION_DELETEVAR] = ActionHandler(ACTION_DELETEVAR,
+             string("ActionDeleteVar"), SWFHandlers::ActionDeleteVar);
+    handlers[ACTION_DELETE] = ActionHandler(ACTION_DELETE,
+             string("ActionDelete"), SWFHandlers::ActionDelete);
+    handlers[ACTION_VAREQUALS] = ActionHandler(ACTION_VAREQUALS,
+             string("ActionVarEquals"), SWFHandlers::ActionVarEquals);
+    handlers[ACTION_CALLFUNCTION] = ActionHandler(ACTION_CALLFUNCTION,
+             string("ActionCallFunction"), SWFHandlers::ActionCallFunction);
+    handlers[ACTION_RETURN] = ActionHandler(ACTION_RETURN,
+             string("ActionReturn"), SWFHandlers::ActionReturn);
+    handlers[ACTION_MODULO] = ActionHandler(ACTION_MODULO,
+             string("ActionModulo"), SWFHandlers::ActionModulo);
+    handlers[ACTION_NEW] = ActionHandler(ACTION_NEW,
+             string("ActionNew"), SWFHandlers::ActionNew);
+    handlers[ACTION_VAR] = ActionHandler(ACTION_VAR,
+             string("ActionVar"), SWFHandlers::ActionVar);    
+    handlers[ACTION_INITARRAY] = ActionHandler(ACTION_INITARRAY,
+             string("ActionInitArray"), SWFHandlers::ActionInitArray);
+    handlers[ACTION_INITOBJECT] = ActionHandler(ACTION_INITOBJECT,
+             string("ActionInitObject"), SWFHandlers::ActionInitObject);
+    handlers[ACTION_TYPEOF] = ActionHandler(ACTION_TYPEOF,
+             string("ActionTypeOf"), SWFHandlers::ActionTypeOf);
+    handlers[ACTION_TARGETPATH] = ActionHandler(ACTION_TARGETPATH,
+             string("ActionTargetPath"), SWFHandlers::ActionTargetPath);
+    handlers[ACTION_ENUMERATE] = ActionHandler(ACTION_ENUMERATE,
+             string("ActionEnumerate"), SWFHandlers::ActionEnumerate);
+    handlers[ACTION_NEWADD] = ActionHandler(ACTION_NEWADD,
+             string("ActionNewAdd"), SWFHandlers::ActionNewAdd);
+    handlers[ACTION_NEWLESSTHAN] = ActionHandler(ACTION_NEWLESSTHAN,
+             string("ActionNewLessThan"), SWFHandlers::ActionNewLessThan);
+    handlers[ACTION_NEWEQUALS] = ActionHandler(ACTION_NEWEQUALS,
+             string("ActionNewEquals"), SWFHandlers::ActionNewEquals);
+    handlers[ACTION_TONUMBER] = ActionHandler(ACTION_TONUMBER,
+             string("ActionToNumber"), SWFHandlers::ActionToNumber);
+    handlers[ACTION_TOSTRING] = ActionHandler(ACTION_TOSTRING,
+             string("ActionToString"), SWFHandlers::ActionToString);
+    handlers[ACTION_DUP] = ActionHandler(ACTION_DUP,
+             string("ActionDup"), SWFHandlers::ActionDup);    
+    handlers[ACTION_SWAP] = ActionHandler(ACTION_SWAP,
+             string("ActionSwap"), SWFHandlers::ActionSwap);    
+    handlers[ACTION_GETMEMBER] = ActionHandler(ACTION_GETMEMBER,
+             string("ActionGetMember"), SWFHandlers::ActionGetMember);
+    handlers[ACTION_SETMEMBER] = ActionHandler(ACTION_SETMEMBER,
+             string("ActionSetMember"), SWFHandlers::ActionSetMember);
+    handlers[ACTION_INCREMENT] = ActionHandler(ACTION_INCREMENT,
+             string("ActionIncrement"), SWFHandlers::ActionIncrement);
+    handlers[ACTION_DECREMENT] = ActionHandler(ACTION_DECREMENT,
+             string("ActionDecrement"), SWFHandlers::ActionDecrement);    
+    handlers[ACTION_CALLMETHOD] = ActionHandler(ACTION_CALLMETHOD,
+             string("ActionCallMethod"), SWFHandlers::ActionCallMethod);
+    handlers[ACTION_NEWMETHOD] = ActionHandler(ACTION_NEWMETHOD,
+             string("ActionNewMethod"), SWFHandlers::ActionNewMethod);
+    handlers[ACTION_INSTANCEOF] = ActionHandler(ACTION_INSTANCEOF,
+             string("ActionInstanceOf"), SWFHandlers::ActionInstanceOf);
+    handlers[ACTION_ENUM2] = ActionHandler(ACTION_ENUM2,
+             string("ActionEnum2"), SWFHandlers::ActionEnum2);    
+    handlers[ACTION_BITWISEAND] = ActionHandler(ACTION_BITWISEAND,
+             string("ActionBitwiseAnd"), SWFHandlers::ActionBitwiseAnd);
+    handlers[ACTION_BITWISEOR] = ActionHandler(ACTION_BITWISEOR,
+             string("ActionBitwiseOr"), SWFHandlers::ActionBitwiseOr);
+    handlers[ACTION_BITWISEXOR] = ActionHandler(ACTION_BITWISEXOR,
+             string("ActionBitwiseXor"), SWFHandlers::ActionBitwiseXor);
+    handlers[ACTION_SHIFTLEFT] = ActionHandler(ACTION_SHIFTLEFT,
+             string("ActionShiftLeft"), SWFHandlers::ActionShiftLeft);
+    handlers[ACTION_SHIFTRIGHT] = ActionHandler(ACTION_SHIFTRIGHT,
+             string("ActionShiftRight"), SWFHandlers::ActionShiftRight);
+    handlers[ACTION_SHIFTRIGHT2] = ActionHandler(ACTION_SHIFTRIGHT2,
+             string("ActionShiftRight2"), SWFHandlers::ActionShiftRight2);
+    handlers[ACTION_STRICTEQ] = ActionHandler(ACTION_STRICTEQ,
+             string("ActionStrictEq"), SWFHandlers::ActionStrictEq);
+    handlers[ACTION_GREATER] = ActionHandler(ACTION_GREATER,
+             string("ActionGreater"), SWFHandlers::ActionGreater);
+    handlers[ACTION_STRINGGREATER] = ActionHandler(ACTION_STRINGGREATER,
+             string("ActionStringGreater"), SWFHandlers::ActionStringGreater);
+    handlers[ACTION_EXTENDS] = ActionHandler(ACTION_EXTENDS,
+             string("ActionExtends"), SWFHandlers::ActionExtends);
+    handlers[ACTION_CONSTANTPOOL] = ActionHandler(ACTION_CONSTANTPOOL,
+             string("ActionConstantPool"), SWFHandlers::ActionConstantPool, 
ARG_DECL_DICT);
+    handlers[ACTION_DEFINEFUNCTION2] = ActionHandler(ACTION_DEFINEFUNCTION2,
+             string("ActionDefineFunction2"), 
SWFHandlers::ActionDefineFunction2,
+             ARG_FUNCTION2);
+    handlers[ACTION_TRY] = ActionHandler(ACTION_TRY,
+             string("ActionTry"), SWFHandlers::ActionTry, ARG_FUNCTION2);
+    handlers[ACTION_WITH] = ActionHandler(ACTION_WITH,
+             string("ActionWith"), SWFHandlers::ActionWith, ARG_U16);
+    handlers[ACTION_DEFINEFUNCTION] = ActionHandler(ACTION_DEFINEFUNCTION,
+             string("ActionDefineFunction"), 
SWFHandlers::ActionDefineFunction, ARG_HEX);
+    handlers[ACTION_SETREGISTER] = ActionHandler(ACTION_SETREGISTER,
+             string("ActionSetRegister"), SWFHandlers::ActionSetRegister, 
ARG_U8);
+    
+
+}
+
+SWFHandlers::~SWFHandlers()
+{
+//    GNASH_REPORT_FUNCTION;
+}
+
+
+std::vector<ActionHandler> &
+SWFHandlers::get_handlers()
+{
+       static container_type handlers(255);
+       return handlers;
+}
+
+std::vector<std::string> &
+SWFHandlers::get_property_names()
+{
+       static std::vector<std::string> prop_names;
+       return prop_names;
+}
+
+
+const SWFHandlers&
+SWFHandlers::instance()
+{
+       static SWFHandlers instance;
+       return instance;
+}
+
+// Vitaly: the result is not used anywhere
+void
+SWFHandlers::execute(action_type type, ActionExec& thread) const
+{
+//    GNASH_REPORT_FUNCTION;
+//     It is very heavy operation
+//     if ( _handlers[type].getName() == "unsupported" ) return false;
+       get_handlers()[type].execute(thread);
+}
+
+void
+SWFHandlers::ActionEnd(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+
+       //as_environment& env = thread.env;
+#ifndef NDEBUG
+       const action_buffer& code = thread.code;
+       assert( code[thread.pc] == SWF::ACTION_END );
+#endif
+
+       dbglogfile << __PRETTY_FUNCTION__ << ": CHECKME: was broken" << endl;
+       thread.next_pc=thread.stop_pc;
+}
+void
+SWFHandlers::ActionNextFrame(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+
+       assert( code[thread.pc] == SWF::ACTION_NEXTFRAME );
+
+       sprite_instance* tgt = env.get_target()->to_movie();
+       assert(tgt);
+       tgt->goto_frame(tgt->get_current_frame() + 1);
+}
+
+void
+SWFHandlers::ActionPrevFrame(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+
+       assert( code[thread.pc] == SWF::ACTION_PREVFRAME );
+
+       sprite_instance* tgt = env.get_target()->to_movie();
+       assert(tgt);
+       tgt->goto_frame(tgt->get_current_frame() - 1);
+}
+
+void
+SWFHandlers::ActionPlay(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+
+    as_environment& env = thread.env;
+    const action_buffer& code = thread.code;
+
+    assert( code[thread.pc] == SWF::ACTION_PLAY );
+    sprite_instance* tgt = env.get_target()->to_movie();
+    assert(tgt);
+    tgt->set_play_state(sprite_instance::PLAY);
+}
+
+void
+SWFHandlers::ActionStop(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+
+    as_environment& env = thread.env;
+    const action_buffer& code = thread.code;
+
+    assert( code[thread.pc] == SWF::ACTION_STOP );
+    
+    sound_handler* s = get_sound_handler();
+
+    sprite_instance* tgt = env.get_target()->to_movie();
+    assert(tgt);
+    int stream_id = tgt->get_sound_stream_id();
+
+    if (s != NULL && stream_id != -1)
+    {
+        s->stop_sound(stream_id);
+    }
+
+    tgt->set_play_state(sprite_instance::STOP);
+}
+
+void
+SWFHandlers::ActionToggleQuality(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+
+    //as_environment& env = thread.env;
+    const action_buffer& code = thread.code;
+
+    assert( code[thread.pc] == SWF::ACTION_TOGGLEQUALITY );
+    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
+}
+
+void
+SWFHandlers::ActionStopSounds(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+
+       //as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+
+       assert( code[thread.pc] == SWF::ACTION_STOPSOUNDS );
+
+       sound_handler* s = get_sound_handler();
+       if (s != NULL)
+       {
+               s->stop_all_sounds();
+       }
+}
+
+void
+SWFHandlers::ActionGotoFrame(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+
+       assert( code[thread.pc] == SWF::ACTION_GOTOFRAME );
+
+       size_t frame = code.read_int16(thread.pc+3);
+
+       sprite_instance* tgt = env.get_target()->to_movie();
+       assert(tgt);
+
+       // 0-based already?
+       //// Convert from 1-based to 0-based
+       //frame--;
+       tgt->goto_frame(frame);
+}
+
+void
+SWFHandlers::ActionGetUrl(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+
+       assert( code[thread.pc] == SWF::ACTION_GETURL );
+
+       size_t& pc = thread.pc;
+
+       // If this is an FSCommand, then call the callback
+       // handler, if any.
+                 
+       // Two strings as args.
+       // TODO: make sure the NULL terminations are there
+       // we could implement a safe_read_string(pc, maxlen)
+       // and use tag length as maxlen
+       //size_t tag_length = code.read_int16(pc+1);
+       const char* url = code.read_string(pc+3);
+       size_t url_len = strlen(url)+1;
+       const char* target = code.read_string(pc+3+url_len);
+
+               IF_VERBOSE_ACTION (
+       log_action("GetUrl: target=%s url=%s", target, url);
+               );
+
+       CommonGetUrl(env, target, url, 0u);
+}
+
+void
+SWFHandlers::ActionWaitForFrame(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+
+       assert( code[thread.pc] == SWF::ACTION_WAITFORFRAME );
+
+       // SWF integrity check
+       size_t tag_len = code.read_int16(thread.pc+1);
+       if ( tag_len != 3 )
+       {
+               log_warning("Malformed SWF: ActionWaitForFrame (0x%X) tag 
length == " SIZET_FMT
+                           " (expected 3)", SWF::ACTION_WAITFORFRAME, tag_len);
+       }
+
+       // If we haven't loaded a specified frame yet, then 
+       // skip the specified number of actions.
+       //
+       unsigned int framenum = code.read_int16(thread.pc+3);
+       uint8 skip = code[thread.pc+5];
+
+       character* target = env.get_target();
+       sprite_instance* target_sprite = target->to_movie();
+       if ( ! target_sprite )
+       {
+               log_error("environment target is not a sprite_instance while 
executing ActionWaitForFrame");
+               return;
+       }
+
+       // Actually *wait* for target frame, and never skip any action
+#ifdef REALLY_WAIT_ON_WAIT_FOR_FRAME
+       target_sprite->get_movie_definition()->ensure_frame_loaded(framenum);
+       assert(target_sprite->get_loaded_frames() >= framenum);
+#endif
+
+       size_t lastloaded = target_sprite->get_loaded_frames();
+       if ( lastloaded < framenum )
+       {
+               //log_msg("ActionWaitForFrame: frame %u not reached yet (loaded 
%u), skipping next %u actions", framenum, lastloaded, skip);
+               // better delegate this to ActionExec
+               thread.skip_actions(skip);
+       }
+
+       //dbglogfile << __PRETTY_FUNCTION__ << ": testing" << endl;
+}
+
+void
+SWFHandlers::ActionSetTarget(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_SETTARGET); // 0x8B
+
+       // Change the movie we're working on.
+       std::string target_name ( code.read_string(pc+3) );
+
+       character *new_target;
+                 
+       // if the string is blank, we set target to the root movie
+       // TODO - double check this is correct?
+       if ( target_name.empty() )
+       {
+               target_name = "/";
+       }
+
+       new_target = env.find_target(target_name);
+       if (new_target == NULL)
+       {
+               IF_VERBOSE_ACTION (
+               log_action("ERROR: Couldn't find movie \"%s\" "
+                       "to set target to! Not setting target at all...",
+                       target_name.c_str());
+               );
+       }
+       else
+       {
+               env.set_target(new_target);
+       }
+}
+
+void
+SWFHandlers::ActionGotoLabel(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+
+       const char* frame_label = code.read_string(thread.pc+3);
+       character *target = env.get_target();
+       sprite_instance *target_sprite = target->to_movie();
+       if ( ! target_sprite )
+       {
+               log_error("environment target is not a sprite_instance while 
executing ActionGotoLabel");
+       }
+       else
+       {
+               target_sprite->goto_labeled_frame(frame_label);
+       }
+}
+
+void
+SWFHandlers::ActionAdd(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2);
+    env.top(1) += env.top(0);
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionSubtract(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2);
+    env.top(1) -= env.top(0);
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionMultiply(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2);
+    env.top(1) *= env.top(0);
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionDivide(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2);
+    env.top(1) /= env.top(0);
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionEqual(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    assert(thread.code[thread.pc] == SWF::ACTION_EQUAL); // 0x0E
+
+    ensure_stack(env, 2);
+
+    as_value& op1 = env.top(0);
+    as_value& op2 = env.top(1);
+
+    env.top(1).set_bool(op1.to_number() == op2.to_number());
+
+    // Flash4 used 1 and 0 as return from this tag
+    if ( env.get_version() < 5 ) {
+      env.top(1).to_number();
+    } 
+
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionLessThan(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2);
+    env.top(1).set_bool(env.top(1) < env.top(0));
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionLogicalAnd(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2);
+    env.top(1).set_bool(env.top(1).to_bool() && env.top(0).to_bool());
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionLogicalOr(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2);
+    env.top(1).set_bool(env.top(1).to_bool() || env.top(0).to_bool());
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionLogicalNot(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 1);
+    env.top(0).set_bool(! env.top(0).to_bool());
+}
+
+void
+SWFHandlers::ActionStringEq(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2);
+    env.top(1).set_bool(env.top(1).to_tu_string() == 
env.top(0).to_tu_string());
+    env.drop(1);    
+}
+
+void
+SWFHandlers::ActionStringLength(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 1);
+    int version = env.get_version();
+    
env.top(0).set_int(env.top(0).to_tu_string_versioned(version).utf8_length());
+}
+
+void
+SWFHandlers::ActionSubString(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 3); // size, base, string
+
+    as_value& size_val = env.top(0);
+    as_value& base_val = env.top(1);
+    as_value& string_val = env.top(2);
+
+    // input checks
+    if ( string_val.is_undefined() || string_val.is_null() )
+    {
+       log_warning("Undefined or null string passed to ActionSubString, "
+               "returning undefined");
+       env.drop(2);
+       env.top(0).set_undefined();
+       return;
+    }
+
+    int        size = int(size_val.to_number());
+    if ( size < 0 )
+    {
+       log_warning("Negative size passed to ActionSubString, "
+               "returning undefined");
+       env.drop(2);
+       env.top(0).set_undefined();
+       return;
+    }
+
+    int        base = int(base_val.to_number());  
+    int version = env.get_version();
+    const tu_string& str = string_val.to_tu_string_versioned(version);
+
+    // TODO: if 'base' or 'size' do not evaluate to numbers return 
+    //       the empty string (how do we check if they evaluate ??)
+
+    // negative base refer to index from end
+    // -1 is *last* character, otherwise
+    // they are 1-based index from start
+    if ( base < 0 ) base += str.length();
+    else base = base-1;
+
+    if ( base < 0 || base >= str.length() )
+    {
+       log_warning("Invalid base passed to ActionSubString, "
+               "returning undefined");
+       env.drop(2);
+       env.top(0).set_undefined();
+       return;
+    }
+
+    if ( base+size > str.length() )
+    {
+       log_warning("size+based go beyond input string in ActionSubString, "
+               "returning undefined");
+       env.drop(2);
+       env.top(0).set_undefined();
+       return;
+    }
+
+
+    assert(base >= 0);
+    assert(base < str.length() );
+    assert(size >= 0);
+
+    //log_msg("string: %s, size: %d, base: %d", str.c_str(), size, base);
+
+    // Keep base within range.
+    //base = iclamp(base, 0, str.length());
+    
+    // Truncate if necessary.
+    //size = imin(str.length() - base, size);
+
+    // TODO: unsafe: use std::string::substr instead !
+    tu_string  new_string = str.c_str() + base;
+    new_string.resize(size);
+    
+    env.drop(2);
+    env.top(0).set_tu_string(new_string);
+}
+
+void
+SWFHandlers::ActionPop(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+       // this is an overhead only if SWF is malformed.
+       ensure_stack(env, 1);
+       env.drop(1);
+}
+
+void
+SWFHandlers::ActionInt(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 1);
+    env.top(0).set_int(int(floor(env.top(0).to_number())));
+}
+
+void
+SWFHandlers::ActionGetVariable(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+       ensure_stack(env, 1); // variable name
+
+       as_value& top_value = env.top(0);
+       const char* ptr = top_value.to_string();
+       if ( ! ptr )
+       {
+               top_value.set_undefined();
+               return;
+       }
+
+       std::string var_string(ptr);
+
+       top_value = env.get_variable(var_string, thread.getWithStack());
+
+       IF_VERBOSE_ACTION
+       (
+               if (top_value.to_object() == NULL) {
+                       log_action("-- get var: %s=%s",
+                               var_string.c_str(),
+                               top_value.to_string());
+               } else {
+                       log_action("-- get var: %s=%s at %p",
+                               var_string.c_str(),
+                               top_value.to_tu_string().c_str(),
+                               (void*)top_value.to_object());
+               }
+       );
+}
+
+void
+SWFHandlers::ActionSetVariable(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+
+       // stack must be contain at least two items
+       ensure_stack(env, 2); 
+
+       assert(env.top(1).to_string());
+       env.set_variable(env.top(1).to_string(), env.top(0),
+               thread.getWithStack());
+
+               IF_VERBOSE_ACTION (
+       log_action("-- set var: %s", env.top(1).to_string());
+               );
+
+       env.drop(2);
+}
+
+void
+SWFHandlers::ActionSetTargetExpression(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 1);  // target name
+
+       //Vitaly: env.drop(1) remove object on which refers const char * 
target_name
+       //strk: shouldn't we use env.pop() instead ?
+       //const char * target_name = env.top(0).to_string();
+       assert(env.top(0).to_string());
+       std::string target_name = env.top(0).to_string();
+       env.drop(1); // pop the target name off the stack
+
+       character *new_target;
+    
+       // if the string is blank, we set target to the root movie
+       // TODO - double check this is correct?
+       if ( target_name.empty() )
+       {
+               target_name = "/";
+       }
+
+       new_target = env.find_target(target_name);
+       if (new_target == NULL)
+       {
+               log_warning(
+                       " Couldn't find movie \"%s\" to set target to!"
+                       " Not setting target at all...",
+                       target_name.c_str());
+       }
+       else
+       {
+               env.set_target(new_target);
+       }
+}
+
+void
+SWFHandlers::ActionStringConcat(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 2); // two strings
+
+    int version = env.get_version();
+    env.top(1).convert_to_string_versioned(version);
+    env.top(1).string_concat(env.top(0).to_tu_string_versioned(version));
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionGetProperty(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 2); // prop num, target
+
+       character *target = env.find_target(env.top(1));
+       unsigned int prop_number = (unsigned int)env.top(0).to_number();
+       if (target)
+       {
+               if ( prop_number < get_property_names().size() )
+               {
+                       as_value val;
+                       
target->get_member(get_property_names()[prop_number].c_str(),
+                               &val);
+                       env.top(1) = val;
+        }
+        else
+               {
+                       log_error("invalid property query, property "
+                               "number %d", prop_number);
+                   env.top(1) = as_value();
+               }
+    }
+       else
+       {
+               env.top(1) = as_value();
+       }
+       env.drop(1);
+}
+
+void
+SWFHandlers::ActionSetProperty(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    
+    ensure_stack(env, 3); // prop val, prop num, target
+
+    character *target = env.find_target(env.top(2));
+    unsigned int prop_number = (unsigned int)env.top(1).to_number();
+    as_value prop_val = env.top(0);
+    
+    if (target) {
+//        set_property(target, prop_number, env.top(0));
+        if ( prop_number < get_property_names().size() )
+       {
+           target->set_member(get_property_names()[prop_number].c_str(), 
prop_val);
+       }
+       else
+       {
+           log_error("invalid set_property, property number %d", prop_number);
+       }
+        
+    }
+    env.drop(3);
+}
+
+void
+SWFHandlers::ActionDuplicateClip(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 3); 
+
+       sprite_instance* si = env.get_target()->to_movie();
+       if ( ! si )
+       {
+               log_error("environment target is not a sprite_instance while 
executing ActionDuplicateClip");
+       }
+       else
+       {
+               si->clone_display_object(
+                       env.top(2).to_std_string(),
+                       env.top(1).to_std_string(),
+                       (int) env.top(0).to_number());
+       }
+       env.drop(3);
+}
+
+void
+SWFHandlers::ActionRemoveClip(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 1); 
+
+       sprite_instance* tgt = env.get_target()->to_movie();
+       assert(tgt);
+
+       // strk: why not using pop() ?
+       tgt->remove_display_object(env.top(0).to_tu_string());
+       env.drop(1);
+}
+
+/// \brief Trace messages from the Flash movie using trace();
+void
+SWFHandlers::ActionTrace(ActionExec& thread)
+{
+////    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 1); 
+
+    // strk: why not using pop() ?
+    dbglogfile << env.top(0).to_string() << endl;
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionStartDragMovie(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 3); 
+
+    sprite_instance::drag_state        st;
+    
+    st.m_character = env.find_target(env.top(0));
+    if (st.m_character == NULL) {
+        log_error("start_drag of invalid target '%s'.",
+                  env.top(0).to_string());
+    }
+    
+    st.m_lock_center = env.top(1).to_bool();
+    st.m_bound = env.top(2).to_bool();
+    if (st.m_bound) {
+
+        // strk: this works if we didn't drop any before, in 
+        // a contrary case (if we used pop(), which I suggest)
+        // we must remember to updated this as required
+        ensure_stack(env, 7);
+
+        st.m_bound_x0 = (float) env.top(6).to_number();
+        st.m_bound_y0 = (float) env.top(5).to_number();
+        st.m_bound_x1 = (float) env.top(4).to_number();
+        st.m_bound_y1 = (float) env.top(3).to_number();
+        env.drop(4);
+    }
+    env.drop(3);
+    
+    sprite_instance *root_movie = env.get_target()->get_root_movie();
+    assert(root_movie);
+    
+    if (root_movie && st.m_character) {
+        root_movie->set_drag_state(st);
+    }
+    
+}
+
+void
+SWFHandlers::ActionStopDragMovie(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    sprite_instance *root_movie = env.get_target()->get_root_movie();
+    assert(root_movie);
+    root_movie->stop_drag();
+}
+
+void
+SWFHandlers::ActionStringCompare(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); 
+    env.top(1).set_bool(env.top(1).to_tu_string() < env.top(0).to_tu_string());
+}
+
+void
+SWFHandlers::ActionThrow(ActionExec& /*thread*/)
+{
+//    GNASH_REPORT_FUNCTION;
+    //as_environment& env = thread.env;
+    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
+}
+
+void
+SWFHandlers::ActionCastOp(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 2);  // super, instance
+
+       // Get the "super" function
+       as_function* super = env.top(0).to_as_function();
+
+       // Get the "instance" 
+       as_object* instance = env.top(1).to_object();
+
+       // Invalid args!
+       if (!super || ! instance)
+       {
+               IF_VERBOSE_ACTION (
+               log_action("-- %s instance_of %s (invalid args?)",
+                       env.top(1).to_string(),
+                       env.top(0).to_string());
+               );
+
+               env.drop(1);
+               env.top(0) = as_value(); 
+               return;
+       }
+
+       env.drop(1);
+       if ( instance->instanceOf(super) )
+       {
+               env.top(0) = as_value(instance);
+       }
+       else
+       {
+               env.top(0) = as_value();
+       }
+}
+
+void
+SWFHandlers::ActionImplementsOp(ActionExec& /*thread*/)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       // assert(thread.code[thread.pc] == SWF::ACTION_IMPLEMENTSOP);
+
+       //as_environment& env = thread.env;
+       dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
+}
+
+void
+SWFHandlers::ActionRandom(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 1);  // max
+
+       int     max = int(env.top(0).to_number());
+       if (max < 1) max = 1;
+       env.top(0).set_int(tu_random::next_random() % max);
+}
+
+void
+SWFHandlers::ActionMbLength(ActionExec& /*thread*/)
+{
+//    GNASH_REPORT_FUNCTION;
+//    as_environment& env = thread.env;
+    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
+}
+
+void
+SWFHandlers::ActionOrd(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 1);  
+    env.top(0).set_int(env.top(0).to_string()[0]);
+}
+
+void
+SWFHandlers::ActionChr(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 1);  
+    char       buf[2];
+    buf[0] = int(env.top(0).to_number());
+    buf[1] = 0;
+    env.top(0).set_string(buf);
+}
+
+void
+SWFHandlers::ActionGetTimer(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       sprite_instance* tgt = env.get_target()->to_movie();
+       assert(tgt);
+       env.push(floorf(tgt->get_timer() * 1000.0f));
+}
+
+void
+SWFHandlers::ActionMbSubString(ActionExec& /*thread*/)
+{
+//    GNASH_REPORT_FUNCTION;
+//    as_environment& env = thread.env;
+    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
+}
+
+void
+SWFHandlers::ActionMbOrd(ActionExec& /*thread*/)
+{
+//    GNASH_REPORT_FUNCTION;
+//    as_environment& env = thread.env;
+    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
+}
+
+void
+SWFHandlers::ActionMbChr(ActionExec& /*thread*/)
+{
+//    GNASH_REPORT_FUNCTION;
+//    as_environment& env = thread.env;
+    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
+}
+
+// also known as WaitForFrame2
+void
+SWFHandlers::ActionWaitForFrameExpression(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+
+       ensure_stack(env, 1); // expression
+
+       // how many actions to skip if frame has not been loaded
+       uint8 skip = code[thread.pc+3];
+
+       // env.top(0) contains frame specification,
+       // evaluated as for ActionGotoExpression
+       as_value& framespec = env.top(0);
+       
+       character* target = env.get_target();
+       sprite_instance* target_sprite = target->to_movie();
+       if ( ! target_sprite )
+       {
+               log_error("environment target is not a sprite_instance "
+                       "while executing ActionWaitForFrameExpression");
+               env.drop(1);
+               return;
+       }
+
+       size_t framenum = target_sprite->get_frame_number(framespec);
+
+#ifdef REALLY_WAIT_ON_WAIT_FOR_FRAME
+       target_sprite->get_movie_definition()->ensure_frame_loaded(framenum);
+       assert(target_sprite->get_loaded_frames() >= framenum);
+#endif
+
+       size_t lastloaded = target_sprite->get_loaded_frames();
+       if ( lastloaded < framenum )
+       {
+               //log_msg("ActionWaitForFrameExpression: frame %u not reached 
yet (loaded %u), skipping next %u actions", framenum, lastloaded, skip);
+               // better delegate this to ActionExec
+               thread.skip_actions(skip);
+       }
+
+       env.drop(1);
+       
+       //dbglogfile << __PRETTY_FUNCTION__ << ": testing" << endl;
+}
+
+void
+SWFHandlers::ActionPushData(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       const action_buffer& code = thread.code;
+
+       size_t pc = thread.pc;
+       int16_t length = code.read_int16(pc+1);
+       assert( length >= 0 );
+
+               IF_VERBOSE_ACTION (
+       log_action("-------------- push len=%d", length);
+               );
+
+       //---------------
+       size_t i = pc;
+       while (i - pc < static_cast<size_t>(length)) {
+             uint8_t type = code[3 + i];
+               IF_VERBOSE_ACTION (
+               log_action("-------------- push type=%d", type);
+               );
+             i++;
+             if (type == 0) {
+                 // string
+                 const char* str = code.read_string(i+3);
+                 i += strlen(str) + 1;
+                 env.push(str);
+                 
+               IF_VERBOSE_ACTION (
+                 log_action("-------------- pushed '%s'", str);
+               );
+             } else if (type == 1) {
+               
+                 float f = code.read_float_little(i+3);
+                 i += 4;
+                 env.push(f);
+               IF_VERBOSE_ACTION (
+                 log_action("-------------- pushed '%g'", f);
+               );
+             } else if (type == 2) {
+                 as_value nullvalue;
+                 nullvalue.set_null();
+                 env.push(nullvalue);  
+                 
+               IF_VERBOSE_ACTION (
+                 log_action("-------------- pushed NULL");
+               );
+             } else if (type == 3) {
+                 env.push(as_value());
+                 
+               IF_VERBOSE_ACTION (
+                 log_action("-------------- pushed UNDEFINED");
+               );
+             } else if (type == 4) {
+                 // contents of register
+                 uint8_t reg = code[3 + i];
+                 ++i;
+                 if ( thread.isFunction2() ) {
+                     env.push(env.local_register(reg));
+               IF_VERBOSE_ACTION (
+                     log_action("-------------- pushed local register[%d] = 
'%s'",
+                                 reg,
+                                 env.top(0).to_string());
+               );
+                 } else if (reg >= 4) {
+                     env.push(as_value());
+                     log_error("push register[%d] -- register out of bounds!", 
reg);
+                 } else {
+                     env.push(env.global_register(reg));
+               IF_VERBOSE_ACTION (
+                     log_action("-------------- pushed global register[%d] = 
'%s'",
+                                 reg,
+                                 env.top(0).to_string());
+               );
+                 }
+                 
+             } else if (type == 5) {
+                 bool  bool_val = code[i+3] ? true : false;
+                 i++;
+//                       log_msg("bool(%d)", bool_val);
+                 env.push(bool_val);
+                 
+               IF_VERBOSE_ACTION (
+                 log_action("-------------- pushed %s",
+                            (bool_val ? "true" : "false"));
+               );
+             } else if (type == 6) {
+                 double d = code.read_double_wacky(i+3);
+                 i += 8;
+                 env.push(d);
+                 
+               IF_VERBOSE_ACTION (
+                 log_action("-------------- pushed double %g", d);
+               );
+             } else if (type == 7) {
+                 // int32
+                 int32_t val = code.read_int32(i+3);
+                 i += 4;
+                 
+                 env.push(val);
+                 
+               IF_VERBOSE_ACTION (
+                 log_action("-------------- pushed int32 %d",val);
+               );
+
+             } else if (type == 8) {
+                 int id = code[3 + i];
+                 i++;
+                 if ( id < (int) code.dictionary_size() ) {
+                     env.push( code.dictionary_get(id) );
+                     
+               IF_VERBOSE_ACTION (
+                     log_action("-------------- pushed '%s'",
+                                code.dictionary_get(id));
+               );
+
+                 } else {
+                     log_error("dict_lookup(%d) is out of bounds!", id);
+                     env.push(0);
+               IF_VERBOSE_ACTION (
+                     log_action("-------------- pushed 0");
+               );
+
+                 }
+             } else if (type == 9) {
+                 int   id = code.read_int16(i+3);
+                 i += 2;
+                 if ( id < (int) code.dictionary_size() ) {
+                     env.push( code.dictionary_get(id) );
+               IF_VERBOSE_ACTION (
+                     log_action("-------------- pushed '%s'",
+                               code.dictionary_get(id) );
+               );
+                 } else {
+                     log_error("dict_lookup(%d) is out of bounds!", id);
+                     env.push(0);
+                     
+               IF_VERBOSE_ACTION (
+                     log_action("-------------- pushed 0");
+               );
+                 }
+             }
+       }
+}
+
+void
+SWFHandlers::ActionBranchAlways(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       int16_t offset = thread.code.read_int16(thread.pc+3);
+       thread.next_pc += offset;
+       // @@ TODO range checks
+}
+
+// Common code for GetUrl and GetUrl2. See:
+// http://sswf.sourceforge.net/SWFalexref.html#action_get_url
+// http://sswf.sourceforge.net/SWFalexref.html#action_get_url2
+//
+// Testcases:
+//
+// - http://www.garfield.com/comics/comics_todays.html           
+//   lower_todayscomic.swf should render four flash files in its canvas
+//
+// - http://www.voiptalk.org
+//   pressing 'My Account' button should open
+//   https://www.voiptalk.org/products/login.php
+//   NOTE: this is affected by the GetUrl bug reported with an excerpt
+//         from Colin Moock book, see below. (won't work, and won't fix)
+//
+void 
+SWFHandlers::CommonGetUrl(as_environment& env,
+               as_value target, // the target window, or _level1..10
+               const char* url_c,
+                uint8_t method /*
+                               * Bit-packed as follow
+                               *
+                               * SendVarsMethod:2 (0:NONE 1:GET 2:POST)
+                               * Reserved:4
+                               * LoadTargetFlag:1
+                               * LoadVariableFlag:1
+                               */
+               )
+{
+
+       assert(url_c);
+
+       if ( *url_c == '\0' )
+       {
+               log_warning("Bogus GetUrl url (empty) in SWF file, skipping");
+               return;
+       }
+
+#define GETURL2_LOADTARGET_FLAG   1<<7
+#define GETURL2_LOADVARIABLE_FLAG 1<<8
+
+       // Parse the method bitfield
+       uint8_t sendVarsMethod = method & 3;
+       bool loadTargetFlag    = method & 64;
+       bool loadVariableFlag  = method & 128;
+
+       // handle malformed sendVarsMethod
+       if ( sendVarsMethod == 3 )
+       {
+               log_warning("Bogus GetUrl2 send vars method "
+                       " in SWF file (both GET and POST requested), set to 0");
+               sendVarsMethod=0;
+       }
+
+       // Warn about unsupported features
+       if ( loadVariableFlag ) {
+               log_warning("Unhandled GetUrl2 loadVariable flag");
+       }
+       if ( sendVarsMethod ) {
+               log_warning("Unhandled GetUrl2 sendVariableMethod (%d)",
+                       sendVarsMethod);
+       }
+
+       const char* target_string = NULL;
+       if ( ! target.is_undefined() && ! target.is_null() )
+       {
+               target_string = target.to_string();
+       }
+
+       // If the url starts with "FSCommand:", then this is
+       // a message for the host app.
+       if (strncmp(url_c, "FSCommand:", 10) == 0)
+       {
+               if (s_fscommand_handler)
+               {
+                       // Call into the app.
+                       
(*s_fscommand_handler)(env.get_target()->get_root_movie(), url_c + 10, 
target_string);
+               }
+
+               return;
+       }
+
+       // If the url starts with "print:", then this is
+       // a print request.
+       if (strncmp(url_c, "print:", 6) == 0)
+       {
+               log_error("Printing unimplemented");
+               return;
+       }
+
+       //
+       // From "ActionScript: The Definitive Guide" by Colin Moock p. 470
+       // --------8<------------------------------------------------------
+       // In most browsers, getURL() relative links are resolved relative
+       // to the HTML file that contains the .swf file. In IE 4.5 and older
+       // versions on Macintosh, relative links are resolved relative to
+       // the location of the .swf file, not the HTML file, which causes
+       // problems when the two are in different directories. To avoid
+       // the problem, either place the .swf and the .html file in the
+       // same directory or use absolute URLs when invoking getURL().
+       // --------8<------------------------------------------------------
+       //
+       // We'll resolve relative to our "base url".
+       // The base url must be set with the set_base_url() command.
+       //
+
+       string url_s(url_c);
+
+       const URL& baseurl = get_base_url();
+       URL url(url_s, baseurl);
+
+       log_msg("get url: target=%s, url=%s (%s)", target_string,
+               url.str().c_str(), url_c);
+
+       // Check host security
+       if ( ! URLAccessManager::allow(url) )
+       {
+               return;
+       }
+
+
+       if ( loadTargetFlag )
+       {
+               log_msg("getURL2 target load");
+                     
+               character* target_ch = env.find_target(target);
+               if ( ! target_ch )
+               {
+                       log_error("get url: target %s not found",
+                               target_string);
+                       return;
+               }
+
+               sprite_instance* target_movie = target_ch->to_movie();
+               if ( ! target_movie ) 
+               {
+                       log_error("get url: target %s is not a sprite",
+                               target_string);
+                       return;
+               }
+
+               sprite_instance* root_movie = 
env.get_target()->get_root_movie();
+               attach_extern_movie(url.str().c_str(), target_movie, 
root_movie);
+       }
+       else
+       {
+               string command = "firefox -remote \"openurl(";
+               command += url.str();
+#if 0 // target testing
+               if ( target_string )
+               {
+                       command += ", " + string(target_string);
+               }
+#endif
+               command += ")\"";
+               dbglogfile << "Launching URL... " << command << endl;
+               system(command.c_str());
+       }
+}
+
+void
+SWFHandlers::ActionGetUrl2(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 2); // target, url
+
+       const action_buffer& code = thread.code;
+
+       assert( code[thread.pc] == SWF::ACTION_GETURL2 );
+
+       uint8_t method = code[thread.pc + 3];
+
+       as_value url_val = env.top(1);
+       if ( url_val.is_undefined() )
+       {
+               log_warning("Undefined GetUrl2 url on stack, skipping");
+       }
+       else
+       {
+               const char* url = url_val.to_string();
+               CommonGetUrl(env, env.top(0), url, method);
+       }
+                 
+       env.drop(2);
+}
+
+void
+SWFHandlers::ActionBranchIfTrue(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       // Alias these
+       as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+       size_t& pc = thread.pc;
+       size_t& next_pc = thread.next_pc;
+       size_t& stop_pc = thread.stop_pc;
+
+       assert( code[pc] == SWF::ACTION_BRANCHIFTRUE );
+
+       ensure_stack(env, 1); // bool
+
+       int16_t offset = code.read_int16(pc+3);
+
+       bool test = env.pop().to_bool();
+       if (test)
+       {
+               next_pc += offset;
+                     
+               if (next_pc > stop_pc)
+               {
+                       log_error("branch to offset " SIZET_FMT "  -- "
+                               " this section only runs to " SIZET_FMT ". "
+                               " Malformed SWF !.", next_pc, stop_pc);
+               }
+       }
+}
+
+void
+SWFHandlers::ActionCallFrame(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 1); // frame spec
+
+       // Note: no extra data in this instruction!
+       sprite_instance* tgt = env.get_target()->to_movie();
+       assert(tgt);
+       tgt->call_frame_actions(env.top(0));
+       env.drop(1);
+}
+
+void
+SWFHandlers::ActionGotoExpression(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 1); // expression
+
+       const action_buffer& code = thread.code;
+       size_t pc = thread.pc;
+
+    //dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
+
+       // From Alexi's SWF ref:
+       //
+       // Pop a value or a string and jump to the specified
+       // frame. When a string is specified, it can include a
+       // path to a sprite as in:
+       // 
+       //   /Test:55
+       // 
+       // When f_play is ON, the action is to play as soon as
+       // that frame is reached. Otherwise, the
+       // frame is shown in stop mode.
+
+       unsigned char play_flag = code[pc + 3];
+       sprite_instance::play_state state = play_flag ? sprite_instance::PLAY : 
sprite_instance::STOP;
+                 
+       sprite_instance* target = env.get_target()->to_movie();
+       if ( ! target )
+       {
+               log_error("environment target is not a sprite_instance while 
executing ActionGotoExpression");
+               env.drop(1);
+               return;
+       }
+
+       bool success = false;
+                 
+       if (env.top(0).get_type() == as_value::UNDEFINED)
+       {
+               // No-op.
+       }
+       else if (env.top(0).get_type() == as_value::STRING)
+       {
+               // @@ TODO: parse possible sprite path...
+               //
+               // Also, if the frame spec is actually a number (not a label),
+               // then we need to do the conversion...
+                     
+               const char* frame_label = env.top(0).to_string();
+               if (target->goto_labeled_frame(frame_label))
+               {
+                       success = true;
+               }
+               else
+               {
+                       // Couldn't find the label. Try converting to a number.
+                       double num;
+                       if (string_to_number(&num, env.top(0).to_string()))
+                       {
+                               int frame_number = int(num);
+                               target->goto_frame(frame_number);
+                               success = true;
+                       }
+                       // else no-op.
+                     }
+       }
+       else if (env.top(0).get_type() == as_value::OBJECT)
+       {
+               // This is a no-op; see test_goto_frame.swf
+       }
+       else if (env.top(0).get_type() == as_value::NUMBER)
+       {
+               // Frame numbers appear to be 0-based!  @@ Verify.
+               int frame_number = int(env.top(0).to_number());
+               target->goto_frame(frame_number);
+               success = true;
+       }
+                 
+       if (success)
+       {
+               target->set_play_state(state);
+       }
+                 
+       env.drop(1);
+}
+
+void
+SWFHandlers::ActionDeleteVar(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 2); // var, object
+
+       as_value var = env.pop();
+       as_value object = env.top(0);
+       if (object.get_type() == as_value::OBJECT)
+       {
+               as_object* obj = (as_object*) object.to_object();
+               if (obj)
+               {
+                       // set to NaN and eventually release memory
+                       obj->set_member(var.to_tu_string(), as_value());
+
+                       // TODO: remove a member  from object if it there is
+
+                       env.top(0).set_bool(true);
+                       return;
+               }
+       }
+
+       env.top(0).set_bool(false);
+}
+
+void
+SWFHandlers::ActionDelete(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 2); // var
+
+    as_value var = env.top(0);
+
+    std::string varstr(var.to_string());
+    
+    as_value oldval = env.get_variable_raw(varstr);
+    
+    if (!oldval.get_type() == as_value::UNDEFINED) {
+        // set variable to 'undefined'
+        // that hopefully --ref_count and eventually
+        // release memory. 
+        env.set_variable_raw(varstr, as_value());
+        env.top(0).set_bool(true);
+    } else {
+        env.top(0).set_bool(false);
+    }
+}
+
+void
+SWFHandlers::ActionVarEquals(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); // value, var
+
+    as_value value = env.pop();
+    as_value varname = env.pop();
+    env.set_local(varname.to_std_string(), value);
+}
+
+void
+SWFHandlers::ActionCallFunction(ActionExec& thread)
+{
+       //GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 2); // func name, nargs
+
+       //cerr << "At ActionCallFunction enter:"<<endl;
+       //env.dump_stack();
+
+       as_value function;
+       if (env.top(0).get_type() == as_value::STRING)
+       {
+               // Function is a string; lookup the function.
+               const std::string function_name(env.top(0).to_string());
+               function = env.get_variable(function_name);
+               
+               if (function.get_type() != as_value::AS_FUNCTION &&
+                   function.get_type() != as_value::C_FUNCTION)
+               {
+                       IF_VERBOSE_ASCODING_ERRORS(
+                   log_warning("error in call_function: '%s' is not a "
+                               "function", function_name.c_str());
+                       );
+               }
+       }
+       else
+       {
+               // Hopefully the actual
+               // function object is here.
+               // QUESTION: would this be
+               // an ActionScript-defined
+               // function ?
+               function = env.top(0);
+       }
+       int     nargs = (int)env.top(1).to_number();
+
+       ensure_stack(env, 2+nargs); // func name, nargs, args
+
+       //log_msg("Function's nargs: %d", nargs);
+    
+       as_value result = call_method(function, &env, env.get_target(),
+                                 nargs, env.get_top_index() - 2);
+
+       //log_msg("Function's result: %s", result.to_string());
+    
+       env.drop(nargs + 1);
+       env.top(0) = result;
+
+       //cerr << "After ActionCallFunction:"<<endl;
+       //env.dump_stack();
+}
+
+void
+SWFHandlers::ActionReturn(ActionExec& thread)
+{
+       //GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+       as_value* retval = thread.retval;
+
+       //log_msg("Before top/drop (retval=%p)", (void*)retval);
+       //env.dump_stack();
+
+       ensure_stack(env, 1); // ret value
+
+       // Put top of stack in the provided return slot, if
+       // it's not NULL.
+       if (retval) {
+               *retval = env.top(0);
+       }
+       env.drop(1);
+
+       //log_msg("After top/drop");
+       //env.dump_stack();
+    
+       // Skip the rest of this buffer (return from this action_buffer).
+       thread.next_pc = thread.stop_pc;
+
+}
+
+void
+SWFHandlers::ActionModulo(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 2); // x, ,y
+
+    as_value   result;
+    double     y = env.pop().to_number();
+    double     x = env.pop().to_number();
+//  Don't need to check for y being 0 here - if it's zero, fmod returns NaN
+//  which is what flash would do too
+    result = fmod(x, y);
+//  env.top(1).set_double(fmod(env.top(1).to_bool() && env.top(0).to_bool());
+//  env.drop(1);
+//  log_error("modulo x=%f, y=%f, z=%f",x,y,result.to_number());
+    env.push(result);
+}
+
+void
+SWFHandlers::ActionNew(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 2); // classname, nargs
+
+       as_value val = env.pop();
+       std::string classname;
+       if ( val.to_string() ) classname = val.to_string();
+
+       IF_VERBOSE_ACTION (
+               log_action("---new object: %s",
+                       classname.c_str());
+       );
+
+       int     nargs = (int) env.pop().to_number();
+
+       ensure_stack(env, nargs); // previous 2 entries popped
+
+       as_value constructor = env.get_variable(classname);
+
+       as_value new_obj = construct_object(constructor, env, nargs,
+               env.get_top_index());
+
+       env.drop(nargs);
+       env.push(new_obj);
+
+}
+
+void
+SWFHandlers::ActionVar(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 1); // var name
+    std::string varname = env.top(0).to_std_string();
+    env.declare_local(varname);
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionInitArray(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 1); // array size name
+
+    int        array_size = (int) env.pop().to_number();
+    assert(array_size >= 0);
+
+    ensure_stack(env, (unsigned int)array_size); // array elements
+    
+    //log_msg("xxx init array: size = %d, top of stack = %d", array_size, 
env.get_top_index());//xxxxx
+    
+    // Call the array constructor, to create an empty array.
+    as_value   result;
+    array_new(fn_call(&result, NULL, &env, 0, env.get_top_index()));
+    
+    as_object* ao = result.to_object();
+    assert(ao);
+    
+    // Fill the elements with the initial values from the stack.
+    as_value   index_number;
+    for (int i = 0; i < array_size; i++) {
+        // @@ TODO a set_member that takes an int or as_value?
+        index_number.set_int(i);
+        ao->set_member(index_number.to_string(), env.pop());
+    }
+    
+    env.push(result);
+    
+    //log_msg("xxx init array end: top of stack = %d, trace(top(0)) =", 
env.get_top_index());//xxxxxxx
+    
+    //as_global_trace(fn_call(NULL, NULL, env, 1, env.get_top_index()));       
//xxxx
+    
+}
+
+void
+SWFHandlers::ActionInitObject(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 1); // nmembers
+
+    // 
+    //    SWFACTION_PUSH
+    //     [000]   Constant: 1 "obj"
+    //     [001]   Constant: 0 "member" <-- we handle up to here
+    //     [002]   Integer: 1
+    //     [003]   Integer: 1
+    //    SWFACTION_INITOBJECT
+    
+    int nmembers = (int) env.pop().to_number();
+
+    ensure_stack(env, nmembers); // members
+    
+    boost::intrusive_ptr<as_object> 
new_obj_ptr(init_object_instance().release()); 
+    
+    // Set provided members
+    for (int i=0; i<nmembers; ++i) {
+        as_value member_value = env.pop();
+        tu_stringi member_name = env.pop().to_tu_stringi();
+        new_obj_ptr->set_member(member_name, member_value);
+    }
+    
+    // @@ TODO
+    //log_error("checkme opcode: %02X", action_id);
+    
+    as_value new_obj;
+    new_obj.set_as_object(new_obj_ptr.get());
+    
+    //env.drop(nmembers*2);
+    env.push(new_obj); 
+    
+}
+
+void
+SWFHandlers::ActionTypeOf(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 1); 
+
+    switch(env.top(0).get_type()) {
+      case as_value::UNDEFINED:
+          env.top(0).set_string("undefined");
+          break;
+      case as_value::STRING:
+          env.top(0).set_string("string");
+          break;
+      case as_value::NUMBER:
+          env.top(0).set_string("number");
+          break;
+      case as_value::BOOLEAN:
+          env.top(0).set_string("boolean");
+          break;
+      case as_value::OBJECT:
+          env.top(0).set_string("object");
+          break;
+      case as_value::NULLTYPE:
+          env.top(0).set_string("null");
+          break;
+      case as_value::AS_FUNCTION:
+          env.top(0).set_string("function");
+          break;
+      case as_value::C_FUNCTION:
+          env.top(0).set_string("function");
+          break;
+      default:
+          log_error("typeof unknown type: %02X", env.top(0).get_type());
+          env.top(0).set_undefined();
+          break;
+    }
+}
+
+void
+SWFHandlers::ActionTargetPath(ActionExec& /*thread*/)
+{
+//    GNASH_REPORT_FUNCTION;
+//    as_environment& env = thread.env;
+    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
+}
+
+// Push a each object's member value on the stack
+// This is an utility function for use by ActionEnumerate
+// and ActionEnum2. The caller is expected to have
+// already set the top-of-stack to the NULL value (as an optimization)
+static void
+enumerateObject(as_environment& env, const as_object& obj)
+{
+    
+       assert( env.top(0).get_type() == as_value::NULLTYPE );
+       obj.enumerateProperties(env);
+}
+
+void
+SWFHandlers::ActionEnumerate(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 1);  // var_name
+
+       // Get the object
+       as_value& var_name = env.top(0);
+       std::string var_string = var_name.to_std_string();
+       as_value variable = env.get_variable(var_string);
+       const as_object* obj = variable.to_object();
+
+       // The end of the enumeration, don't set top(0) *before*
+       // fetching the as_object* obj above or it will get lost
+       env.top(0).set_null();
+
+       IF_VERBOSE_ACTION (
+       log_action("---enumerate - push: NULL");
+       );
+
+       if ( ! obj )
+       {
+               log_warning("Top of stack not an object (%s) at "
+                       "ActionEnumerate execution",
+                       variable.to_string());
+               return;
+       }
+
+       enumerateObject(env, *obj);
+}
+
+void
+SWFHandlers::ActionNewAdd(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 2); 
+
+    int version = env.get_version();
+    if (env.top(0).get_type() == as_value::STRING
+        || env.top(1).get_type() == as_value::STRING) {
+        env.top(1).convert_to_string_versioned(version);
+        env.top(1).string_concat(env.top(0).to_tu_string_versioned(version));
+    } else {
+        env.top(1) += env.top(0);
+    }
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionNewLessThan(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 2); 
+
+    if (env.top(1).get_type() == as_value::STRING) {
+        env.top(1).set_bool(env.top(1).to_tu_string() < 
env.top(0).to_tu_string());
+    } else {
+        env.top(1).set_bool(env.top(1) < env.top(0));
+    }
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionNewEquals(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    assert(thread.code[thread.pc] == SWF::ACTION_NEWEQUALS);
+
+    ensure_stack(env, 2); 
+
+    /// ECMA-262 abstract equality comparison (sect 11.9.3)
+    env.top(1).set_bool(env.top(1) == env.top(0));
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionToNumber(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 1); 
+    env.top(0).convert_to_number();
+}
+
+void
+SWFHandlers::ActionToString(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 1); 
+    int version = env.get_version();
+    env.top(0).convert_to_string_versioned(version);
+}
+
+void
+SWFHandlers::ActionDup(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 1); 
+    env.push(env.top(0));
+}
+
+void
+SWFHandlers::ActionSwap(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); 
+    as_value   temp = env.top(1);
+    env.top(1) = env.top(0);
+    env.top(0) = temp;
+}
+
+void
+SWFHandlers::ActionGetMember(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 2); // member name, target
+
+    // Some corner case behaviors depend on the SWF file version.
+    int version = env.get_version();
+    
+    as_value member_name = env.top(0);
+    as_value target = env.top(1);
+    
+    as_object* obj = target.to_object();
+    if (!obj) {
+//         IF_VERBOSE_DEBUG(log_msg("getMember called against "
+//                                  "a value that does not cast "
+//                                  "to an as_object: %s", 
target.to_string()));
+        env.top(1).set_undefined();
+        env.drop(1);
+        return;
+    }
+    
+       IF_VERBOSE_ACTION (
+    log_action(" ActionGetMember: target: %s (object %p)",
+               target.to_string(), (void*)obj);
+       );
+    
+    // Special case: String has a member "length"
+    // @@ FIXME: we shouldn't have all this "special" cases --strk;
+    if (target.get_type() == as_value::STRING && member_name.to_tu_stringi() 
== "length") {
+        int len = target.to_tu_string_versioned(version).utf8_length();
+        env.top(1).set_int(len); 
+    } else {
+        if (!obj->get_member(member_name.to_tu_string(), &(env.top(1)))) {
+            env.top(1).set_undefined();
+        }
+        
+       IF_VERBOSE_ACTION (
+        log_action("-- get_member %s=%s",
+                   member_name.to_tu_string().c_str(),
+                   env.top(1).to_tu_string().c_str());
+       );
+    }
+    env.drop(1);
+    
+}
+
+void
+SWFHandlers::ActionSetMember(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 3); // value, member, object
+
+       as_object*      obj = env.top(2).to_object();
+
+
+       if (obj)
+       {
+               obj->set_member(env.top(1).to_tu_string(), env.top(0));
+               IF_VERBOSE_ACTION (
+                       log_action("-- set_member %s.%s=%s",
+                               env.top(2).to_tu_string().c_str(),
+                               env.top(1).to_tu_string().c_str(),
+                               env.top(0).to_tu_string().c_str());
+               );
+       }
+       else
+       {
+               IF_VERBOSE_ACTION (
+                       // Invalid object, can't set.
+                       log_action("-- set_member %s.%s=%s on invalid object!",
+                               env.top(2).to_tu_string().c_str(),
+                               env.top(1).to_tu_string().c_str(),
+                               env.top(0).to_tu_string().c_str());
+               );
+       }
+
+
+       env.drop(3);
+}
+
+void
+SWFHandlers::ActionIncrement(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 1); 
+
+    env.top(0) += 1;
+}
+
+void
+SWFHandlers::ActionDecrement(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 1); 
+    env.top(0) -= 1;
+}
+
+void
+SWFHandlers::ActionCallMethod(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 3);  // method_name, obj, nargs
+
+    as_value result;
+
+    // Some corner case behaviors depend on the SWF file version.
+    //int version = env.get_version();
+
+    // Get name of the method
+    const tu_string &method_name = env.top(0).to_tu_string();
+
+    // Get an object
+    as_value& obj_value = env.top(1);
+    as_object *obj = obj_value.to_object();
+
+    // Get number of arguments
+    int nargs = static_cast<int>(env.top(2).to_number());
+
+    ensure_stack(env, 3+nargs); // actual args
+
+       IF_VERBOSE_ACTION (
+    log_action(" method name: %s", method_name.c_str());
+    log_action(" method object: %p", (void*)obj);
+    log_action(" method nargs: %d", nargs);
+       );
+
+       // for temporarly storing result of automatic
+       // String and Number conversion
+       std::auto_ptr<as_object> obj_ptr;
+
+    if (!obj)
+    {
+       // try automatic casting strings to String objects
+       // and numbers to Number objects
+       // TODO: check if moving this in as_value::to_object()
+       //       would break anything (better to use in head)
+       switch ( obj_value.get_type() )
+       {
+               case as_value::STRING:
+                       obj_ptr = init_string_instance(obj_value.to_string());
+                       obj = obj_ptr.get();
+                       break;
+               case as_value::NUMBER:
+                       obj_ptr = init_number_instance(obj_value.to_number());
+                       obj = obj_ptr.get();
+                       break;
+               default:
+                       break;
+       }
+
+    }
+
+    if (!obj)
+    {
+        IF_VERBOSE_ASCODING_ERRORS(
+          log_warning("call_method invoked in something that "
+            "doesn't cast to an as_object: %s",
+            obj_value.to_string());
+        );
+    }
+    else
+    {
+        as_value method;
+        if (obj->get_member(method_name, &method))
+        {
+          if (method.get_type() != as_value::AS_FUNCTION &&
+              method.get_type() != as_value::C_FUNCTION)
+          {
+              IF_VERBOSE_ASCODING_ERRORS(
+                log_warning("call_method: '%s' is not a method",
+                    method_name.c_str());
+              );
+          }
+          else
+          {
+            result = call_method( method, &env, obj, nargs,
+                env.get_top_index() - 3);
+          }
+        }
+        else
+        {
+            IF_VERBOSE_ASCODING_ERRORS(
+                log_warning("call_method can't find method %s "
+                    "for object %s (%p)", method_name.c_str(), 
+                    typeid(*obj).name(), (void*)obj);
+            );
+        }
+    }
+    
+    env.drop(nargs + 2);
+    env.top(0) = result;
+
+    // This is to check stack status after call method
+    //log_msg("at doActionCallMethod() end, stack: "); env.dump_stack();
+    
+}
+
+void
+SWFHandlers::ActionNewMethod(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+
+       assert( thread.code[thread.pc] == SWF::ACTION_NEWMETHOD );
+
+       ensure_stack(env, 3); // method, object, nargs
+
+       as_value method_name = env.pop().to_string();
+       as_value obj_val = env.pop();
+       int nargs = (int)env.pop().to_number();
+
+       ensure_stack(env, nargs); // previous 3 entries popped
+
+       as_object* obj = obj_val.to_object();
+       if ( ! obj )
+       {
+               // SWF integrity check 
+               log_warning(
+                       "On ActionNewMethod: "
+                       "no object found on stack on ActionMethod");
+               env.drop(nargs);
+               return;
+       }
+
+       as_value method_val;
+       if ( ! obj->get_member(method_name.to_tu_stringi(), &method_val) )
+       {
+               // SWF integrity check 
+               log_warning(
+                       "On ActionNewMethod: "
+                       "can't find method %s of object %s",
+                       method_name.to_string(), obj_val.to_string());
+               env.drop(nargs);
+               return;
+       }
+
+       // Construct the object
+       as_value new_obj = construct_object(method_val, env, nargs,
+                       env.get_top_index());
+
+       log_msg("%s.%s( [%d args] ) returned %s", obj_val.to_string(),
+               method_name.to_string(), nargs, new_obj.to_string());
+
+
+       env.drop(nargs);
+       env.push(new_obj);
+
+}
+
+void
+SWFHandlers::ActionInstanceOf(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+
+    ensure_stack(env, 2); // super, instance
+
+    // Get the "super" function
+    as_function* super = env.top(0).to_as_function();
+
+    // Get the "instance" 
+    as_object* instance = env.top(1).to_object();
+
+    // Invalid args!
+    if (!super || ! instance) {
+        IF_VERBOSE_ACTION(
+        log_action("-- %s instance_of %s (invalid args?)",
+                env.top(1).to_string(),
+                env.top(0).to_string());
+        );
+
+        env.drop(1);
+        env.top(0) = as_value(false); 
+        return;
+    }
+
+    env.drop(1);
+    env.top(0) = as_value(instance->instanceOf(super));
+}
+
+void
+SWFHandlers::ActionEnum2(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 1); // object
+
+       // Get the object.
+       // Copy it so we can override env.top(0)
+       as_value obj_val = env.top(0);
+
+       // End of the enumeration. Won't override the object
+       // as we copied that as_value.
+       env.top(0).set_null(); 
+
+       as_object* obj = obj_val.to_object();
+       if ( ! obj )
+       {
+               log_warning("Top of stack not an object (%s) at ActionEnum2 "
+                       " execution",
+                       obj_val.to_string());
+               return;
+       }
+
+       enumerateObject(env, *obj);
+
+       dbglogfile << __PRETTY_FUNCTION__ << ": testing" << endl;
+}
+
+void
+SWFHandlers::ActionBitwiseAnd(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); 
+    env.top(1) &= env.top(0);
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionBitwiseOr(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); 
+    env.top(1) |= env.top(0);
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionBitwiseXor(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); 
+    env.top(1) ^= env.top(0);
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionShiftLeft(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); 
+    env.top(1).asr(env.top(0));
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionShiftRight(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); 
+    env.top(1).lsr(env.top(0));
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionShiftRight2(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); 
+    env.top(1).lsr(env.top(0));
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionStrictEq(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); 
+    if (env.top(1).get_type() != env.top(0).get_type()) {
+        // Types don't match.
+        env.top(1).set_bool(false);
+        env.drop(1);
+    } else {
+        env.top(1).set_bool(env.top(1) == env.top(0));
+        env.drop(1);
+    }
+}
+
+void
+SWFHandlers::ActionGreater(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); 
+    if (env.top(1).get_type() == as_value::STRING) {
+        env.top(1).set_bool(env.top(1).to_tu_string() > 
env.top(0).to_tu_string());
+    } else {
+        env.top(1).set_bool(env.top(1).to_number() > env.top(0).to_number());
+    }
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionStringGreater(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+    as_environment& env = thread.env;
+    ensure_stack(env, 2); 
+    env.top(1).set_bool(env.top(1).to_tu_string() > env.top(0).to_tu_string());
+    env.drop(1);
+}
+
+void
+SWFHandlers::ActionExtends(ActionExec& /*thread*/)
+{
+//    GNASH_REPORT_FUNCTION;
+    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
+}
+
+void
+SWFHandlers::ActionConstantPool(ActionExec& thread)
+{
+//    GNASH_REPORT_FUNCTION;
+       thread.code.process_decl_dict(thread.pc, thread.next_pc);
+}
+
+void
+SWFHandlers::ActionDefineFunction2(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+
+       // Code starts at thread.next_pc as the DefineFunction tag
+       // 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.getWithStack());
+
+       func->set_is_function2();
+
+       size_t i = thread.pc + 3; // skip tag id and length
+
+       // Extract name.
+       // @@ security: watch out for possible missing terminator here!
+       std::string name = code.read_string(i);
+       i += name.length() + 1; // add NULL-termination
+
+       //cerr << " name:" << name << endl;
+
+       // Get number of arguments.
+       int nargs = code.read_int16(i);
+       i += 2;
+
+       //cerr << " nargs:" << nargs << endl;
+
+       // Get the count of local registers used by this function.
+       uint8 register_count = code[i];
+       i++;
+
+       //cerr << " nregisters:" << nargs << endl;
+
+       func->set_local_register_count(register_count);
+
+       // Flags, for controlling register assignment of implicit args.
+       uint16  flags = code.read_int16(i);
+       i += 2;
+
+       func->set_function2_flags(flags);
+
+       // Get the register assignments and names of the arguments.
+       for (int n = 0; n < nargs; n++)
+       {
+               uint8 arg_register = code[i];
+               ++i;
+       
+               // @@ security: watch out for possible missing terminator here!
+               const char* arg = code.read_string(i);
+
+               //log_msg("Setting register %d/%d to %s", arg_register, nargs, 
arg);
+
+               func->add_arg(arg_register, arg);
+               i += strlen(arg)+1;
+       }
+
+       // Get the length of the actual function code.
+       int16_t code_size = code.read_int16(i);
+       assert( code_size >= 0 );
+       i += 2;
+       func->set_length(code_size);
+
+       // Skip the function body (don't interpret it now).
+       thread.next_pc += code_size; 
+
+       // If we have a name, then save the function in this
+       // environment under that name.
+       as_value function_value(func);
+       if (name.length() > 0)
+       {
+               // @@ NOTE: should this be m_target->set_variable()???
+               env.set_member(name, function_value);
+       }
+    
+       // Also leave it on the stack.
+       env.push_val(function_value);
+}
+
+void
+SWFHandlers::ActionTry(ActionExec& /*thread*/)
+{
+//    GNASH_REPORT_FUNCTION;
+    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
+}
+
+/// See: http://sswf.sourceforge.net/SWFalexref.html#action_with
+void
+SWFHandlers::ActionWith(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_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());
+       );
+
+       ++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;
+       }
+
+}
+
+void
+SWFHandlers::ActionDefineFunction(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+       const action_buffer& code = thread.code;
+
+       int16_t length = code.read_int16(thread.pc+1);
+       assert( length >= 0 );
+
+       //cerr << " length:" << length << endl;
+
+       // Create a new swf_function
+       // Code starts at thread.next_pc as the DefineFunction tag
+       // 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.getWithStack());
+
+       size_t i = thread.pc + 3;
+
+       // Extract name.
+       // @@ security: watch out for possible missing terminator here!
+       std::string name = code.read_string(i);
+       i += name.length() + 1;
+
+       //cerr << " name:" << name << endl;
+
+       // Get number of arguments.
+       int nargs = code.read_int16(i);
+       i += 2;
+
+       //cerr << " nargs:" << nargs << endl;
+
+       // Get the names of the arguments.
+       for (int n = 0; n < nargs; n++)
+       {
+               const char* arg = code.read_string(i);
+               //cerr << " arg" << n << " : " << arg << endl;
+
+               // @@ security: watch out for possible missing terminator here!
+               func->add_arg(0, arg);
+               // wouldn't it be simpler to use strlen(arg)+1 ?
+               i += strlen(arg)+1; // func->m_args.back().m_name.length() + 1;
+       }
+
+       // Get the length of the actual function code.
+       int16_t code_size = code.read_int16(i);
+
+       //cerr << " code size:" << code_size << endl;
+
+       func->set_length(code_size);
+
+    
+       // Skip the function body (don't interpret it now).
+       // next_pc is assumed to point to first action of
+       // the function body (one-past the current tag, whic
+       // is DefineFunction). We add code_size to it.
+       thread.next_pc += code_size;
+
+       // If we have a name, then save the function in this
+       // environment under that name.
+       as_value        function_value(func);
+       if (name.length() > 0)
+       {
+               // @@ NOTE: should this be m_target->set_variable()???
+               env.set_member(name, function_value);
+       }
+    
+       // Also leave it on the stack.
+       env.push_val(function_value);
+
+       //cerr << "After ActionDefineFunction:"<<endl;
+       //env.dump_stack();
+}
+
+void
+SWFHandlers::ActionSetRegister(ActionExec& thread)
+{
+//     GNASH_REPORT_FUNCTION;
+
+       as_environment& env = thread.env;
+
+       ensure_stack(env, 1); 
+
+       const action_buffer& code = thread.code;
+
+       uint8_t reg = code[thread.pc + 3];
+
+       // Save top of stack in specified register.
+       if ( thread.isFunction2() )
+       {
+               env.local_register(reg) = env.top(0);
+                     
+               IF_VERBOSE_ACTION (
+               log_action("-------------- local register[%d] = '%s'",
+                       reg, env.top(0).to_string());
+               );
+
+       }
+       else if (reg < 4)
+       {
+               env.global_register(reg) = env.top(0);
+                     
+               IF_VERBOSE_ACTION (
+               log_action("-------------- global register[%d] = '%s'",
+                       reg, env.top(0).to_string() );
+               );
+
+       }
+       else
+       {
+               log_error("store_register[%d] -- register out of bounds!",
+                       reg);
+       }
+                 
+}
+
+const char*
+SWFHandlers::action_name(action_type x) const
+{
+       if ( static_cast<size_t>(x) > get_handlers().size() )
+       {
+               log_error("at SWFHandlers::action_name(%d) call time, _handlers 
size is " 
+                         SIZET_FMT, x, get_handlers().size());
+               return NULL;
+       }
+       else
+       {
+               return get_handlers()[x].getName().c_str();
+       }
+}
+
+/*static private*/
+void
+SWFHandlers::fix_stack_underrun(as_environment& env, size_t required)
+{
+    assert ( env.stack_size() < required );
+
+    size_t missing = required-env.stack_size();
+
+    log_error("Stack underrun: " SIZET_FMT " elements required, " SIZET_FMT 
+        " available. Fixing by pushing " SIZET_FMT " undefined values on the"
+       " missing slots.", required, env.stack_size(), missing);
+
+    for (size_t i=0; i<missing; ++i)
+    {
+        env.push(as_value());
+    }
+}
+
+} // namespace gnash::SWF
+
+} // namespace gnash

Index: server/vm/ASHandlers.h
===================================================================
RCS file: server/vm/ASHandlers.h
diff -N server/vm/ASHandlers.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/vm/ASHandlers.h      24 Nov 2006 09:04:25 -0000      1.1
@@ -0,0 +1,277 @@
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// 
+//
+
+#ifndef __ASHANDLERS_H__
+#define __ASHANDLERS_H__
+
+#include <string>
+#include <map>
+#include <vector>
+#include "action.h" // we should get rid of this probably
+#include "as_environment.h" // for ensure_stack inline (must be inlined!)
+#include "swf.h"
+
+
+// Forward declarations
+namespace gnash {
+       class ActionExec;
+}
+
+namespace gnash {
+
+/// SWF format parsing classes
+namespace SWF { // gnash::SWF
+
+typedef enum {
+    ARG_NONE = 0,
+    ARG_STR,
+    // default hex dump, in case the format is unknown or unsupported
+    ARG_HEX,
+    ARG_U8,
+    ARG_U16,
+    ARG_S16,
+    ARG_PUSH_DATA,
+    ARG_DECL_DICT,
+    ARG_FUNCTION2
+} as_arg_t;
+
+// @@strk@@ should we move this to .cpp file ? it's only
+// use is within SWFHandlers, anyway...
+typedef void (*action_callback_t)(ActionExec& thread);
+//as_environment &env, action_buffer& code, size_t& PC);
+class ActionHandler
+{
+public:
+    ActionHandler();
+    ActionHandler(action_type type, action_callback_t func);
+    ActionHandler(action_type type, std::string name, 
+                  action_callback_t func);
+    ActionHandler(action_type type, std::string name, 
+                  action_callback_t func, as_arg_t format);
+    ActionHandler(action_type type, std::string name, 
+                  action_callback_t func, as_arg_t format, int nargs);
+    ~ActionHandler();
+
+    /// Execute the action
+    void execute(ActionExec& thread) const;
+
+    void toggleDebug(bool state) const { _debug = state; }
+    action_type getType()   const { return _type; }
+    std::string getName()   const { return _name; }
+    int getNumArgs()        const { return _stack_args; }
+    as_arg_t getArgFormat() const { return _arg_format; }
+private:
+    action_type       _type;
+    std::string       _name;
+    action_callback_t _callback;
+    mutable bool      _debug;
+    int               _stack_args; // the number of args to pop from the stack
+    as_arg_t          _arg_format;
+};
+
+/// A singleton containing the supported SWF Action handlers.
+class SWFHandlers
+{
+public:
+
+       /// TODO: use a vector as we can have at most 254 actions
+       /// (127 w/out length, 127 with length, the high bit is
+       ///  used to distinguish the two types)
+       //typedef std::map<action_type, ActionHandler> container_type;
+
+       // Indexed by action id
+       typedef std::vector<ActionHandler> container_type;
+
+       /// Return the singleton instance of SWFHandlers class
+       static const SWFHandlers& instance();
+
+       /// Execute the action identified by 'type' action type
+       void execute(action_type type, ActionExec& thread) const;
+
+       void toggleDebug(bool state) { _debug = state; }
+
+       size_t size() const { return get_handlers().size(); }
+
+       action_type lastType() const
+       {
+               return ACTION_GOTOEXPRESSION;
+               //return _handlers[ACTION_GOTOEXPRESSION].getType();
+       }
+
+       const ActionHandler &operator[] (action_type x) const
+       {
+               //return const_cast<ActionHandler>(_handlers[x]);
+               return get_handlers()[x];
+       }
+
+       const char* action_name(action_type x) const;
+
+private:
+
+       static container_type & get_handlers();
+       static std::vector<std::string> & get_property_names();
+
+       // Ensure the stack has at least 'required' elements, fixing
+       // it if required.
+       // This is an inline to it can eventually be made a no-op
+       // when gnash works and input SWFs are known to be valid.
+       static void ensure_stack(as_environment& env, size_t required)
+       {
+               if ( env.stack_size() < required )
+               {
+                       fix_stack_underrun(env, required);
+               }
+       }
+
+       // Fill all the slots to reach the 'required' stack size
+       // with undefined values. This method should *only* be
+       // called by ensure_stack() above.
+       static void fix_stack_underrun(as_environment& env, size_t required);
+
+       /// Common code for ActionGetUrl and ActionGetUrl2
+       //
+       /// @see http://sswf.sourceforge.net/SWFalexref.html#action_get_url2
+       /// @see http://sswf.sourceforge.net/SWFalexref.html#action_get_url
+       ///
+       /// @param target
+       ///     the target window or _level1 to _level10
+       ///
+       /// @param method
+       ///     0:NONE, 1:GET, 2:POST
+       ///
+       static void CommonGetUrl(as_environment& env, 
+                       as_value target, const char* url,
+                       uint8_t method);
+
+       static void ActionEnd(ActionExec& thread);
+       static void ActionNextFrame(ActionExec& thread);
+       static void ActionPrevFrame(ActionExec& thread);
+       static void ActionPlay(ActionExec& thread);
+       static void ActionStop(ActionExec& thread);
+       static void ActionToggleQuality(ActionExec& thread);
+       static void ActionStopSounds(ActionExec& thread);
+       static void ActionGotoFrame(ActionExec& thread);
+       static void ActionGetUrl(ActionExec& thread);
+       static void ActionWaitForFrame(ActionExec& thread);
+       static void ActionSetTarget(ActionExec& thread);
+       static void ActionGotoLabel(ActionExec& thread);
+       static void ActionAdd(ActionExec& thread);
+       static void ActionSubtract(ActionExec& thread);
+       static void ActionMultiply(ActionExec& thread);
+       static void ActionDivide(ActionExec& thread);
+       static void ActionEqual(ActionExec& thread);
+       static void ActionLessThan(ActionExec& thread);
+       static void ActionLogicalAnd(ActionExec& thread);
+       static void ActionLogicalOr(ActionExec& thread);
+       static void ActionLogicalNot(ActionExec& thread);
+       static void ActionStringEq(ActionExec& thread);
+       static void ActionStringLength(ActionExec& thread);
+       static void ActionSubString(ActionExec& thread);
+       static void ActionPop(ActionExec& thread);
+       static void ActionInt(ActionExec& thread);
+       static void ActionGetVariable(ActionExec& thread);
+       static void ActionSetVariable(ActionExec& thread);
+       static void ActionSetTargetExpression(ActionExec& thread);
+       static void ActionStringConcat(ActionExec& thread);
+       static void ActionGetProperty(ActionExec& thread);
+       static void ActionSetProperty(ActionExec& thread);
+       static void ActionDuplicateClip(ActionExec& thread);
+       static void ActionRemoveClip(ActionExec& thread);
+       static void ActionTrace(ActionExec& thread);
+       static void ActionStartDragMovie(ActionExec& thread);
+       static void ActionStopDragMovie(ActionExec& thread);
+       static void ActionStringCompare(ActionExec& thread);
+       static void ActionThrow(ActionExec& thread);
+       static void ActionCastOp(ActionExec& thread);
+       static void ActionImplementsOp(ActionExec& thread);
+       static void ActionRandom(ActionExec& thread);
+       static void ActionMbLength(ActionExec& thread);
+       static void ActionOrd(ActionExec& thread);
+       static void ActionChr(ActionExec& thread);
+       static void ActionGetTimer(ActionExec& thread);
+       static void ActionMbSubString(ActionExec& thread);
+       static void ActionMbOrd(ActionExec& thread);
+       static void ActionMbChr(ActionExec& thread);
+       static void ActionWaitForFrameExpression(ActionExec& thread);
+       static void ActionPushData(ActionExec& thread);
+       static void ActionBranchAlways(ActionExec& thread);
+       static void ActionGetUrl2(ActionExec& thread);
+       static void ActionBranchIfTrue(ActionExec& thread);
+       static void ActionCallFrame(ActionExec& thread);
+       static void ActionGotoExpression(ActionExec& thread);
+       static void ActionDeleteVar(ActionExec& thread);
+       static void ActionDelete(ActionExec& thread);
+       static void ActionVarEquals(ActionExec& thread);
+       static void ActionCallFunction(ActionExec& thread);
+       static void ActionReturn(ActionExec& thread);
+       static void ActionModulo(ActionExec& thread);
+       static void ActionNew(ActionExec& thread);
+       static void ActionVar(ActionExec& thread);
+       static void ActionInitArray(ActionExec& thread);
+       static void ActionInitObject(ActionExec& thread);
+       static void ActionTypeOf(ActionExec& thread);
+       static void ActionTargetPath(ActionExec& thread);
+       static void ActionEnumerate(ActionExec& thread);
+       static void ActionNewAdd(ActionExec& thread);
+       static void ActionNewLessThan(ActionExec& thread);
+       static void ActionNewEquals(ActionExec& thread);
+       static void ActionToNumber(ActionExec& thread);
+       static void ActionToString(ActionExec& thread);
+       static void ActionDup(ActionExec& thread);
+       static void ActionSwap(ActionExec& thread);
+       static void ActionGetMember(ActionExec& thread);
+       static void ActionSetMember(ActionExec& thread);
+       static void ActionIncrement(ActionExec& thread);
+       static void ActionDecrement(ActionExec& thread);
+       static void ActionCallMethod(ActionExec& thread);
+       static void ActionNewMethod(ActionExec& thread);
+       static void ActionInstanceOf(ActionExec& thread);
+       static void ActionEnum2(ActionExec& thread);
+       static void ActionBitwiseAnd(ActionExec& thread);
+       static void ActionBitwiseOr(ActionExec& thread);
+       static void ActionBitwiseXor(ActionExec& thread);
+       static void ActionShiftLeft(ActionExec& thread);
+       static void ActionShiftRight(ActionExec& thread);
+       static void ActionShiftRight2(ActionExec& thread);
+       static void ActionStrictEq(ActionExec& thread);
+       static void ActionGreater(ActionExec& thread);
+       static void ActionStringGreater(ActionExec& thread);
+       static void ActionExtends(ActionExec& thread);
+       static void ActionConstantPool(ActionExec& thread);
+       static void ActionDefineFunction2(ActionExec& thread);
+       static void ActionTry(ActionExec& thread);
+       static void ActionWith(ActionExec& thread);
+       static void ActionDefineFunction(ActionExec& thread);
+       static void ActionSetRegister(ActionExec& thread);
+
+       bool _debug;
+
+       // Use the ::instance() method to get a reference
+       SWFHandlers();
+
+       // You won't destroy a singleton
+       ~SWFHandlers();
+
+};
+
+
+} // namespace gnash::SWF
+
+} // namespace gnash
+
+#endif // end of __ASHANDLERS_H__

Index: server/vm/ActionExec.cpp
===================================================================
RCS file: server/vm/ActionExec.cpp
diff -N server/vm/ActionExec.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/vm/ActionExec.cpp    24 Nov 2006 09:04:25 -0000      1.1
@@ -0,0 +1,257 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+//
+
+/* $Id: ActionExec.cpp,v 1.1 2006/11/24 09:04:25 strk Exp $ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ActionExec.h"
+#include "action_buffer.h"
+#include "swf_function.h" 
+#include "log.h"
+//#include "stream.h"
+
+#include "swf.h"
+#include "ASHandlers.h"
+#include "as_environment.h"
+
+#include <typeinfo> 
+
+#if !defined(_WIN32) && !defined(WIN32)
+# include <pthread.h> 
+#endif
+
+#include <sstream>
+#include <string>
+
+#ifndef DEBUG_STACK
+// temporarly disabled as will produce lots of output with -v
+// we'd need another switch maybe, as -va does also produce
+// too much information for my tastes. I really want just
+// to see how stack changes while executing actions...
+// --strk Fri Jun 30 02:28:46 CEST 2006
+#define DEBUG_STACK 1
+#endif
+
+using namespace gnash;
+using namespace SWF;
+using std::string;
+using std::endl;
+using std::stringstream;
+
+
+namespace gnash {
+
+static const SWFHandlers& ash = SWFHandlers::instance();
+
+// External interface (to be moved under swf/ASHandlers)
+fscommand_callback s_fscommand_handler = NULL;
+void   register_fscommand_callback(fscommand_callback handler)
+{
+    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)
+       :
+       with_stack(initial_with_stack),
+       _with_stack_limit(7),
+       _function2_var(nIsFunction2),
+       code(abuf),
+       pc(nStartPC),
+       stop_pc(nStartPC+exec_bytes),
+       next_pc(nStartPC),
+       env(newEnv),
+       retval(retval)
+{
+       GNASH_REPORT_FUNCTION;
+
+       /// See: http://sswf.sourceforge.net/SWFalexref.html#action_with
+       if ( env.get_version() > 5 ) _with_stack_limit = 15;
+}
+
+ActionExec::ActionExec(const action_buffer& abuf, as_environment& newEnv)
+       :
+       with_stack(),
+       _with_stack_limit(7),
+       _function2_var(false),
+       code(abuf),
+       pc(0),
+       stop_pc(code.size()),
+       next_pc(0),
+       env(newEnv),
+       retval(0)
+{
+       GNASH_REPORT_FUNCTION;
+
+       /// See: http://sswf.sourceforge.net/SWFalexref.html#action_with
+       if ( env.get_version() > 5 ) _with_stack_limit = 15;
+}
+
+void
+ActionExec::operator() ()
+{
+    action_init();     // @@ stick this somewhere else; need some global 
static init function
+
+#if 0
+    // Check the time
+    if (periodic_events.expired()) {
+       periodic_events.poll_event_handlers(&env);
+    }
+#endif
+               
+    character* original_target = env.get_target();
+
+#if DEBUG_STACK
+       IF_VERBOSE_ACTION (
+               log_action("at ActionExec operator() start, pc=" SIZET_FMT
+                          ", stop_pc=" SIZET_FMT ", code.size=" SIZET_FMT
+                          ".", pc, 
+                          stop_pc, code.size());
+               stringstream ss;
+               env.dump_stack(ss);
+               env.dump_global_registers(ss);
+               env.dump_local_registers(ss);
+               log_action("%s", ss.str().c_str());
+       );
+#endif
+
+    while (pc<stop_pc)
+    {
+
+       // Cleanup any expired "with" blocks.
+       while ( ! with_stack.empty() && pc >= with_stack.back().end_pc() )
+       {
+               // Drop last stack element
+               with_stack.pop_back();
+       }
+       
+       // Get the opcode.
+       uint8_t action_id = code[pc];
+
+       IF_VERBOSE_ACTION (
+               log_action("\nPC:%d - EX:\t", pc);
+               code.log_disasm(pc);
+       );
+
+       // Set default next_pc offset, control flow action handlers
+       // will be able to reset it. 
+       if ((action_id & 0x80) == 0) {
+               // action with no extra data
+               next_pc = pc+1;
+       } else {
+               // action with extra data
+               int16_t length = code.read_int16(pc+1);
+               assert( length >= 0 );
+               next_pc = pc + length + 3;
+       }
+
+       // Do we still need this ?
+       if ( action_id == SWF::ACTION_END ) {
+               // this would turn into an assertion (next_pc==stop_pc)
+               //              log_msg("At ACTION_END next_pc=%d, stop_pc=%d", 
next_pc, stop_pc);
+               break;
+       }
+
+       ash.execute((action_type)action_id, *this);
+
+#if DEBUG_STACK
+       IF_VERBOSE_ACTION (
+               log_action( " After execution, PC is " SIZET_FMT ".", pc);
+               stringstream ss;
+               env.dump_stack(ss);
+               env.dump_global_registers(ss);
+               env.dump_local_registers(ss);
+               log_action("%s", ss.str().c_str());
+       );
+#endif
+
+       // Control flow actions will change the PC (next_pc)
+       pc = next_pc;
+
+    }
+    
+    env.set_target(original_target);
+}
+
+void
+ActionExec::skip_actions(size_t offset)
+{
+       //pc = next_pc;
+
+       for(size_t i=0; i<offset; ++i)
+       {
+#if 1
+               // we need to check at every iteration because
+               // an action can be longer then a single byte
+               if ( next_pc >= stop_pc )
+               {
+                       log_error("End of DoAction block hit while skipping "
+                               SIZET_FMT " action tags (pc:" SIZET_FMT 
+                               ", stop_pc:" SIZET_FMT ") - Mallformed SWF ?"
+                               "(WaitForFrame, probably)", offset, next_pc,
+                               stop_pc);
+                       next_pc = stop_pc;
+                       return;
+               }
+#endif
+
+               // Get the opcode.
+               uint8_t action_id = code[next_pc];
+
+               // Set default next_pc offset, control flow action handlers
+               // will be able to reset it. 
+               if ((action_id & 0x80) == 0) {
+                       // action with no extra data
+                       next_pc++;
+               } else {
+                       // action with extra data
+                       int16_t length = code.read_int16(next_pc+1);
+                       assert( length >= 0 );
+                       next_pc += length + 3;
+               }
+
+               //pc = next_pc;
+       }
+}
+
+bool
+ActionExec::pushWithEntry(const with_stack_entry& entry)
+{
+       if (with_stack.size() < _with_stack_limit)
+       {
+               with_stack.push_back(entry);
+               return true;
+       }
+       else
+       {
+               return false;
+       }
+}
+
+} // end of namespace gnash
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: server/vm/ActionExec.h
===================================================================
RCS file: server/vm/ActionExec.h
diff -N server/vm/ActionExec.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/vm/ActionExec.h      24 Nov 2006 09:04:25 -0000      1.1
@@ -0,0 +1,162 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+//
+
+#ifndef GNASH_ACTIONEXEC_H
+#define GNASH_ACTIONEXEC_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "with_stack_entry.h"
+
+#include <vector>
+
+// Forward declarations
+namespace gnash {
+       class action_buffer;
+       class as_environment;
+       class as_value;
+}
+
+namespace gnash {
+
+/// Executor of an action_buffer 
+class ActionExec {
+
+       /// the 'with' stack associated with this execution thread
+       std::vector<with_stack_entry> with_stack;
+
+       /// Limit of with stack
+       //
+       /// This is 7 for SWF up to 5 and 15 for SWF 6 and up
+       /// See: http://sswf.sourceforge.net/SWFalexref.html#action_with
+       size_t _with_stack_limit;
+
+       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;
+
+       /// Create an execution thread 
+       ActionExec(const action_buffer& abuf, as_environment& newEnv);
+
+       /// 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);
+
+       /// 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;
+       }
+
+       /// Return the maximum allowed 'with' stack limit.
+       //
+       /// See http://sswf.sourceforge.net/SWFalexref.html#action_with
+       /// for more info.
+       ///
+       size_t getWithStackLimit() const 
+       {
+               return _with_stack_limit;
+       }
+
+       /// 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() ();
+};
+
+} // namespace gnash
+
+#endif // GNASH_ACTIONEXEC_H
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: server/vm/Makefile.am
===================================================================
RCS file: server/vm/Makefile.am
diff -N server/vm/Makefile.am
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/vm/Makefile.am       24 Nov 2006 09:04:25 -0000      1.1
@@ -0,0 +1,73 @@
+## Process this file with automake to generate Makefile.in
+# 
+#   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+# 
+#
+
+# $Id: Makefile.am,v 1.1 2006/11/24 09:04:25 strk Exp $
+
+AUTOMAKE_OPTIONS = 
+
+AM_CPPFLAGS = 
+
+noinst_LTLIBRARIES = libgnashvm.la 
+
+INCLUDES = \
+       -I$(top_srcdir)/backend \
+       -I$(top_srcdir)/server \
+       -I$(top_srcdir)/server/asobj \
+       -I$(top_srcdir)/server/swf \
+       -I$(top_srcdir)/server/parser \
+        -I$(top_srcdir)/libbase \
+        -I$(top_srcdir)/libamf \
+        -I$(top_srcdir)        \
+       $(PTHREAD_CFLAGS) \
+       $(DMALLOC_CFLAGS) \
+       $(BOOST_CFLAGS) \
+       $(LIBXML_CFLAGS) \
+       $(FFMPEG_CFLAGS) \
+       $(NULL)
+
+libgnashvm_la_SOURCES = \
+       ASHandlers.cpp \
+       ActionExec.cpp \
+        action.cpp \
+       $(NULL)
+
+noinst_HEADERS =               \
+       ASHandlers.h            \
+       ActionExec.h            \
+       action.h                \
+       fn_call.h               \
+       with_stack_entry.h      \
+       $(NULL)
+
+libgnashvm_la_LIBADD = \
+       $(top_builddir)/libamf/libgnashamf.la \
+       $(top_builddir)/libbase/libgnashbase.la \
+       $(FFMPEG_LIBS)
+
+libgnashvm_la_LDFLAGS = -avoid-version
+
+# Rebuild with GCC 4.x Mudflap support
+mudflap:
+       @echo "Rebuilding with GCC Mudflap support"
+       $(MAKE) CXXFLAGS="$(CXXFLAGS) -fmudflap" LDFLAGS="$(LDFLAGS) -lmudflap"
+
+clean-hook:
+       -rm -f core.*
+

Index: server/vm/action.cpp
===================================================================
RCS file: server/vm/action.cpp
diff -N server/vm/action.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/vm/action.cpp        24 Nov 2006 09:04:25 -0000      1.1
@@ -0,0 +1,636 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+//
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <typeinfo> 
+
+#if !defined(_WIN32) && !defined(WIN32)
+# include <pthread.h> 
+#endif
+
+#include <string>
+
+#include "action.h"
+#include "as_object.h"
+#include "impl.h"
+#include "log.h"
+//#include "stream.h"
+#include "tu_random.h"
+
+//#include "gstring.h"
+#include "movie_definition.h"
+#include "MovieClipLoader.h"
+#include "as_function.h"
+#include "timers.h"
+#include "textformat.h"
+#include "sound.h"
+#include "array.h"
+#include "types.h"
+#include "sprite_instance.h"
+
+#ifdef HAVE_LIBXML
+#include "xml.h"
+#include "xmlsocket.h"
+#endif
+
+#include "Global.h"
+#include "swf.h"
+//#include "ASHandlers.h"
+#include "URL.h"
+#include "GnashException.h"
+#include "as_environment.h"
+#include "fn_call.h"
+
+using namespace gnash;
+using namespace SWF;
+
+#if defined(_WIN32) || defined(WIN32)
+#define snprintf _snprintf
+#endif // _WIN32
+
+// NOTES:
+//
+// Buttons
+// on (press)                 onPress
+// on (release)               onRelease
+// on (releaseOutside)        onReleaseOutside
+// on (rollOver)              onRollOver
+// on (rollOut)               onRollOut
+// on (dragOver)              onDragOver
+// on (dragOut)               onDragOut
+// on (keyPress"...")         onKeyDown, onKeyUp      <----- IMPORTANT
+//
+// Sprites
+// onClipEvent (load)         onLoad
+// onClipEvent (unload)       onUnload                Hm.
+// onClipEvent (enterFrame)   onEnterFrame
+// onClipEvent (mouseDown)    onMouseDown
+// onClipEvent (mouseUp)      onMouseUp
+// onClipEvent (mouseMove)    onMouseMove
+// onClipEvent (keyDown)      onKeyDown
+// onClipEvent (keyUp)        onKeyUp
+// onClipEvent (data)         onData
+
+// Text fields have event handlers too!
+
+// Sprite built in methods:
+// play()
+// stop()
+// gotoAndStop()
+// gotoAndPlay()
+// nextFrame()
+// startDrag()
+// getURL()
+// getBytesLoaded()
+// getBytesTotal()
+
+// Built-in functions: (do these actually exist in the VM, or are they just 
opcodes?)
+// Number()
+// String()
+
+
+// TODO builtins
+//
+// Number.toString() -- takes an optional arg that specifies the base
+//
+// Boolean() type cast
+//
+// typeof operator --> "number", "string", "boolean", "object" (also
+// for arrays), "null", "movieclip", "function", "undefined"
+//
+// Number.MAX_VALUE, Number.MIN_VALUE
+//
+// String.fromCharCode()
+
+namespace gnash {
+
+//
+// action stuff
+//
+
+void   action_init();
+
+// Statics.
+bool   s_inited = false;
+boost::intrusive_ptr<as_object>        s_global;
+
+void register_component(const tu_stringi& name, as_c_function_ptr handler)
+{
+       action_init();
+       assert(s_global != NULL);
+       s_global->set_member(name, handler);
+}
+
+void
+attach_extern_movie(const char* c_url,
+               const sprite_instance* target,
+               const sprite_instance* root_movie)
+{
+       URL url(c_url);
+
+       movie_definition* md = create_library_movie(url); 
+       if (md == NULL)
+       {
+           log_error("can't create movie_definition for %s\n", 
url.str().c_str());
+           return;
+       }
+
+       gnash::sprite_instance* extern_movie;
+
+       if (target == root_movie)
+       {
+               extern_movie = create_library_movie_inst(md);                   
+               if (extern_movie == NULL)
+               {
+                       log_error("can't create extern root sprite for %s\n", 
url.str().c_str());
+                       return;
+               }
+           set_current_root(extern_movie);
+           sprite_instance* m = extern_movie->get_root_movie();
+
+           m->on_event(event_id::LOAD);
+       }
+       else
+       {
+               extern_movie = md->create_instance();
+               if (extern_movie == NULL)
+               {
+                       log_error("can't create extern sprite for %s\n", 
url.str().c_str());
+                       return;
+               }
+      
+               save_extern_movie(extern_movie);
+      
+               const character* tar = (const character*)target;
+               const char* name = tar->get_name().c_str();
+               uint16_t depth = tar->get_depth();
+               bool use_cxform = false;
+               cxform color_transform =  tar->get_cxform();
+               bool use_matrix = false;
+               matrix mat = tar->get_matrix();
+               float ratio = tar->get_ratio();
+               uint16_t clip_depth = tar->get_clip_depth();
+
+               character* parent = tar->get_parent();
+               sprite_instance* newsprite = extern_movie->get_root_movie();
+
+               assert(parent);
+               assert(newsprite);
+
+               newsprite->set_parent(parent);
+
+               sprite_instance* parent_sprite = parent->to_movie();
+               assert(parent_sprite);
+       
+           parent_sprite->replace_display_object(
+               newsprite,
+               name,
+               depth,
+               use_cxform,
+               color_transform,
+               use_matrix,
+               mat,
+               ratio,
+               clip_depth);
+       }
+}
+
+//
+// Function/method dispatch.
+//
+
+as_value
+call_method(
+    const as_value& method,
+    as_environment* env,
+    as_object* this_ptr, // this is ourself
+    int nargs,
+    int first_arg_bottom_index)
+    // first_arg_bottom_index is the stack index, from the bottom,
+    // of the first argument.
+    // Subsequent arguments are at *lower* indices. 
+    // E.g. if first_arg_bottom_index = 7, then arg1 is at env->bottom(7),
+    // arg2 is at env->bottom(6), etc.
+{
+       as_value val;
+       fn_call call(&val, this_ptr, env, nargs, first_arg_bottom_index);
+
+       if ( as_c_function_ptr func = method.to_c_function() )
+       {
+           // It's a C function.  Call it.
+           (*func)(call);
+       }
+       else if ( as_function* as_func = method.to_as_function() )
+       {
+           // It's an ActionScript function.  Call it.
+           (*as_func)(call);
+       }
+       else
+       {
+                       IF_VERBOSE_ASCODING_ERRORS(
+               log_warning(
+                       "error in call_method(): "
+                       "'%s' is neither a C nor an ActionScript function\n",
+                       method.to_string());
+                       );
+       }
+
+       return val;
+}
+
+
+as_value       call_method0(
+    const as_value& method,
+    as_environment* env,
+    as_object* this_ptr)
+{
+    return call_method(method, env, this_ptr, 0, env->get_top_index() + 1);
+}
+               
+const char*    call_method_parsed(
+    as_environment* env,
+    as_object* this_ptr,
+    const char* method_name,
+    const char* method_arg_fmt,
+    va_list args)
+    // Printf-like vararg interface for calling ActionScript.
+    // Handy for external binding.
+{
+    log_msg("FIXME(%d): %s\n", __LINE__, __FUNCTION__);
+
+#if 0
+    static const int   BUFSIZE = 1000;
+    char       buffer[BUFSIZE];
+    std::vector<const char*>   tokens;
+
+    // Brutal crap parsing.  Basically null out any
+    // delimiter characters, so that the method name and
+    // args sit in the buffer as null-terminated C
+    // strings.  Leave an intial ' character as the first
+    // char in a string argument.
+    // Don't verify parens or matching quotes or anything.
+    {
+       strncpy(buffer, method_call, BUFSIZE);
+       buffer[BUFSIZE - 1] = '\0';
+       char*   p = buffer;
+
+       char    in_quote = 0;
+       bool    in_arg = false;
+       for (;; p++)
+           {
+               char    c = *p;
+               if (c == 0)
+                   {
+                       // End of string.
+                       break;
+                   }
+               else if (c == in_quote)
+                   {
+                       // End of quotation.
+                       assert(in_arg);
+                       *p = 0;
+                       in_quote = 0;
+                       in_arg = false;
+                   }
+               else if (in_arg)
+                   {
+                       if (in_quote == 0)
+                           {
+                               if (c == ')' || c == '(' || c == ',' || c == ' 
')
+                                   {
+                                       // End of arg.
+                                       *p = 0;
+                                       in_arg = false;
+                                   }
+                           }
+                   }
+               else
+                   {
+                       // Not in arg.  Watch for start of arg.
+                       assert(in_quote == 0);
+                       if (c == '\'' || c == '\"')
+                           {
+                               // Start of quote.
+                               in_quote = c;
+                               in_arg = true;
+                               *p = '\'';      // ' at the start of the arg, 
so later we know this is a string.
+                               tokens.push_back(p);
+                           }
+                       else if (c == ' ' || c == ',')
+                           {
+                               // Non-arg junk, null it out.
+                               *p = 0;
+                           }
+                       else
+                           {
+                               // Must be the start of a numeric arg.
+                               in_arg = true;
+                               tokens.push_back(p);
+                           }
+                   }
+           }
+    }
+#endif // 0
+
+
+    // Parse va_list args
+    int        starting_index = env->get_top_index();
+    const char* p = method_arg_fmt;
+    for (;; p++)
+       {
+           char        c = *p;
+           if (c == 0)
+               {
+                   // End of args.
+                   break;
+               }
+           else if (c == '%')
+               {
+                   p++;
+                   c = *p;
+                   // Here's an arg.
+                   if (c == 'd')
+                       {
+                           // Integer.
+                           env->push(va_arg(args, int));
+                       }
+                   else if (c == 'f')
+                       {
+                           // Double
+                           env->push(va_arg(args, double));
+                       }
+                   else if (c == 's')
+                       {
+                           // String
+                           env->push(va_arg(args, const char *));
+                       }
+                   else if (c == 'l')
+                       {
+                           p++;
+                           c = *p;
+                           if (c == 's')
+                               {
+                                   // Wide string.
+                                   env->push(va_arg(args, const wchar_t *));
+                               }
+                           else
+                               {
+                                   log_error("call_method_parsed('%s','%s') -- 
invalid fmt '%%l%c'\n",
+                                             method_name,
+                                             method_arg_fmt,
+                                             c);
+                               }
+                       }
+                   else
+                       {
+                           // Invalid fmt, warn.
+                           log_error("call_method_parsed('%s','%s') -- invalid 
fmt '%%%c'\n",
+                                     method_name,
+                                     method_arg_fmt,
+                                     c);
+                       }
+               }
+           else
+               {
+                   // Ignore whitespace and commas.
+                   if (c == ' ' || c == '\t' || c == ',')
+                       {
+                           // OK
+                       }
+                   else
+                       {
+                           // Invalid arg; warn.
+                           log_error("call_method_parsed('%s','%s') -- invalid 
char '%c'\n",
+                                     method_name,
+                                     method_arg_fmt,
+                                     c);
+                       }
+               }
+       }
+
+    as_value   method = env->get_variable(method_name);
+
+    // check method
+
+    // Reverse the order of pushed args
+    int        nargs = env->get_top_index() - starting_index;
+    for (int i = 0; i < (nargs >> 1); i++)
+       {
+           int i0 = starting_index + 1 + i;
+           int i1 = starting_index + nargs - i;
+           assert(i0 < i1);
+
+           swap(&(env->bottom(i0)), &(env->bottom(i1)));
+       }
+
+    // Do the call.
+    as_value   result = call_method(method, env, this_ptr, nargs, 
env->get_top_index());
+    env->drop(nargs);
+
+    // Return pointer to static string for return value.
+    static tu_string   s_retval;
+    s_retval = result.to_tu_string();
+    return s_retval.c_str();
+}
+
+void
+movie_load()
+{
+    log_action("-- start movie");
+}
+
+//
+// Built-in objects
+//
+
+
+void
+event_test(const fn_call& /*fn*/)
+{
+    log_msg("FIXME: %s\n", __FUNCTION__);
+}
+       
+
+//
+// global init
+//
+
+
+
+void
+action_init()
+    // Create/hook built-ins.
+{
+    if (s_inited == false) {
+       s_inited = true;
+       
+       // @@ s_global should really be a
+       // client-visible player object, which
+       // contains one or more actual movie
+       // instances.  We're currently just hacking it
+       // in as an app-global mutable object :(
+       assert(s_global == NULL);
+       s_global = new gnash::Global();
+    }
+}
+
+
+void
+action_clear()
+{
+    if (s_inited) {
+       s_inited = false;
+       
+       s_global->clear();
+       s_global = NULL;
+    }
+}
+
+//
+// event_id
+//
+
+const tu_string&
+event_id::get_function_name() const
+{
+    static tu_string   s_function_names[EVENT_COUNT] =
+       {
+           "INVALID",           // INVALID
+           "onPress",           // PRESS
+           "onRelease",                 // RELEASE
+           "onRelease_Outside",         // RELEASE_OUTSIDE
+           "onRoll_Over",               // ROLL_OVER
+           "onRoll_Out",                // ROLL_OUT
+           "onDrag_Over",               // DRAG_OVER
+           "onDrag_Out",                // DRAG_OUT
+           "onKeyPress",                // KEY_PRESS
+           "onInitialize",              // INITIALIZE
+
+           "onLoad",            // LOAD
+           "onUnload",          // UNLOAD
+           "onEnterFrame",              // ENTER_FRAME
+           "onMouseDown",               // MOUSE_DOWN
+           "onMouseUp",                 // MOUSE_UP
+           "onMouseMove",               // MOUSE_MOVE
+           "onKeyDown",                 // KEY_DOWN
+           "onKeyUp",           // KEY_UP
+           "onData",            // DATA
+           // These are for the MoveClipLoader ActionScript only
+           "onLoadStart",               // LOAD_START
+           "onLoadError",               // LOAD_ERROR
+           "onLoadProgress",    // LOAD_PROGRESS
+           "onLoadInit",                // LOAD_INIT
+           // These are for the XMLSocket ActionScript only
+           "onSockClose",               // CLOSE
+           "onSockConnect",     // CONNECT
+           "onSockData",                // Data
+           "onSockXML",                 // XML
+           // These are for the XML ActionScript only
+           "onXMLLoad",                 // XML_LOAD
+           "onXMLData",                 // XML_DATA
+           "onTimer",           // setInterval Timer expired
+
+           "onConstruct",
+                       "onSetFocus",
+                       "onKillFocus"
+       };
+
+    assert(m_id > INVALID && m_id < EVENT_COUNT);
+    return s_function_names[m_id];
+}
+
+bool
+event_id::is_mouse_event() const
+{
+       switch (m_id)
+       {
+               case event_id::KEY_PRESS :
+               case event_id::PRESS:
+               case event_id::RELEASE:
+               case event_id::RELEASE_OUTSIDE:
+               case event_id::MOUSE_UP:
+               case event_id::MOUSE_DOWN:
+               case event_id::ROLL_OVER:
+               case event_id::ROLL_OUT:
+               case event_id::DRAG_OVER:
+               case event_id::DRAG_OUT:
+                       return true;
+               default:
+                       return false;
+       }
+}
+
+// Standard member lookup.
+as_standard_member
+get_standard_member(const tu_stringi& name)
+{
+    static bool        s_inited = false;
+    static stringi_hash<as_standard_member>    s_standard_member_map;
+    if (!s_inited) {
+       s_inited = true;
+       
+       s_standard_member_map.resize(int(AS_STANDARD_MEMBER_COUNT));
+       
+       s_standard_member_map.add("_x", M_X);
+       s_standard_member_map.add("_y", M_Y);
+       s_standard_member_map.add("_xscale", M_XSCALE);
+       s_standard_member_map.add("_yscale", M_YSCALE);
+       s_standard_member_map.add("_currentframe", M_CURRENTFRAME);
+       s_standard_member_map.add("_totalframes", M_TOTALFRAMES);
+       s_standard_member_map.add("_alpha", M_ALPHA);
+       s_standard_member_map.add("_visible", M_VISIBLE);
+       s_standard_member_map.add("_width", M_WIDTH);
+       s_standard_member_map.add("_height", M_HEIGHT);
+       s_standard_member_map.add("_rotation", M_ROTATION);
+       s_standard_member_map.add("_target", M_TARGET);
+       s_standard_member_map.add("_framesloaded", M_FRAMESLOADED);
+       s_standard_member_map.add("_name", M_NAME);
+       s_standard_member_map.add("_droptarget", M_DROPTARGET);
+       s_standard_member_map.add("_url", M_URL);
+       s_standard_member_map.add("_highquality", M_HIGHQUALITY);
+       s_standard_member_map.add("_focusrect", M_FOCUSRECT);
+       s_standard_member_map.add("_soundbuftime", M_SOUNDBUFTIME);
+       s_standard_member_map.add("_xmouse", M_XMOUSE);
+       s_standard_member_map.add("_ymouse", M_YMOUSE);
+       s_standard_member_map.add("_parent", M_PARENT);
+       s_standard_member_map.add("text", M_TEXT);
+       s_standard_member_map.add("textWidth", M_TEXTWIDTH);
+       s_standard_member_map.add("textColor", M_TEXTCOLOR);
+       s_standard_member_map.add("onLoad", M_ONLOAD);
+       s_standard_member_map.add("onRollOver", M_ONROLLOVER);
+       s_standard_member_map.add("onRollOut", M_ONROLLOUT);
+    }
+    
+    as_standard_member result = M_INVALID_MEMBER;
+    s_standard_member_map.get(name, &result);
+    
+    return result;
+}
+
+
+
+}
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: server/vm/action.h
===================================================================
RCS file: server/vm/action.h
diff -N server/vm/action.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/vm/action.h  24 Nov 2006 09:04:25 -0000      1.1
@@ -0,0 +1,162 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// 
+//
+//
+
+// Implementation and helpers for SWF actions.
+
+
+#ifndef GNASH_ACTION_H
+#define GNASH_ACTION_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "tu_config.h"
+
+#include "gnash.h"
+#include "as_object.h"
+#include "types.h"
+#include "container.h"
+#include "smart_ptr.h"
+
+#include <cwchar>
+
+
+namespace gnash {
+       class sprite_instance;
+       class as_environment;
+       class as_object;
+       class as_value;
+       class swf_function;
+
+
+       extern DSOEXPORT boost::intrusive_ptr<as_object> s_global;
+
+       class DSOLOCAL as_property_interface
+       {
+       public:
+               virtual ~as_property_interface() {}
+               virtual bool    set_property(int index, const as_value& val) = 
0;
+       };
+
+       //
+       // Some handy helpers
+       //
+
+       /// Create/hook built-ins.
+       DSOEXPORT void  action_init();
+
+       // Clean up any stray heap stuff we've allocated.
+       void    action_clear();
+
+       // Dispatching methods from C++.
+       as_value        call_method0(const as_value& method, as_environment* 
env, as_object* this_ptr);
+       as_value        call_method1(
+               const as_value& method, as_environment* env, as_object* 
this_ptr,
+               const as_value& arg0);
+       as_value        call_method2(
+               const as_value& method, as_environment* env, as_object* 
this_ptr,
+               const as_value& arg0, const as_value& arg1);
+       as_value        call_method3(
+               const as_value& method, as_environment* env, as_object* 
this_ptr,
+               const as_value& arg0, const as_value& arg1, const as_value& 
arg2);
+
+       /// Call a method, be it an as_function or a c_function. 
+       //
+       /// This is a thin wrapper around operator() and fn_call,
+       /// probably worth dropping.
+       ///
+       /// first_arg_bottom_index is the stack index, from the bottom,
+       /// of the first argument.  Subsequent arguments are at *lower*
+       /// indices.  E.g. if first_arg_bottom_index = 7, then arg1 is
+       /// at env->bottom(7), arg2 is at env->bottom(6), etc.
+       ///
+       DSOEXPORT as_value call_method(const as_value& method, as_environment* 
env,
+               as_object* this_ptr, // this is ourself
+               int nargs, int first_arg_bottom_index);
+
+       const char*     call_method_parsed(
+               as_environment* env,
+               as_object* this_ptr,
+               const char* method_name,
+               const char* method_arg_fmt,
+               va_list args);
+
+       // tulrich: don't use this!  To register a class constructor,
+       // just assign the classname to the constructor function.  E.g.:
+       //
+       // my_movie->set_member("MyClass", 
as_value(MyClassConstructorFunction));
+       // 
+       //void register_as_object(const char* object_name, as_c_function_ptr 
handler);
+
+       /// Numerical indices for standard member names.  Can use this
+       /// to help speed up get/set member calls, by using a switch()
+       /// instead of nasty string compares.
+       enum as_standard_member
+       {
+               M_INVALID_MEMBER = -1,
+               M_X,
+               M_Y,
+               M_XSCALE,
+               M_YSCALE,
+               M_CURRENTFRAME,
+               M_TOTALFRAMES,
+               M_ALPHA,
+               M_VISIBLE,
+               M_WIDTH,
+               M_HEIGHT,
+               M_ROTATION,
+               M_TARGET,
+               M_FRAMESLOADED,
+               M_NAME,
+               M_DROPTARGET,
+               M_URL,
+               M_HIGHQUALITY,
+               M_FOCUSRECT,
+               M_SOUNDBUFTIME,
+               M_XMOUSE,
+               M_YMOUSE,
+               M_PARENT,
+               M_TEXT,
+               M_TEXTWIDTH,
+               M_TEXTCOLOR,
+               M_ONLOAD,
+               M_ONROLLOVER,
+               M_ONROLLOUT,
+
+               AS_STANDARD_MEMBER_COUNT
+       };
+
+       /// Return the standard enum, if the arg names a standard member.
+       /// Returns M_INVALID_MEMBER if there's no match.
+       as_standard_member      get_standard_member(const tu_stringi& name);
+
+       void attach_extern_movie(const char* c_url, const sprite_instance* 
target, const sprite_instance* root_movie);
+
+}      // end namespace gnash
+
+
+#endif // GNASH_ACTION_H
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: server/vm/fn_call.h
===================================================================
RCS file: server/vm/fn_call.h
diff -N server/vm/fn_call.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/vm/fn_call.h 24 Nov 2006 09:04:25 -0000      1.1
@@ -0,0 +1,85 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// 
+//
+//
+
+#ifndef _GNASH_FN_CALL_H_
+#define _GNASH_FN_CALL_H_
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "as_environment.h" // for inlines (arg)
+
+#include <cassert> // for inlines (arg)
+
+namespace gnash {
+
+// Forward declarations
+class as_environment;
+class as_object;
+class as_value;
+
+/// \brief
+/// Parameters/environment for builtin or user-defined functions
+/// callable from ActionScript.
+class fn_call
+{
+public:
+       as_value* result;
+       as_object* this_ptr;
+       as_environment* env;
+       int nargs;
+       int first_arg_bottom_index;
+
+       fn_call(as_value* res_in, as_object* this_in,
+                       as_environment* env_in,
+                       int nargs_in, int first_in)
+               :
+               result(res_in),
+               this_ptr(this_in),
+               env(env_in),
+               nargs(nargs_in),
+               first_arg_bottom_index(first_in)
+       {
+       }
+
+       /// Access a particular argument.
+       as_value& arg(int n) const
+       {
+               assert(n < nargs);
+               return env->bottom(first_arg_bottom_index - n);
+       }
+
+};
+
+/// Signature of a builtin function callable from ActionScript
+typedef void (*as_c_function_ptr)(const fn_call& fn);
+
+
+} // namespace gnash
+
+
+#endif // _GNASH_FN_CALL_H_
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: server/vm/with_stack_entry.h
===================================================================
RCS file: server/vm/with_stack_entry.h
diff -N server/vm/with_stack_entry.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ server/vm/with_stack_entry.h        24 Nov 2006 09:04:25 -0000      1.1
@@ -0,0 +1,83 @@
+// 
+//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// 
+//
+//
+
+#ifndef GNASH_WITH_STACK_ENTRY_H
+#define GNASH_WITH_STACK_ENTRY_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#include "as_object.h" // for dtor visibility by boost::intrusive_ptr
+#include "smart_ptr.h"
+
+namespace gnash {
+
+//
+// with_stack_entry
+//
+
+/// The "with" stack is for Pascal-like with-scoping.
+class with_stack_entry
+{
+public:        
+       // should be private
+       boost::intrusive_ptr<as_object> m_object;
+       
+       with_stack_entry()
+               :
+               m_object(NULL),
+               m_block_end_pc(0)
+       {
+       }
+
+       with_stack_entry(as_object* obj, size_t end)
+               :
+               m_object(obj),
+               m_block_end_pc(end)
+       {
+       }
+
+       size_t end_pc()
+       {
+               return m_block_end_pc;
+       }
+
+       const as_object* object() const
+       {
+               return m_object.get();
+       }
+
+private:
+       size_t m_block_end_pc;
+
+};
+
+}      // end namespace gnash
+
+
+#endif // GNASH_WITH_STACK_ENTRY_H
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:

Index: server/ActionExec.cpp
===================================================================
RCS file: server/ActionExec.cpp
diff -N server/ActionExec.cpp
--- server/ActionExec.cpp       29 Oct 2006 18:34:11 -0000      1.36
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,258 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-//
-
-/* $Id: ActionExec.cpp,v 1.36 2006/10/29 18:34:11 rsavoye Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "ActionExec.h"
-#include "action_buffer.h"
-#include "swf_function.h" 
-#include "log.h"
-//#include "stream.h"
-
-#include "swf.h"
-#include "ASHandlers.h"
-#include "as_environment.h"
-
-#include <typeinfo> 
-
-#if !defined(_WIN32) && !defined(WIN32)
-# include <pthread.h> 
-#endif
-
-#include <sstream>
-#include <string>
-
-#ifndef DEBUG_STACK
-// temporarly disabled as will produce lots of output with -v
-// we'd need another switch maybe, as -va does also produce
-// too much information for my tastes. I really want just
-// to see how stack changes while executing actions...
-// --strk Fri Jun 30 02:28:46 CEST 2006
-#define DEBUG_STACK 1
-#endif
-
-using namespace gnash;
-using namespace SWF;
-using std::string;
-using std::endl;
-using std::stringstream;
-
-
-namespace gnash {
-
-static const SWFHandlers& ash = SWFHandlers::instance();
-
-// External interface (to be moved under swf/ASHandlers)
-fscommand_callback s_fscommand_handler = NULL;
-void   register_fscommand_callback(fscommand_callback handler)
-{
-    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)
-       :
-       with_stack(initial_with_stack),
-       _with_stack_limit(7),
-       _function2_var(nIsFunction2),
-       code(abuf),
-       pc(nStartPC),
-       stop_pc(nStartPC+exec_bytes),
-       next_pc(nStartPC),
-       env(newEnv),
-       retval(retval)
-{
-       GNASH_REPORT_FUNCTION;
-
-       /// See: http://sswf.sourceforge.net/SWFalexref.html#action_with
-       if ( env.get_version() > 5 ) _with_stack_limit = 15;
-}
-
-ActionExec::ActionExec(const action_buffer& abuf, as_environment& newEnv)
-       :
-       with_stack(),
-       _with_stack_limit(7),
-       _function2_var(false),
-       code(abuf),
-       pc(0),
-       stop_pc(code.size()),
-       next_pc(0),
-       env(newEnv),
-       retval(0)
-{
-       GNASH_REPORT_FUNCTION;
-
-       /// See: http://sswf.sourceforge.net/SWFalexref.html#action_with
-       if ( env.get_version() > 5 ) _with_stack_limit = 15;
-}
-
-void
-ActionExec::operator() ()
-{
-    action_init();     // @@ stick this somewhere else; need some global 
static init function
-
-#if 0
-    // Check the time
-    if (periodic_events.expired()) {
-       periodic_events.poll_event_handlers(&env);
-    }
-#endif
-               
-    character* original_target = env.get_target();
-
-#if DEBUG_STACK
-       IF_VERBOSE_ACTION (
-               log_action("at ActionExec operator() start, pc=" SIZET_FMT
-                          ", stop_pc=" SIZET_FMT ", code.size=" SIZET_FMT
-                          ".", pc, 
-                          stop_pc, code.size());
-               stringstream ss;
-               env.dump_stack(ss);
-               env.dump_global_registers(ss);
-               env.dump_local_registers(ss);
-               log_action("%s", ss.str().c_str());
-       );
-#endif
-
-    while (pc<stop_pc)
-    {
-
-       // Cleanup any expired "with" blocks.
-       while ( ! with_stack.empty() && pc >= with_stack.back().end_pc() )
-       {
-               // Drop last stack element
-               with_stack.pop_back();
-       }
-       
-       // Get the opcode.
-       uint8_t action_id = code[pc];
-
-       IF_VERBOSE_ACTION (
-               log_action("\nPC:%d - EX:\t", pc);
-               code.log_disasm(pc);
-       );
-
-       // Set default next_pc offset, control flow action handlers
-       // will be able to reset it. 
-       if ((action_id & 0x80) == 0) {
-               // action with no extra data
-               next_pc = pc+1;
-       } else {
-               // action with extra data
-               int16_t length = code.read_int16(pc+1);
-               assert( length >= 0 );
-               next_pc = pc + length + 3;
-       }
-
-       // Do we still need this ?
-       if ( action_id == SWF::ACTION_END ) {
-               // this would turn into an assertion (next_pc==stop_pc)
-               //              log_msg("At ACTION_END next_pc=%d, stop_pc=%d", 
next_pc, stop_pc);
-               break;
-       }
-
-       ash.execute((action_type)action_id, *this);
-
-#if DEBUG_STACK
-       IF_VERBOSE_ACTION (
-               log_action( " After execution, PC is " SIZET_FMT ".", pc);
-               stringstream ss;
-               env.dump_stack(ss);
-               env.dump_global_registers(ss);
-               env.dump_local_registers(ss);
-               log_action("%s", ss.str().c_str());
-       );
-#endif
-
-       // Control flow actions will change the PC (next_pc)
-       pc = next_pc;
-
-    }
-    
-    env.set_target(original_target);
-}
-
-void
-ActionExec::skip_actions(size_t offset)
-{
-       //pc = next_pc;
-
-       for(size_t i=0; i<offset; ++i)
-       {
-#if 1
-               // we need to check at every iteration because
-               // an action can be longer then a single byte
-               if ( next_pc >= stop_pc )
-               {
-                       log_error("End of DoAction block hit while skipping "
-                               SIZET_FMT " action tags (pc:" SIZET_FMT 
-                               ", stop_pc:" SIZET_FMT ") - Mallformed SWF ?"
-                               "(WaitForFrame, probably)", offset, next_pc,
-                               stop_pc);
-                       next_pc = stop_pc;
-                       return;
-               }
-#endif
-
-               // Get the opcode.
-               uint8_t action_id = code[next_pc];
-
-               // Set default next_pc offset, control flow action handlers
-               // will be able to reset it. 
-               if ((action_id & 0x80) == 0) {
-                       // action with no extra data
-                       next_pc++;
-               } else {
-                       // action with extra data
-                       int16_t length = code.read_int16(next_pc+1);
-                       assert( length >= 0 );
-                       next_pc += length + 3;
-               }
-
-               //pc = next_pc;
-       }
-}
-
-bool
-ActionExec::pushWithEntry(const with_stack_entry& entry)
-{
-       if (with_stack.size() < _with_stack_limit)
-       {
-               with_stack.push_back(entry);
-               return true;
-       }
-       else
-       {
-               return false;
-       }
-}
-
-
-} // end of namespace gnash
-
-
-// Local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:

Index: server/ActionExec.h
===================================================================
RCS file: server/ActionExec.h
diff -N server/ActionExec.h
--- server/ActionExec.h 29 Oct 2006 18:34:11 -0000      1.7
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,163 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-//
-
-#ifndef GNASH_ACTIONEXEC_H
-#define GNASH_ACTIONEXEC_H
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "with_stack_entry.h"
-
-#include <vector>
-
-// Forward declarations
-namespace gnash {
-       class action_buffer;
-       class as_environment;
-       class as_value;
-}
-
-namespace gnash {
-
-/// Executor of an action_buffer 
-class ActionExec {
-
-       /// the 'with' stack associated with this execution thread
-       std::vector<with_stack_entry> with_stack;
-
-       /// Limit of with stack
-       //
-       /// This is 7 for SWF up to 5 and 15 for SWF 6 and up
-       /// See: http://sswf.sourceforge.net/SWFalexref.html#action_with
-       size_t _with_stack_limit;
-
-       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;
-
-       /// Create an execution thread 
-       ActionExec(const action_buffer& abuf, as_environment& newEnv);
-
-       /// 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);
-
-       /// 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;
-       }
-
-       /// Return the maximum allowed 'with' stack limit.
-       //
-       /// See http://sswf.sourceforge.net/SWFalexref.html#action_with
-       /// for more info.
-       ///
-       size_t getWithStackLimit() const 
-       {
-               return _with_stack_limit;
-       }
-
-       /// 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() ();
-               
-};
-
-} // namespace gnash
-
-#endif // GNASH_ACTIONEXEC_H
-
-// Local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:

Index: server/action.cpp
===================================================================
RCS file: server/action.cpp
diff -N server/action.cpp
--- server/action.cpp   21 Nov 2006 00:25:46 -0000      1.109
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,636 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-//
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <typeinfo> 
-
-#if !defined(_WIN32) && !defined(WIN32)
-# include <pthread.h> 
-#endif
-
-#include <string>
-
-#include "action.h"
-#include "as_object.h"
-#include "impl.h"
-#include "log.h"
-//#include "stream.h"
-#include "tu_random.h"
-
-//#include "gstring.h"
-#include "movie_definition.h"
-#include "MovieClipLoader.h"
-#include "as_function.h"
-#include "timers.h"
-#include "textformat.h"
-#include "sound.h"
-#include "array.h"
-#include "types.h"
-#include "sprite_instance.h"
-
-#ifdef HAVE_LIBXML
-#include "xml.h"
-#include "xmlsocket.h"
-#endif
-
-#include "Global.h"
-#include "swf.h"
-//#include "ASHandlers.h"
-#include "URL.h"
-#include "GnashException.h"
-#include "as_environment.h"
-#include "fn_call.h"
-
-using namespace gnash;
-using namespace SWF;
-
-#if defined(_WIN32) || defined(WIN32)
-#define snprintf _snprintf
-#endif // _WIN32
-
-// NOTES:
-//
-// Buttons
-// on (press)                 onPress
-// on (release)               onRelease
-// on (releaseOutside)        onReleaseOutside
-// on (rollOver)              onRollOver
-// on (rollOut)               onRollOut
-// on (dragOver)              onDragOver
-// on (dragOut)               onDragOut
-// on (keyPress"...")         onKeyDown, onKeyUp      <----- IMPORTANT
-//
-// Sprites
-// onClipEvent (load)         onLoad
-// onClipEvent (unload)       onUnload                Hm.
-// onClipEvent (enterFrame)   onEnterFrame
-// onClipEvent (mouseDown)    onMouseDown
-// onClipEvent (mouseUp)      onMouseUp
-// onClipEvent (mouseMove)    onMouseMove
-// onClipEvent (keyDown)      onKeyDown
-// onClipEvent (keyUp)        onKeyUp
-// onClipEvent (data)         onData
-
-// Text fields have event handlers too!
-
-// Sprite built in methods:
-// play()
-// stop()
-// gotoAndStop()
-// gotoAndPlay()
-// nextFrame()
-// startDrag()
-// getURL()
-// getBytesLoaded()
-// getBytesTotal()
-
-// Built-in functions: (do these actually exist in the VM, or are they just 
opcodes?)
-// Number()
-// String()
-
-
-// TODO builtins
-//
-// Number.toString() -- takes an optional arg that specifies the base
-//
-// Boolean() type cast
-//
-// typeof operator --> "number", "string", "boolean", "object" (also
-// for arrays), "null", "movieclip", "function", "undefined"
-//
-// Number.MAX_VALUE, Number.MIN_VALUE
-//
-// String.fromCharCode()
-
-namespace gnash {
-
-//
-// action stuff
-//
-
-void   action_init();
-
-// Statics.
-bool   s_inited = false;
-boost::intrusive_ptr<as_object>        s_global;
-
-void register_component(const tu_stringi& name, as_c_function_ptr handler)
-{
-       action_init();
-       assert(s_global != NULL);
-       s_global->set_member(name, handler);
-}
-
-void
-attach_extern_movie(const char* c_url,
-               const sprite_instance* target,
-               const sprite_instance* root_movie)
-{
-       URL url(c_url);
-
-       movie_definition* md = create_library_movie(url); 
-       if (md == NULL)
-       {
-           log_error("can't create movie_definition for %s\n", 
url.str().c_str());
-           return;
-       }
-
-       gnash::sprite_instance* extern_movie;
-
-       if (target == root_movie)
-       {
-               extern_movie = create_library_movie_inst(md);                   
-               if (extern_movie == NULL)
-               {
-                       log_error("can't create extern root sprite for %s\n", 
url.str().c_str());
-                       return;
-               }
-           set_current_root(extern_movie);
-           sprite_instance* m = extern_movie->get_root_movie();
-
-           m->on_event(event_id::LOAD);
-       }
-       else
-       {
-               extern_movie = md->create_instance();
-               if (extern_movie == NULL)
-               {
-                       log_error("can't create extern sprite for %s\n", 
url.str().c_str());
-                       return;
-               }
-      
-               save_extern_movie(extern_movie);
-      
-               const character* tar = (const character*)target;
-               const char* name = tar->get_name().c_str();
-               uint16_t depth = tar->get_depth();
-               bool use_cxform = false;
-               cxform color_transform =  tar->get_cxform();
-               bool use_matrix = false;
-               matrix mat = tar->get_matrix();
-               float ratio = tar->get_ratio();
-               uint16_t clip_depth = tar->get_clip_depth();
-
-               character* parent = tar->get_parent();
-               sprite_instance* newsprite = extern_movie->get_root_movie();
-
-               assert(parent);
-               assert(newsprite);
-
-               newsprite->set_parent(parent);
-
-               sprite_instance* parent_sprite = parent->to_movie();
-               assert(parent_sprite);
-       
-           parent_sprite->replace_display_object(
-               newsprite,
-               name,
-               depth,
-               use_cxform,
-               color_transform,
-               use_matrix,
-               mat,
-               ratio,
-               clip_depth);
-       }
-}
-
-//
-// Function/method dispatch.
-//
-
-as_value
-call_method(
-    const as_value& method,
-    as_environment* env,
-    as_object* this_ptr, // this is ourself
-    int nargs,
-    int first_arg_bottom_index)
-    // first_arg_bottom_index is the stack index, from the bottom,
-    // of the first argument.
-    // Subsequent arguments are at *lower* indices. 
-    // E.g. if first_arg_bottom_index = 7, then arg1 is at env->bottom(7),
-    // arg2 is at env->bottom(6), etc.
-{
-       as_value val;
-       fn_call call(&val, this_ptr, env, nargs, first_arg_bottom_index);
-
-       if ( as_c_function_ptr func = method.to_c_function() )
-       {
-           // It's a C function.  Call it.
-           (*func)(call);
-       }
-       else if ( as_function* as_func = method.to_as_function() )
-       {
-           // It's an ActionScript function.  Call it.
-           (*as_func)(call);
-       }
-       else
-       {
-                       IF_VERBOSE_ASCODING_ERRORS(
-               log_warning(
-                       "error in call_method(): "
-                       "'%s' is neither a C nor an ActionScript function\n",
-                       method.to_string());
-                       );
-       }
-
-       return val;
-}
-
-
-as_value       call_method0(
-    const as_value& method,
-    as_environment* env,
-    as_object* this_ptr)
-{
-    return call_method(method, env, this_ptr, 0, env->get_top_index() + 1);
-}
-               
-const char*    call_method_parsed(
-    as_environment* env,
-    as_object* this_ptr,
-    const char* method_name,
-    const char* method_arg_fmt,
-    va_list args)
-    // Printf-like vararg interface for calling ActionScript.
-    // Handy for external binding.
-{
-    log_msg("FIXME(%d): %s\n", __LINE__, __FUNCTION__);
-
-#if 0
-    static const int   BUFSIZE = 1000;
-    char       buffer[BUFSIZE];
-    std::vector<const char*>   tokens;
-
-    // Brutal crap parsing.  Basically null out any
-    // delimiter characters, so that the method name and
-    // args sit in the buffer as null-terminated C
-    // strings.  Leave an intial ' character as the first
-    // char in a string argument.
-    // Don't verify parens or matching quotes or anything.
-    {
-       strncpy(buffer, method_call, BUFSIZE);
-       buffer[BUFSIZE - 1] = '\0';
-       char*   p = buffer;
-
-       char    in_quote = 0;
-       bool    in_arg = false;
-       for (;; p++)
-           {
-               char    c = *p;
-               if (c == 0)
-                   {
-                       // End of string.
-                       break;
-                   }
-               else if (c == in_quote)
-                   {
-                       // End of quotation.
-                       assert(in_arg);
-                       *p = 0;
-                       in_quote = 0;
-                       in_arg = false;
-                   }
-               else if (in_arg)
-                   {
-                       if (in_quote == 0)
-                           {
-                               if (c == ')' || c == '(' || c == ',' || c == ' 
')
-                                   {
-                                       // End of arg.
-                                       *p = 0;
-                                       in_arg = false;
-                                   }
-                           }
-                   }
-               else
-                   {
-                       // Not in arg.  Watch for start of arg.
-                       assert(in_quote == 0);
-                       if (c == '\'' || c == '\"')
-                           {
-                               // Start of quote.
-                               in_quote = c;
-                               in_arg = true;
-                               *p = '\'';      // ' at the start of the arg, 
so later we know this is a string.
-                               tokens.push_back(p);
-                           }
-                       else if (c == ' ' || c == ',')
-                           {
-                               // Non-arg junk, null it out.
-                               *p = 0;
-                           }
-                       else
-                           {
-                               // Must be the start of a numeric arg.
-                               in_arg = true;
-                               tokens.push_back(p);
-                           }
-                   }
-           }
-    }
-#endif // 0
-
-
-    // Parse va_list args
-    int        starting_index = env->get_top_index();
-    const char* p = method_arg_fmt;
-    for (;; p++)
-       {
-           char        c = *p;
-           if (c == 0)
-               {
-                   // End of args.
-                   break;
-               }
-           else if (c == '%')
-               {
-                   p++;
-                   c = *p;
-                   // Here's an arg.
-                   if (c == 'd')
-                       {
-                           // Integer.
-                           env->push(va_arg(args, int));
-                       }
-                   else if (c == 'f')
-                       {
-                           // Double
-                           env->push(va_arg(args, double));
-                       }
-                   else if (c == 's')
-                       {
-                           // String
-                           env->push(va_arg(args, const char *));
-                       }
-                   else if (c == 'l')
-                       {
-                           p++;
-                           c = *p;
-                           if (c == 's')
-                               {
-                                   // Wide string.
-                                   env->push(va_arg(args, const wchar_t *));
-                               }
-                           else
-                               {
-                                   log_error("call_method_parsed('%s','%s') -- 
invalid fmt '%%l%c'\n",
-                                             method_name,
-                                             method_arg_fmt,
-                                             c);
-                               }
-                       }
-                   else
-                       {
-                           // Invalid fmt, warn.
-                           log_error("call_method_parsed('%s','%s') -- invalid 
fmt '%%%c'\n",
-                                     method_name,
-                                     method_arg_fmt,
-                                     c);
-                       }
-               }
-           else
-               {
-                   // Ignore whitespace and commas.
-                   if (c == ' ' || c == '\t' || c == ',')
-                       {
-                           // OK
-                       }
-                   else
-                       {
-                           // Invalid arg; warn.
-                           log_error("call_method_parsed('%s','%s') -- invalid 
char '%c'\n",
-                                     method_name,
-                                     method_arg_fmt,
-                                     c);
-                       }
-               }
-       }
-
-    as_value   method = env->get_variable(method_name);
-
-    // check method
-
-    // Reverse the order of pushed args
-    int        nargs = env->get_top_index() - starting_index;
-    for (int i = 0; i < (nargs >> 1); i++)
-       {
-           int i0 = starting_index + 1 + i;
-           int i1 = starting_index + nargs - i;
-           assert(i0 < i1);
-
-           swap(&(env->bottom(i0)), &(env->bottom(i1)));
-       }
-
-    // Do the call.
-    as_value   result = call_method(method, env, this_ptr, nargs, 
env->get_top_index());
-    env->drop(nargs);
-
-    // Return pointer to static string for return value.
-    static tu_string   s_retval;
-    s_retval = result.to_tu_string();
-    return s_retval.c_str();
-}
-
-void
-movie_load()
-{
-    log_action("-- start movie");
-}
-
-//
-// Built-in objects
-//
-
-
-void
-event_test(const fn_call& /*fn*/)
-{
-    log_msg("FIXME: %s\n", __FUNCTION__);
-}
-       
-
-//
-// global init
-//
-
-
-
-void
-action_init()
-    // Create/hook built-ins.
-{
-    if (s_inited == false) {
-       s_inited = true;
-       
-       // @@ s_global should really be a
-       // client-visible player object, which
-       // contains one or more actual movie
-       // instances.  We're currently just hacking it
-       // in as an app-global mutable object :(
-       assert(s_global == NULL);
-       s_global = new gnash::Global();
-    }
-}
-
-
-void
-action_clear()
-{
-    if (s_inited) {
-       s_inited = false;
-       
-       s_global->clear();
-       s_global = NULL;
-    }
-}
-
-//
-// event_id
-//
-
-const tu_string&
-event_id::get_function_name() const
-{
-    static tu_string   s_function_names[EVENT_COUNT] =
-       {
-           "INVALID",           // INVALID
-           "onPress",           // PRESS
-           "onRelease",                 // RELEASE
-           "onRelease_Outside",         // RELEASE_OUTSIDE
-           "onRoll_Over",               // ROLL_OVER
-           "onRoll_Out",                // ROLL_OUT
-           "onDrag_Over",               // DRAG_OVER
-           "onDrag_Out",                // DRAG_OUT
-           "onKeyPress",                // KEY_PRESS
-           "onInitialize",              // INITIALIZE
-
-           "onLoad",            // LOAD
-           "onUnload",          // UNLOAD
-           "onEnterFrame",              // ENTER_FRAME
-           "onMouseDown",               // MOUSE_DOWN
-           "onMouseUp",                 // MOUSE_UP
-           "onMouseMove",               // MOUSE_MOVE
-           "onKeyDown",                 // KEY_DOWN
-           "onKeyUp",           // KEY_UP
-           "onData",            // DATA
-           // These are for the MoveClipLoader ActionScript only
-           "onLoadStart",               // LOAD_START
-           "onLoadError",               // LOAD_ERROR
-           "onLoadProgress",    // LOAD_PROGRESS
-           "onLoadInit",                // LOAD_INIT
-           // These are for the XMLSocket ActionScript only
-           "onSockClose",               // CLOSE
-           "onSockConnect",     // CONNECT
-           "onSockData",                // Data
-           "onSockXML",                 // XML
-           // These are for the XML ActionScript only
-           "onXMLLoad",                 // XML_LOAD
-           "onXMLData",                 // XML_DATA
-           "onTimer",           // setInterval Timer expired
-
-           "onConstruct",
-                       "onSetFocus",
-                       "onKillFocus"
-       };
-
-    assert(m_id > INVALID && m_id < EVENT_COUNT);
-    return s_function_names[m_id];
-}
-
-bool
-event_id::is_mouse_event() const
-{
-       switch (m_id)
-       {
-               case event_id::KEY_PRESS :
-               case event_id::PRESS:
-               case event_id::RELEASE:
-               case event_id::RELEASE_OUTSIDE:
-               case event_id::MOUSE_UP:
-               case event_id::MOUSE_DOWN:
-               case event_id::ROLL_OVER:
-               case event_id::ROLL_OUT:
-               case event_id::DRAG_OVER:
-               case event_id::DRAG_OUT:
-                       return true;
-               default:
-                       return false;
-       }
-}
-
-// Standard member lookup.
-as_standard_member
-get_standard_member(const tu_stringi& name)
-{
-    static bool        s_inited = false;
-    static stringi_hash<as_standard_member>    s_standard_member_map;
-    if (!s_inited) {
-       s_inited = true;
-       
-       s_standard_member_map.resize(int(AS_STANDARD_MEMBER_COUNT));
-       
-       s_standard_member_map.add("_x", M_X);
-       s_standard_member_map.add("_y", M_Y);
-       s_standard_member_map.add("_xscale", M_XSCALE);
-       s_standard_member_map.add("_yscale", M_YSCALE);
-       s_standard_member_map.add("_currentframe", M_CURRENTFRAME);
-       s_standard_member_map.add("_totalframes", M_TOTALFRAMES);
-       s_standard_member_map.add("_alpha", M_ALPHA);
-       s_standard_member_map.add("_visible", M_VISIBLE);
-       s_standard_member_map.add("_width", M_WIDTH);
-       s_standard_member_map.add("_height", M_HEIGHT);
-       s_standard_member_map.add("_rotation", M_ROTATION);
-       s_standard_member_map.add("_target", M_TARGET);
-       s_standard_member_map.add("_framesloaded", M_FRAMESLOADED);
-       s_standard_member_map.add("_name", M_NAME);
-       s_standard_member_map.add("_droptarget", M_DROPTARGET);
-       s_standard_member_map.add("_url", M_URL);
-       s_standard_member_map.add("_highquality", M_HIGHQUALITY);
-       s_standard_member_map.add("_focusrect", M_FOCUSRECT);
-       s_standard_member_map.add("_soundbuftime", M_SOUNDBUFTIME);
-       s_standard_member_map.add("_xmouse", M_XMOUSE);
-       s_standard_member_map.add("_ymouse", M_YMOUSE);
-       s_standard_member_map.add("_parent", M_PARENT);
-       s_standard_member_map.add("text", M_TEXT);
-       s_standard_member_map.add("textWidth", M_TEXTWIDTH);
-       s_standard_member_map.add("textColor", M_TEXTCOLOR);
-       s_standard_member_map.add("onLoad", M_ONLOAD);
-       s_standard_member_map.add("onRollOver", M_ONROLLOVER);
-       s_standard_member_map.add("onRollOut", M_ONROLLOUT);
-    }
-    
-    as_standard_member result = M_INVALID_MEMBER;
-    s_standard_member_map.get(name, &result);
-    
-    return result;
-}
-
-
-
-}
-
-
-// Local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:

Index: server/action.h
===================================================================
RCS file: server/action.h
diff -N server/action.h
--- server/action.h     21 Nov 2006 00:25:46 -0000      1.50
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,162 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-// 
-//
-//
-
-// Implementation and helpers for SWF actions.
-
-
-#ifndef GNASH_ACTION_H
-#define GNASH_ACTION_H
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "tu_config.h"
-
-#include "gnash.h"
-#include "as_object.h"
-#include "types.h"
-#include "container.h"
-#include "smart_ptr.h"
-
-#include <cwchar>
-
-
-namespace gnash {
-       class sprite_instance;
-       class as_environment;
-       class as_object;
-       class as_value;
-       class swf_function;
-
-
-       extern DSOEXPORT boost::intrusive_ptr<as_object> s_global;
-
-       class DSOLOCAL as_property_interface
-       {
-       public:
-               virtual ~as_property_interface() {}
-               virtual bool    set_property(int index, const as_value& val) = 
0;
-       };
-
-       //
-       // Some handy helpers
-       //
-
-       /// Create/hook built-ins.
-       DSOEXPORT void  action_init();
-
-       // Clean up any stray heap stuff we've allocated.
-       void    action_clear();
-
-       // Dispatching methods from C++.
-       as_value        call_method0(const as_value& method, as_environment* 
env, as_object* this_ptr);
-       as_value        call_method1(
-               const as_value& method, as_environment* env, as_object* 
this_ptr,
-               const as_value& arg0);
-       as_value        call_method2(
-               const as_value& method, as_environment* env, as_object* 
this_ptr,
-               const as_value& arg0, const as_value& arg1);
-       as_value        call_method3(
-               const as_value& method, as_environment* env, as_object* 
this_ptr,
-               const as_value& arg0, const as_value& arg1, const as_value& 
arg2);
-
-       /// Call a method, be it an as_function or a c_function. 
-       //
-       /// This is a thin wrapper around operator() and fn_call,
-       /// probably worth dropping.
-       ///
-       /// first_arg_bottom_index is the stack index, from the bottom,
-       /// of the first argument.  Subsequent arguments are at *lower*
-       /// indices.  E.g. if first_arg_bottom_index = 7, then arg1 is
-       /// at env->bottom(7), arg2 is at env->bottom(6), etc.
-       ///
-       DSOEXPORT as_value call_method(const as_value& method, as_environment* 
env,
-               as_object* this_ptr, // this is ourself
-               int nargs, int first_arg_bottom_index);
-
-       const char*     call_method_parsed(
-               as_environment* env,
-               as_object* this_ptr,
-               const char* method_name,
-               const char* method_arg_fmt,
-               va_list args);
-
-       // tulrich: don't use this!  To register a class constructor,
-       // just assign the classname to the constructor function.  E.g.:
-       //
-       // my_movie->set_member("MyClass", 
as_value(MyClassConstructorFunction));
-       // 
-       //void register_as_object(const char* object_name, as_c_function_ptr 
handler);
-
-       /// Numerical indices for standard member names.  Can use this
-       /// to help speed up get/set member calls, by using a switch()
-       /// instead of nasty string compares.
-       enum as_standard_member
-       {
-               M_INVALID_MEMBER = -1,
-               M_X,
-               M_Y,
-               M_XSCALE,
-               M_YSCALE,
-               M_CURRENTFRAME,
-               M_TOTALFRAMES,
-               M_ALPHA,
-               M_VISIBLE,
-               M_WIDTH,
-               M_HEIGHT,
-               M_ROTATION,
-               M_TARGET,
-               M_FRAMESLOADED,
-               M_NAME,
-               M_DROPTARGET,
-               M_URL,
-               M_HIGHQUALITY,
-               M_FOCUSRECT,
-               M_SOUNDBUFTIME,
-               M_XMOUSE,
-               M_YMOUSE,
-               M_PARENT,
-               M_TEXT,
-               M_TEXTWIDTH,
-               M_TEXTCOLOR,
-               M_ONLOAD,
-               M_ONROLLOVER,
-               M_ONROLLOUT,
-
-               AS_STANDARD_MEMBER_COUNT
-       };
-
-       /// Return the standard enum, if the arg names a standard member.
-       /// Returns M_INVALID_MEMBER if there's no match.
-       as_standard_member      get_standard_member(const tu_stringi& name);
-
-       void attach_extern_movie(const char* c_url, const sprite_instance* 
target, const sprite_instance* root_movie);
-
-}      // end namespace gnash
-
-
-#endif // GNASH_ACTION_H
-
-
-// Local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:

Index: server/fn_call.h
===================================================================
RCS file: server/fn_call.h
diff -N server/fn_call.h
--- server/fn_call.h    29 Oct 2006 18:34:11 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,85 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-// 
-//
-//
-
-#ifndef _GNASH_FN_CALL_H_
-#define _GNASH_FN_CALL_H_
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "as_environment.h" // for inlines (arg)
-
-#include <cassert> // for inlines (arg)
-
-namespace gnash {
-
-// Forward declarations
-class as_environment;
-class as_object;
-class as_value;
-
-/// \brief
-/// Parameters/environment for builtin or user-defined functions
-/// callable from ActionScript.
-class fn_call
-{
-public:
-       as_value* result;
-       as_object* this_ptr;
-       as_environment* env;
-       int nargs;
-       int first_arg_bottom_index;
-
-       fn_call(as_value* res_in, as_object* this_in,
-                       as_environment* env_in,
-                       int nargs_in, int first_in)
-               :
-               result(res_in),
-               this_ptr(this_in),
-               env(env_in),
-               nargs(nargs_in),
-               first_arg_bottom_index(first_in)
-       {
-       }
-
-       /// Access a particular argument.
-       as_value& arg(int n) const
-       {
-               assert(n < nargs);
-               return env->bottom(first_arg_bottom_index - n);
-       }
-
-};
-
-/// Signature of a builtin function callable from ActionScript
-typedef void (*as_c_function_ptr)(const fn_call& fn);
-
-
-} // namespace gnash
-
-
-#endif // _GNASH_FN_CALL_H_
-
-
-// Local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:

Index: server/with_stack_entry.h
===================================================================
RCS file: server/with_stack_entry.h
diff -N server/with_stack_entry.h
--- server/with_stack_entry.h   11 Nov 2006 22:44:54 -0000      1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,83 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-// 
-//
-//
-
-#ifndef GNASH_WITH_STACK_ENTRY_H
-#define GNASH_WITH_STACK_ENTRY_H
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-
-#include "as_object.h" // for dtor visibility by boost::intrusive_ptr
-#include "smart_ptr.h"
-
-namespace gnash {
-
-//
-// with_stack_entry
-//
-
-/// The "with" stack is for Pascal-like with-scoping.
-class with_stack_entry
-{
-public:        
-       // should be private
-       boost::intrusive_ptr<as_object> m_object;
-       
-       with_stack_entry()
-               :
-               m_object(NULL),
-               m_block_end_pc(0)
-       {
-       }
-
-       with_stack_entry(as_object* obj, size_t end)
-               :
-               m_object(obj),
-               m_block_end_pc(end)
-       {
-       }
-
-       size_t end_pc()
-       {
-               return m_block_end_pc;
-       }
-
-       const as_object* object() const
-       {
-               return m_object.get();
-       }
-
-private:
-       size_t m_block_end_pc;
-
-};
-
-}      // end namespace gnash
-
-
-#endif // GNASH_WITH_STACK_ENTRY_H
-
-
-// Local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:

Index: server/swf/ASHandlers.cpp
===================================================================
RCS file: server/swf/ASHandlers.cpp
diff -N server/swf/ASHandlers.cpp
--- server/swf/ASHandlers.cpp   21 Nov 2006 00:25:47 -0000      1.98
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,3150 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-//
-
-/* $Id: ASHandlers.cpp,v 1.98 2006/11/21 00:25:47 strk Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "log.h"
-#include "swf.h"
-#include "rc.h"
-#include "ASHandlers.h"
-#include "movie_definition.h"
-#include "array.h"
-#include "swf_function.h"
-#include "as_function.h"
-#include "tu_random.h"
-#include "fn_call.h"
-#include "ActionExec.h"
-#include "sprite_instance.h"
-#include "as_environment.h"
-#include "URL.h"
-#include "URLAccessManager.h" // for GetUrl actions
-#include "action_buffer.h"
-#include "as_object.h"
-#include "Object.h"
-#include "gstring.h" // for automatic as_value::STRING => String as object
-#include "Number.h" // for automatic as_value::NUMBER => Number as object
-
-#include <string>
-#include <map>
-#include <set>
-#include <vector>
-
-using namespace std;
-
-namespace {
-gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
-}
-
-// Define this to have WaitForFrame actions really
-// wait for target frame (and never skip actions)
-// See:
-//  http://sswf.sourceforge.net/SWFalexref.html#action_wait_for_frame
-//
-#undef REALLY_WAIT_ON_WAIT_FOR_FRAME
-
-// Forward declarations
-namespace gnash {
-       extern fscommand_callback s_fscommand_handler;
-}
-
-namespace gnash {
-
-namespace SWF { // gnash::SWF
-
-// Utility.  Try to convert str to a number.  If successful,
-// put the result in *result, and return true.  If not
-// successful, put 0 in *result, and return false.
-static bool string_to_number(double* result, const char* str)
-{
-    char* tail = 0;
-    *result = strtod(str, &tail);
-    if (tail == str || *tail != 0)
-       {
-           // Failed conversion to Number.
-           return false;
-       }
-    return true;
-}
-
-// 
-// Utility: construct an object using given constructor.
-// This is used by both ActionNew and ActionNewMethod and
-// hides differences between builtin and actionscript-defined
-// constructors.
-//
-static as_value
-construct_object(const as_value& constructor,
-       as_environment& env, unsigned int nargs,
-       unsigned int first_arg_index)
-{
-
-    as_value new_obj;
-
-    if (constructor.get_type() == as_value::C_FUNCTION)
-    {
-               IF_VERBOSE_ACTION (
-        log_action("Constructor is a C_FUNCTION");
-               );
-
-        // C function is responsible for creating the new object and setting 
members.
-        fn_call call(&new_obj, NULL, &env, nargs, first_arg_index);
-
-        (constructor.to_c_function())(call);
-    }
-
-    else if (as_function* ctor_as_func = constructor.to_as_function())
-    {
-        // This function is being used as a constructor; make sure
-        // it has a prototype object.
-               IF_VERBOSE_ACTION (
-        log_action("Constructor is an AS_FUNCTION");
-               );
-        
-        // a built-in class takes care of assigning a prototype
-       // TODO: change this
-        if ( ctor_as_func->isBuiltin() )
-       {
-
-               IF_VERBOSE_ACTION (
-            log_action("it's a built-in class");
-               );
-
-            fn_call call(&new_obj, NULL, &env, nargs, first_arg_index);
-            (*ctor_as_func)(call);
-        }
-       else
-       {
-            // Set up the prototype.
-            as_value   proto;
-            bool func_has_prototype = ctor_as_func->get_member("prototype", 
&proto);
-            assert(func_has_prototype);
-            
-               IF_VERBOSE_ACTION (
-            log_action("constructor prototype is %s", proto.to_string());
-               );
-            
-            // Create an empty object, with a ref to the constructor's 
prototype.
-            boost::intrusive_ptr<as_object> new_obj_ptr(new 
as_object(proto.to_object()));
-            
-            new_obj.set_as_object(new_obj_ptr.get());
-            
-            // Call the actual constructor function; new_obj is its 'this'.
-            // We don't need the function result.
-            call_method(constructor, &env, new_obj_ptr.get(), nargs, 
first_arg_index);
-        }
-    }
-//     Vitaly: no actionscript operation should lead to crash player, 
including "x=new MyClass();".
-//    else
-//    {
-//     assert(0);
-//    }
-
-    return new_obj;
-}
-
-
-static void unsupported_action_handler(ActionExec& thread)
-{
-       log_error("Unsupported action handler invoked, code at pc is %d", 
thread.code[thread.pc]);
-}
-
-ActionHandler::ActionHandler()
-       :
-       _name("unsupported"),
-       _callback(unsupported_action_handler),
-       _debug(false),
-       _stack_args(0),
-       _arg_format(ARG_NONE)
-{
-//    GNASH_REPORT_FUNCTION;    
-}
-
-ActionHandler::ActionHandler(action_type type, action_callback_t func)
-       :
-       _type(type),
-       _callback(func),
-       _debug(false),
-       _stack_args(0),
-       _arg_format(ARG_NONE)
-{
-//     GNASH_REPORT_FUNCTION;
-}
-
-ActionHandler::ActionHandler(action_type type, string name,
-                             action_callback_t func)
-       :
-       _type(type),
-       _name(name),
-       _callback(func),
-       _debug(false),
-       _stack_args(0),
-       _arg_format(ARG_NONE)
-{
-//     GNASH_REPORT_FUNCTION;
-}
-
-ActionHandler::ActionHandler(action_type type, string name,
-                             action_callback_t func, as_arg_t format)
-    : _debug(false), _stack_args(0)
-{
-//    GNASH_REPORT_FUNCTION;
-    _name = name;
-    _type = type;
-    _callback = func;
-    _arg_format = format;
-}
-
-ActionHandler::ActionHandler(action_type type, string name,
-                             action_callback_t func, as_arg_t format, int 
nargs)
-    : _debug(false)
-{
-//    GNASH_REPORT_FUNCTION;
-    _name = name;
-    _type = type;
-    _callback = func;
-    _stack_args = nargs;
-    _arg_format = format;
-}
-
-ActionHandler::~ActionHandler()
-{
-//    GNASH_REPORT_FUNCTION;
-}
-
-void
-ActionHandler::execute(ActionExec& thread) const
-{
-//    GNASH_REPORT_FUNCTION;
-    return _callback(thread);
-}
-
-SWFHandlers::SWFHandlers()
-{
-//    GNASH_REPORT_FUNCTION;
-
-    std::vector<std::string> & property_names = get_property_names();
-
-    property_names.reserve(32);
-    property_names.push_back("_x");
-    property_names.push_back("_y");
-    property_names.push_back("_xscale");
-    property_names.push_back("_yscale");
-    property_names.push_back("_currentframe");
-    property_names.push_back("_totalframes");
-    property_names.push_back("_alpha");
-    property_names.push_back("_visible");
-    property_names.push_back("_width");
-    property_names.push_back("_height");
-    property_names.push_back("_rotation");
-    property_names.push_back("_target");
-    property_names.push_back("_framesloaded");
-    property_names.push_back("_name");
-    property_names.push_back("_droptarget");
-    property_names.push_back("_url");
-    property_names.push_back("_highquality");
-    property_names.push_back("_focusrect");
-    property_names.push_back("_soundbuftime");
-    property_names.push_back("@@ mystery quality member");
-    property_names.push_back("_xmouse");
-    property_names.push_back("_ymouse");
-
-    container_type & handlers = get_handlers();
-    handlers[ACTION_END] = ActionHandler(ACTION_END,
-             string("<End>"), SWFHandlers::ActionEnd);
-    handlers[ACTION_NEXTFRAME] = ActionHandler(ACTION_NEXTFRAME,
-             string("NextFrame"), SWFHandlers::ActionNextFrame);
-    handlers[ACTION_PREVFRAME] =  ActionHandler(ACTION_PREVFRAME,
-             string("PreviousFrame"), SWFHandlers::ActionPrevFrame);
-    handlers[ACTION_PLAY] = ActionHandler(ACTION_PLAY,
-             string("Play"), SWFHandlers::ActionPlay);
-    handlers[ACTION_STOP] = ActionHandler(ACTION_STOP,
-             string("Stop"), SWFHandlers::ActionStop);
-    handlers[ACTION_TOGGLEQUALITY] = ActionHandler(ACTION_TOGGLEQUALITY,
-             string("ToggleQuality"), SWFHandlers::ActionToggleQuality);
-    handlers[ACTION_STOPSOUNDS] = ActionHandler(ACTION_STOPSOUNDS,
-             string("StopSounds"), SWFHandlers::ActionStopSounds);
-    handlers[ACTION_GOTOFRAME] = ActionHandler(ACTION_GOTOFRAME,
-             string("GotoFrame"), SWFHandlers::ActionGotoFrame, ARG_U16);
-    handlers[ACTION_GETURL] = ActionHandler(ACTION_GETURL,
-             string("GetUrl"), SWFHandlers::ActionGetUrl, ARG_STR);
-    handlers[ACTION_WAITFORFRAME] = ActionHandler(ACTION_WAITFORFRAME,
-             string("WaitForFrame"), SWFHandlers::ActionWaitForFrame, ARG_HEX);
-    handlers[ACTION_SETTARGET] = ActionHandler(ACTION_SETTARGET,
-             string("SetTarget"), SWFHandlers::ActionSetTarget, ARG_STR);
-    handlers[ACTION_GOTOLABEL] = ActionHandler(ACTION_GOTOLABEL,
-             string("GotoLabel"), SWFHandlers::ActionGotoLabel, ARG_STR);
-    handlers[ACTION_ADD] = ActionHandler(ACTION_ADD,
-             string("Add"), SWFHandlers::ActionAdd);
-    handlers[ACTION_SUBTRACT] = ActionHandler(ACTION_SUBTRACT,
-             string("Subtract"), SWFHandlers::ActionSubtract);
-    handlers[ACTION_MULTIPLY] = ActionHandler(ACTION_MULTIPLY,
-             string("Multiply"), SWFHandlers::ActionMultiply);
-    handlers[ACTION_DIVIDE] = ActionHandler(ACTION_DIVIDE,
-             string("Divide"), SWFHandlers::ActionDivide);
-    handlers[ACTION_EQUAL] = ActionHandler(ACTION_EQUAL,
-             string("Equal"), SWFHandlers::ActionEqual);
-    handlers[ACTION_LESSTHAN] = ActionHandler(ACTION_LESSTHAN,
-             string("LessThan"), SWFHandlers::ActionLessThan);
-    handlers[ACTION_LOGICALAND] = ActionHandler(ACTION_LOGICALAND,
-             string("LogicalAnd"), SWFHandlers::ActionLogicalAnd);
-    handlers[ACTION_LOGICALOR] = ActionHandler(ACTION_LOGICALOR,
-             string("LogicalOr"), SWFHandlers::ActionLogicalOr);
-    handlers[ACTION_LOGICALNOT] = ActionHandler(ACTION_LOGICALNOT,
-             string("LogicalNot"), SWFHandlers::ActionLogicalNot);
-    handlers[ACTION_STRINGEQ] = ActionHandler(ACTION_STRINGEQ,
-             string("StringEq"), SWFHandlers::ActionStringEq);    
-    handlers[ACTION_STRINGLENGTH] = ActionHandler(ACTION_STRINGLENGTH,
-             string("ActionStringLength"), SWFHandlers::ActionStringLength);
-    handlers[ACTION_SUBSTRING] = ActionHandler(ACTION_SUBSTRING,
-             string("ActionSubString"), SWFHandlers::ActionSubString);
-    handlers[ACTION_POP] = ActionHandler(ACTION_POP,
-             string("ActionPop"), SWFHandlers::ActionPop);
-    handlers[ACTION_INT] = ActionHandler(ACTION_INT,
-             string("ActionInt"), SWFHandlers::ActionInt);
-    handlers[ACTION_GETVARIABLE] = ActionHandler(ACTION_GETVARIABLE,
-             string("ActionGetVariable"), SWFHandlers::ActionGetVariable);
-    handlers[ACTION_SETVARIABLE] = ActionHandler(ACTION_SETVARIABLE,
-             string("ActionSetVariable"), SWFHandlers::ActionSetVariable);
-    handlers[ACTION_SETTARGETEXPRESSION] = 
ActionHandler(ACTION_SETTARGETEXPRESSION,
-             string("ActionSetTargetExpression"), 
SWFHandlers::ActionSetTargetExpression);
-    handlers[ACTION_STRINGCONCAT] = ActionHandler(ACTION_STRINGCONCAT,
-             string("ActionStringConcat"), SWFHandlers::ActionStringConcat);
-    handlers[ACTION_GETPROPERTY] = ActionHandler(ACTION_GETPROPERTY,
-             string("ActionGetProperty"), SWFHandlers::ActionGetProperty);
-    handlers[ACTION_SETPROPERTY] = ActionHandler(ACTION_SETPROPERTY,
-             string("ActionSetpProperty"), SWFHandlers::ActionSetProperty);
-    handlers[ACTION_DUPLICATECLIP] = ActionHandler(ACTION_DUPLICATECLIP,
-             string("ActionDuplicateClip"), SWFHandlers::ActionDuplicateClip);
-    handlers[ACTION_REMOVECLIP] = ActionHandler(ACTION_REMOVECLIP,
-             string("ActionRemoveClip"), SWFHandlers::ActionRemoveClip);
-    handlers[ACTION_TRACE] = ActionHandler(ACTION_TRACE,
-             string("ActionTrace"), SWFHandlers::ActionTrace);
-    handlers[ACTION_STARTDRAGMOVIE] = ActionHandler(ACTION_STARTDRAGMOVIE,
-             string("ActionStartDragMovie"), 
SWFHandlers::ActionStartDragMovie);
-    handlers[ACTION_STOPDRAGMOVIE] = ActionHandler(ACTION_STOPDRAGMOVIE,
-             string("ActionStopDragMovie"), SWFHandlers::ActionStopDragMovie);
-    handlers[ACTION_STRINGCOMPARE] = ActionHandler(ACTION_STRINGCOMPARE,
-             string("ActionStringCompare"), SWFHandlers::ActionStringCompare);
-    handlers[ACTION_THROW] = ActionHandler(ACTION_THROW,
-             string("ActionThrow"), SWFHandlers::ActionThrow);
-    handlers[ACTION_CASTOP] = ActionHandler(ACTION_CASTOP,
-             string("ActionCastOp"), SWFHandlers::ActionCastOp);
-    handlers[ACTION_IMPLEMENTSOP] = ActionHandler(ACTION_IMPLEMENTSOP,
-             string("ActionImplementsOp"), SWFHandlers::ActionImplementsOp);
-    handlers[ACTION_RANDOM] = ActionHandler(ACTION_RANDOM,
-             string("ActionRandom"), SWFHandlers::ActionRandom);
-    handlers[ACTION_MBLENGTH] = ActionHandler(ACTION_MBLENGTH,
-             string("ActionMbLength"), SWFHandlers::ActionMbLength);
-    handlers[ACTION_ORD] = ActionHandler(ACTION_ORD,
-             string("ActionOrd"), SWFHandlers::ActionOrd);
-    handlers[ACTION_CHR] = ActionHandler(ACTION_CHR,
-             string("ActionChr"), SWFHandlers::ActionChr);
-    handlers[ACTION_GETTIMER] = ActionHandler(ACTION_GETTIMER,
-             string("ActionGetTimer"), SWFHandlers::ActionGetTimer);
-    handlers[ACTION_MBSUBSTRING] = ActionHandler(ACTION_MBSUBSTRING,
-             string("ActionMbSubString"), SWFHandlers::ActionMbSubString);
-    handlers[ACTION_MBORD] = ActionHandler(ACTION_MBORD,
-             string("ActionMbOrd"), SWFHandlers::ActionMbOrd);
-    handlers[ACTION_MBCHR] = ActionHandler(ACTION_MBCHR,
-             string("ActionMbChr"), SWFHandlers::ActionMbChr);
-    handlers[ACTION_WAITFORFRAMEEXPRESSION] = 
ActionHandler(ACTION_WAITFORFRAMEEXPRESSION,
-             string("ActionWaitForFrameExpression"),
-             SWFHandlers::ActionWaitForFrameExpression, ARG_HEX);
-    handlers[ACTION_PUSHDATA] = ActionHandler(ACTION_PUSHDATA,
-             string("ActionPushData"), SWFHandlers::ActionPushData, 
ARG_PUSH_DATA);
-    handlers[ACTION_BRANCHALWAYS] = ActionHandler(ACTION_BRANCHALWAYS,
-             string("ActionBranchAlways"), SWFHandlers::ActionBranchAlways, 
ARG_S16);
-    handlers[ACTION_GETURL2] = ActionHandler(ACTION_GETURL2,
-             string("ActionGetUrl2"), SWFHandlers::ActionGetUrl2, ARG_HEX);
-    handlers[ACTION_BRANCHIFTRUE] = ActionHandler(ACTION_BRANCHIFTRUE,
-             string("ActionBranchIfTrue"), SWFHandlers::ActionBranchIfTrue, 
ARG_S16);
-    handlers[ACTION_CALLFRAME] = ActionHandler(ACTION_CALLFRAME,
-             string("ActionCallFrame"), SWFHandlers::ActionCallFrame, ARG_HEX);
-    handlers[ACTION_GOTOEXPRESSION] = ActionHandler(ACTION_GOTOEXPRESSION,
-             string("ActionGotoExpression"), 
SWFHandlers::ActionGotoExpression, ARG_HEX);
-    handlers[ACTION_DELETEVAR] = ActionHandler(ACTION_DELETEVAR,
-             string("ActionDeleteVar"), SWFHandlers::ActionDeleteVar);
-    handlers[ACTION_DELETE] = ActionHandler(ACTION_DELETE,
-             string("ActionDelete"), SWFHandlers::ActionDelete);
-    handlers[ACTION_VAREQUALS] = ActionHandler(ACTION_VAREQUALS,
-             string("ActionVarEquals"), SWFHandlers::ActionVarEquals);
-    handlers[ACTION_CALLFUNCTION] = ActionHandler(ACTION_CALLFUNCTION,
-             string("ActionCallFunction"), SWFHandlers::ActionCallFunction);
-    handlers[ACTION_RETURN] = ActionHandler(ACTION_RETURN,
-             string("ActionReturn"), SWFHandlers::ActionReturn);
-    handlers[ACTION_MODULO] = ActionHandler(ACTION_MODULO,
-             string("ActionModulo"), SWFHandlers::ActionModulo);
-    handlers[ACTION_NEW] = ActionHandler(ACTION_NEW,
-             string("ActionNew"), SWFHandlers::ActionNew);
-    handlers[ACTION_VAR] = ActionHandler(ACTION_VAR,
-             string("ActionVar"), SWFHandlers::ActionVar);    
-    handlers[ACTION_INITARRAY] = ActionHandler(ACTION_INITARRAY,
-             string("ActionInitArray"), SWFHandlers::ActionInitArray);
-    handlers[ACTION_INITOBJECT] = ActionHandler(ACTION_INITOBJECT,
-             string("ActionInitObject"), SWFHandlers::ActionInitObject);
-    handlers[ACTION_TYPEOF] = ActionHandler(ACTION_TYPEOF,
-             string("ActionTypeOf"), SWFHandlers::ActionTypeOf);
-    handlers[ACTION_TARGETPATH] = ActionHandler(ACTION_TARGETPATH,
-             string("ActionTargetPath"), SWFHandlers::ActionTargetPath);
-    handlers[ACTION_ENUMERATE] = ActionHandler(ACTION_ENUMERATE,
-             string("ActionEnumerate"), SWFHandlers::ActionEnumerate);
-    handlers[ACTION_NEWADD] = ActionHandler(ACTION_NEWADD,
-             string("ActionNewAdd"), SWFHandlers::ActionNewAdd);
-    handlers[ACTION_NEWLESSTHAN] = ActionHandler(ACTION_NEWLESSTHAN,
-             string("ActionNewLessThan"), SWFHandlers::ActionNewLessThan);
-    handlers[ACTION_NEWEQUALS] = ActionHandler(ACTION_NEWEQUALS,
-             string("ActionNewEquals"), SWFHandlers::ActionNewEquals);
-    handlers[ACTION_TONUMBER] = ActionHandler(ACTION_TONUMBER,
-             string("ActionToNumber"), SWFHandlers::ActionToNumber);
-    handlers[ACTION_TOSTRING] = ActionHandler(ACTION_TOSTRING,
-             string("ActionToString"), SWFHandlers::ActionToString);
-    handlers[ACTION_DUP] = ActionHandler(ACTION_DUP,
-             string("ActionDup"), SWFHandlers::ActionDup);    
-    handlers[ACTION_SWAP] = ActionHandler(ACTION_SWAP,
-             string("ActionSwap"), SWFHandlers::ActionSwap);    
-    handlers[ACTION_GETMEMBER] = ActionHandler(ACTION_GETMEMBER,
-             string("ActionGetMember"), SWFHandlers::ActionGetMember);
-    handlers[ACTION_SETMEMBER] = ActionHandler(ACTION_SETMEMBER,
-             string("ActionSetMember"), SWFHandlers::ActionSetMember);
-    handlers[ACTION_INCREMENT] = ActionHandler(ACTION_INCREMENT,
-             string("ActionIncrement"), SWFHandlers::ActionIncrement);
-    handlers[ACTION_DECREMENT] = ActionHandler(ACTION_DECREMENT,
-             string("ActionDecrement"), SWFHandlers::ActionDecrement);    
-    handlers[ACTION_CALLMETHOD] = ActionHandler(ACTION_CALLMETHOD,
-             string("ActionCallMethod"), SWFHandlers::ActionCallMethod);
-    handlers[ACTION_NEWMETHOD] = ActionHandler(ACTION_NEWMETHOD,
-             string("ActionNewMethod"), SWFHandlers::ActionNewMethod);
-    handlers[ACTION_INSTANCEOF] = ActionHandler(ACTION_INSTANCEOF,
-             string("ActionInstanceOf"), SWFHandlers::ActionInstanceOf);
-    handlers[ACTION_ENUM2] = ActionHandler(ACTION_ENUM2,
-             string("ActionEnum2"), SWFHandlers::ActionEnum2);    
-    handlers[ACTION_BITWISEAND] = ActionHandler(ACTION_BITWISEAND,
-             string("ActionBitwiseAnd"), SWFHandlers::ActionBitwiseAnd);
-    handlers[ACTION_BITWISEOR] = ActionHandler(ACTION_BITWISEOR,
-             string("ActionBitwiseOr"), SWFHandlers::ActionBitwiseOr);
-    handlers[ACTION_BITWISEXOR] = ActionHandler(ACTION_BITWISEXOR,
-             string("ActionBitwiseXor"), SWFHandlers::ActionBitwiseXor);
-    handlers[ACTION_SHIFTLEFT] = ActionHandler(ACTION_SHIFTLEFT,
-             string("ActionShiftLeft"), SWFHandlers::ActionShiftLeft);
-    handlers[ACTION_SHIFTRIGHT] = ActionHandler(ACTION_SHIFTRIGHT,
-             string("ActionShiftRight"), SWFHandlers::ActionShiftRight);
-    handlers[ACTION_SHIFTRIGHT2] = ActionHandler(ACTION_SHIFTRIGHT2,
-             string("ActionShiftRight2"), SWFHandlers::ActionShiftRight2);
-    handlers[ACTION_STRICTEQ] = ActionHandler(ACTION_STRICTEQ,
-             string("ActionStrictEq"), SWFHandlers::ActionStrictEq);
-    handlers[ACTION_GREATER] = ActionHandler(ACTION_GREATER,
-             string("ActionGreater"), SWFHandlers::ActionGreater);
-    handlers[ACTION_STRINGGREATER] = ActionHandler(ACTION_STRINGGREATER,
-             string("ActionStringGreater"), SWFHandlers::ActionStringGreater);
-    handlers[ACTION_EXTENDS] = ActionHandler(ACTION_EXTENDS,
-             string("ActionExtends"), SWFHandlers::ActionExtends);
-    handlers[ACTION_CONSTANTPOOL] = ActionHandler(ACTION_CONSTANTPOOL,
-             string("ActionConstantPool"), SWFHandlers::ActionConstantPool, 
ARG_DECL_DICT);
-    handlers[ACTION_DEFINEFUNCTION2] = ActionHandler(ACTION_DEFINEFUNCTION2,
-             string("ActionDefineFunction2"), 
SWFHandlers::ActionDefineFunction2,
-             ARG_FUNCTION2);
-    handlers[ACTION_TRY] = ActionHandler(ACTION_TRY,
-             string("ActionTry"), SWFHandlers::ActionTry, ARG_FUNCTION2);
-    handlers[ACTION_WITH] = ActionHandler(ACTION_WITH,
-             string("ActionWith"), SWFHandlers::ActionWith, ARG_U16);
-    handlers[ACTION_DEFINEFUNCTION] = ActionHandler(ACTION_DEFINEFUNCTION,
-             string("ActionDefineFunction"), 
SWFHandlers::ActionDefineFunction, ARG_HEX);
-    handlers[ACTION_SETREGISTER] = ActionHandler(ACTION_SETREGISTER,
-             string("ActionSetRegister"), SWFHandlers::ActionSetRegister, 
ARG_U8);
-    
-
-}
-
-SWFHandlers::~SWFHandlers()
-{
-//    GNASH_REPORT_FUNCTION;
-}
-
-
-std::vector<ActionHandler> &
-SWFHandlers::get_handlers()
-{
-       static container_type handlers(255);
-       return handlers;
-}
-
-std::vector<std::string> &
-SWFHandlers::get_property_names()
-{
-       static std::vector<std::string> prop_names;
-       return prop_names;
-}
-
-
-const SWFHandlers&
-SWFHandlers::instance()
-{
-       static SWFHandlers instance;
-       return instance;
-}
-
-// Vitaly: the result is not used anywhere
-void
-SWFHandlers::execute(action_type type, ActionExec& thread) const
-{
-//    GNASH_REPORT_FUNCTION;
-//     It is very heavy operation
-//     if ( _handlers[type].getName() == "unsupported" ) return false;
-       get_handlers()[type].execute(thread);
-}
-
-void
-SWFHandlers::ActionEnd(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-
-       //as_environment& env = thread.env;
-#ifndef NDEBUG
-       const action_buffer& code = thread.code;
-       assert( code[thread.pc] == SWF::ACTION_END );
-#endif
-
-       dbglogfile << __PRETTY_FUNCTION__ << ": CHECKME: was broken" << endl;
-       thread.next_pc=thread.stop_pc;
-}
-void
-SWFHandlers::ActionNextFrame(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-       const action_buffer& code = thread.code;
-
-       assert( code[thread.pc] == SWF::ACTION_NEXTFRAME );
-
-       sprite_instance* tgt = env.get_target()->to_movie();
-       assert(tgt);
-       tgt->goto_frame(tgt->get_current_frame() + 1);
-}
-
-void
-SWFHandlers::ActionPrevFrame(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-       const action_buffer& code = thread.code;
-
-       assert( code[thread.pc] == SWF::ACTION_PREVFRAME );
-
-       sprite_instance* tgt = env.get_target()->to_movie();
-       assert(tgt);
-       tgt->goto_frame(tgt->get_current_frame() - 1);
-}
-
-void
-SWFHandlers::ActionPlay(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-
-    as_environment& env = thread.env;
-    const action_buffer& code = thread.code;
-
-    assert( code[thread.pc] == SWF::ACTION_PLAY );
-    sprite_instance* tgt = env.get_target()->to_movie();
-    assert(tgt);
-    tgt->set_play_state(sprite_instance::PLAY);
-}
-
-void
-SWFHandlers::ActionStop(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-
-    as_environment& env = thread.env;
-    const action_buffer& code = thread.code;
-
-    assert( code[thread.pc] == SWF::ACTION_STOP );
-    
-    sound_handler* s = get_sound_handler();
-
-    sprite_instance* tgt = env.get_target()->to_movie();
-    assert(tgt);
-    int stream_id = tgt->get_sound_stream_id();
-
-    if (s != NULL && stream_id != -1)
-    {
-        s->stop_sound(stream_id);
-    }
-
-    tgt->set_play_state(sprite_instance::STOP);
-}
-
-void
-SWFHandlers::ActionToggleQuality(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-
-    //as_environment& env = thread.env;
-    const action_buffer& code = thread.code;
-
-    assert( code[thread.pc] == SWF::ACTION_TOGGLEQUALITY );
-    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
-}
-
-void
-SWFHandlers::ActionStopSounds(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-
-       //as_environment& env = thread.env;
-       const action_buffer& code = thread.code;
-
-       assert( code[thread.pc] == SWF::ACTION_STOPSOUNDS );
-
-       sound_handler* s = get_sound_handler();
-       if (s != NULL)
-       {
-               s->stop_all_sounds();
-       }
-}
-
-void
-SWFHandlers::ActionGotoFrame(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-       const action_buffer& code = thread.code;
-
-       assert( code[thread.pc] == SWF::ACTION_GOTOFRAME );
-
-       size_t frame = code.read_int16(thread.pc+3);
-
-       sprite_instance* tgt = env.get_target()->to_movie();
-       assert(tgt);
-
-       // 0-based already?
-       //// Convert from 1-based to 0-based
-       //frame--;
-       tgt->goto_frame(frame);
-}
-
-void
-SWFHandlers::ActionGetUrl(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-       const action_buffer& code = thread.code;
-
-       assert( code[thread.pc] == SWF::ACTION_GETURL );
-
-       size_t& pc = thread.pc;
-
-       // If this is an FSCommand, then call the callback
-       // handler, if any.
-                 
-       // Two strings as args.
-       // TODO: make sure the NULL terminations are there
-       // we could implement a safe_read_string(pc, maxlen)
-       // and use tag length as maxlen
-       //size_t tag_length = code.read_int16(pc+1);
-       const char* url = code.read_string(pc+3);
-       size_t url_len = strlen(url)+1;
-       const char* target = code.read_string(pc+3+url_len);
-
-               IF_VERBOSE_ACTION (
-       log_action("GetUrl: target=%s url=%s", target, url);
-               );
-
-       CommonGetUrl(env, target, url, 0u);
-}
-
-void
-SWFHandlers::ActionWaitForFrame(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-       const action_buffer& code = thread.code;
-
-       assert( code[thread.pc] == SWF::ACTION_WAITFORFRAME );
-
-       // SWF integrity check
-       size_t tag_len = code.read_int16(thread.pc+1);
-       if ( tag_len != 3 )
-       {
-               log_warning("Malformed SWF: ActionWaitForFrame (0x%X) tag 
length == " SIZET_FMT
-                           " (expected 3)", SWF::ACTION_WAITFORFRAME, tag_len);
-       }
-
-       // If we haven't loaded a specified frame yet, then 
-       // skip the specified number of actions.
-       //
-       unsigned int framenum = code.read_int16(thread.pc+3);
-       uint8 skip = code[thread.pc+5];
-
-       character* target = env.get_target();
-       sprite_instance* target_sprite = target->to_movie();
-       if ( ! target_sprite )
-       {
-               log_error("environment target is not a sprite_instance while 
executing ActionWaitForFrame");
-               return;
-       }
-
-       // Actually *wait* for target frame, and never skip any action
-#ifdef REALLY_WAIT_ON_WAIT_FOR_FRAME
-       target_sprite->get_movie_definition()->ensure_frame_loaded(framenum);
-       assert(target_sprite->get_loaded_frames() >= framenum);
-#endif
-
-       size_t lastloaded = target_sprite->get_loaded_frames();
-       if ( lastloaded < framenum )
-       {
-               //log_msg("ActionWaitForFrame: frame %u not reached yet (loaded 
%u), skipping next %u actions", framenum, lastloaded, skip);
-               // better delegate this to ActionExec
-               thread.skip_actions(skip);
-       }
-
-       //dbglogfile << __PRETTY_FUNCTION__ << ": testing" << endl;
-}
-
-void
-SWFHandlers::ActionSetTarget(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_SETTARGET); // 0x8B
-
-       // Change the movie we're working on.
-       std::string target_name ( code.read_string(pc+3) );
-
-       character *new_target;
-                 
-       // if the string is blank, we set target to the root movie
-       // TODO - double check this is correct?
-       if ( target_name.empty() )
-       {
-               target_name = "/";
-       }
-
-       new_target = env.find_target(target_name);
-       if (new_target == NULL)
-       {
-               IF_VERBOSE_ACTION (
-               log_action("ERROR: Couldn't find movie \"%s\" "
-                       "to set target to! Not setting target at all...",
-                       target_name.c_str());
-               );
-       }
-       else
-       {
-               env.set_target(new_target);
-       }
-}
-
-void
-SWFHandlers::ActionGotoLabel(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-       const action_buffer& code = thread.code;
-
-       const char* frame_label = code.read_string(thread.pc+3);
-       character *target = env.get_target();
-       sprite_instance *target_sprite = target->to_movie();
-       if ( ! target_sprite )
-       {
-               log_error("environment target is not a sprite_instance while 
executing ActionGotoLabel");
-       }
-       else
-       {
-               target_sprite->goto_labeled_frame(frame_label);
-       }
-}
-
-void
-SWFHandlers::ActionAdd(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2);
-    env.top(1) += env.top(0);
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionSubtract(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2);
-    env.top(1) -= env.top(0);
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionMultiply(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2);
-    env.top(1) *= env.top(0);
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionDivide(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2);
-    env.top(1) /= env.top(0);
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionEqual(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    assert(thread.code[thread.pc] == SWF::ACTION_EQUAL); // 0x0E
-
-    ensure_stack(env, 2);
-
-    as_value& op1 = env.top(0);
-    as_value& op2 = env.top(1);
-
-    env.top(1).set_bool(op1.to_number() == op2.to_number());
-
-    // Flash4 used 1 and 0 as return from this tag
-    if ( env.get_version() < 5 ) {
-      env.top(1).to_number();
-    } 
-
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionLessThan(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2);
-    env.top(1).set_bool(env.top(1) < env.top(0));
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionLogicalAnd(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2);
-    env.top(1).set_bool(env.top(1).to_bool() && env.top(0).to_bool());
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionLogicalOr(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2);
-    env.top(1).set_bool(env.top(1).to_bool() || env.top(0).to_bool());
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionLogicalNot(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 1);
-    env.top(0).set_bool(! env.top(0).to_bool());
-}
-
-void
-SWFHandlers::ActionStringEq(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2);
-    env.top(1).set_bool(env.top(1).to_tu_string() == 
env.top(0).to_tu_string());
-    env.drop(1);    
-}
-
-void
-SWFHandlers::ActionStringLength(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 1);
-    int version = env.get_version();
-    
env.top(0).set_int(env.top(0).to_tu_string_versioned(version).utf8_length());
-}
-
-void
-SWFHandlers::ActionSubString(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 3); // size, base, string
-
-    as_value& size_val = env.top(0);
-    as_value& base_val = env.top(1);
-    as_value& string_val = env.top(2);
-
-    // input checks
-    if ( string_val.is_undefined() || string_val.is_null() )
-    {
-       log_warning("Undefined or null string passed to ActionSubString, "
-               "returning undefined");
-       env.drop(2);
-       env.top(0).set_undefined();
-       return;
-    }
-
-    int        size = int(size_val.to_number());
-    if ( size < 0 )
-    {
-       log_warning("Negative size passed to ActionSubString, "
-               "returning undefined");
-       env.drop(2);
-       env.top(0).set_undefined();
-       return;
-    }
-
-    int        base = int(base_val.to_number());  
-    int version = env.get_version();
-    const tu_string& str = string_val.to_tu_string_versioned(version);
-
-    // TODO: if 'base' or 'size' do not evaluate to numbers return 
-    //       the empty string (how do we check if they evaluate ??)
-
-    // negative base refer to index from end
-    // -1 is *last* character, otherwise
-    // they are 1-based index from start
-    if ( base < 0 ) base += str.length();
-    else base = base-1;
-
-    if ( base < 0 || base >= str.length() )
-    {
-       log_warning("Invalid base passed to ActionSubString, "
-               "returning undefined");
-       env.drop(2);
-       env.top(0).set_undefined();
-       return;
-    }
-
-    if ( base+size > str.length() )
-    {
-       log_warning("size+based go beyond input string in ActionSubString, "
-               "returning undefined");
-       env.drop(2);
-       env.top(0).set_undefined();
-       return;
-    }
-
-
-    assert(base >= 0);
-    assert(base < str.length() );
-    assert(size >= 0);
-
-    //log_msg("string: %s, size: %d, base: %d", str.c_str(), size, base);
-
-    // Keep base within range.
-    //base = iclamp(base, 0, str.length());
-    
-    // Truncate if necessary.
-    //size = imin(str.length() - base, size);
-
-    // TODO: unsafe: use std::string::substr instead !
-    tu_string  new_string = str.c_str() + base;
-    new_string.resize(size);
-    
-    env.drop(2);
-    env.top(0).set_tu_string(new_string);
-}
-
-void
-SWFHandlers::ActionPop(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-       // this is an overhead only if SWF is malformed.
-       ensure_stack(env, 1);
-       env.drop(1);
-}
-
-void
-SWFHandlers::ActionInt(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 1);
-    env.top(0).set_int(int(floor(env.top(0).to_number())));
-}
-
-void
-SWFHandlers::ActionGetVariable(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-       ensure_stack(env, 1); // variable name
-
-       as_value& top_value = env.top(0);
-       const char* ptr = top_value.to_string();
-       if ( ! ptr )
-       {
-               top_value.set_undefined();
-               return;
-       }
-
-       std::string var_string(ptr);
-
-       top_value = env.get_variable(var_string, thread.getWithStack());
-
-       IF_VERBOSE_ACTION
-       (
-               if (top_value.to_object() == NULL) {
-                       log_action("-- get var: %s=%s",
-                               var_string.c_str(),
-                               top_value.to_string());
-               } else {
-                       log_action("-- get var: %s=%s at %p",
-                               var_string.c_str(),
-                               top_value.to_tu_string().c_str(),
-                               (void*)top_value.to_object());
-               }
-       );
-}
-
-void
-SWFHandlers::ActionSetVariable(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-
-       // stack must be contain at least two items
-       ensure_stack(env, 2); 
-
-       assert(env.top(1).to_string());
-       env.set_variable(env.top(1).to_string(), env.top(0),
-               thread.getWithStack());
-
-               IF_VERBOSE_ACTION (
-       log_action("-- set var: %s", env.top(1).to_string());
-               );
-
-       env.drop(2);
-}
-
-void
-SWFHandlers::ActionSetTargetExpression(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 1);  // target name
-
-       //Vitaly: env.drop(1) remove object on which refers const char * 
target_name
-       //strk: shouldn't we use env.pop() instead ?
-       //const char * target_name = env.top(0).to_string();
-       assert(env.top(0).to_string());
-       std::string target_name = env.top(0).to_string();
-       env.drop(1); // pop the target name off the stack
-
-       character *new_target;
-    
-       // if the string is blank, we set target to the root movie
-       // TODO - double check this is correct?
-       if ( target_name.empty() )
-       {
-               target_name = "/";
-       }
-
-       new_target = env.find_target(target_name);
-       if (new_target == NULL)
-       {
-               log_warning(
-                       " Couldn't find movie \"%s\" to set target to!"
-                       " Not setting target at all...",
-                       target_name.c_str());
-       }
-       else
-       {
-               env.set_target(new_target);
-       }
-}
-
-void
-SWFHandlers::ActionStringConcat(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 2); // two strings
-
-    int version = env.get_version();
-    env.top(1).convert_to_string_versioned(version);
-    env.top(1).string_concat(env.top(0).to_tu_string_versioned(version));
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionGetProperty(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 2); // prop num, target
-
-       character *target = env.find_target(env.top(1));
-       unsigned int prop_number = (unsigned int)env.top(0).to_number();
-       if (target)
-       {
-               if ( prop_number < get_property_names().size() )
-               {
-                       as_value val;
-                       
target->get_member(get_property_names()[prop_number].c_str(),
-                               &val);
-                       env.top(1) = val;
-        }
-        else
-               {
-                       log_error("invalid property query, property "
-                               "number %d", prop_number);
-                   env.top(1) = as_value();
-               }
-    }
-       else
-       {
-               env.top(1) = as_value();
-       }
-       env.drop(1);
-}
-
-void
-SWFHandlers::ActionSetProperty(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    
-    ensure_stack(env, 3); // prop val, prop num, target
-
-    character *target = env.find_target(env.top(2));
-    unsigned int prop_number = (unsigned int)env.top(1).to_number();
-    as_value prop_val = env.top(0);
-    
-    if (target) {
-//        set_property(target, prop_number, env.top(0));
-        if ( prop_number < get_property_names().size() )
-       {
-           target->set_member(get_property_names()[prop_number].c_str(), 
prop_val);
-       }
-       else
-       {
-           log_error("invalid set_property, property number %d", prop_number);
-       }
-        
-    }
-    env.drop(3);
-}
-
-void
-SWFHandlers::ActionDuplicateClip(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 3); 
-
-       sprite_instance* si = env.get_target()->to_movie();
-       if ( ! si )
-       {
-               log_error("environment target is not a sprite_instance while 
executing ActionDuplicateClip");
-       }
-       else
-       {
-               si->clone_display_object(
-                       env.top(2).to_std_string(),
-                       env.top(1).to_std_string(),
-                       (int) env.top(0).to_number());
-       }
-       env.drop(3);
-}
-
-void
-SWFHandlers::ActionRemoveClip(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 1); 
-
-       sprite_instance* tgt = env.get_target()->to_movie();
-       assert(tgt);
-
-       // strk: why not using pop() ?
-       tgt->remove_display_object(env.top(0).to_tu_string());
-       env.drop(1);
-}
-
-/// \brief Trace messages from the Flash movie using trace();
-void
-SWFHandlers::ActionTrace(ActionExec& thread)
-{
-////    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 1); 
-
-    // strk: why not using pop() ?
-    dbglogfile << env.top(0).to_string() << endl;
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionStartDragMovie(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 3); 
-
-    sprite_instance::drag_state        st;
-    
-    st.m_character = env.find_target(env.top(0));
-    if (st.m_character == NULL) {
-        log_error("start_drag of invalid target '%s'.",
-                  env.top(0).to_string());
-    }
-    
-    st.m_lock_center = env.top(1).to_bool();
-    st.m_bound = env.top(2).to_bool();
-    if (st.m_bound) {
-
-        // strk: this works if we didn't drop any before, in 
-        // a contrary case (if we used pop(), which I suggest)
-        // we must remember to updated this as required
-        ensure_stack(env, 7);
-
-        st.m_bound_x0 = (float) env.top(6).to_number();
-        st.m_bound_y0 = (float) env.top(5).to_number();
-        st.m_bound_x1 = (float) env.top(4).to_number();
-        st.m_bound_y1 = (float) env.top(3).to_number();
-        env.drop(4);
-    }
-    env.drop(3);
-    
-    sprite_instance *root_movie = env.get_target()->get_root_movie();
-    assert(root_movie);
-    
-    if (root_movie && st.m_character) {
-        root_movie->set_drag_state(st);
-    }
-    
-}
-
-void
-SWFHandlers::ActionStopDragMovie(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    sprite_instance *root_movie = env.get_target()->get_root_movie();
-    assert(root_movie);
-    root_movie->stop_drag();
-}
-
-void
-SWFHandlers::ActionStringCompare(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); 
-    env.top(1).set_bool(env.top(1).to_tu_string() < env.top(0).to_tu_string());
-}
-
-void
-SWFHandlers::ActionThrow(ActionExec& /*thread*/)
-{
-//    GNASH_REPORT_FUNCTION;
-    //as_environment& env = thread.env;
-    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
-}
-
-void
-SWFHandlers::ActionCastOp(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 2);  // super, instance
-
-       // Get the "super" function
-       as_function* super = env.top(0).to_as_function();
-
-       // Get the "instance" 
-       as_object* instance = env.top(1).to_object();
-
-       // Invalid args!
-       if (!super || ! instance)
-       {
-               IF_VERBOSE_ACTION (
-               log_action("-- %s instance_of %s (invalid args?)",
-                       env.top(1).to_string(),
-                       env.top(0).to_string());
-               );
-
-               env.drop(1);
-               env.top(0) = as_value(); 
-               return;
-       }
-
-       env.drop(1);
-       if ( instance->instanceOf(super) )
-       {
-               env.top(0) = as_value(instance);
-       }
-       else
-       {
-               env.top(0) = as_value();
-       }
-}
-
-void
-SWFHandlers::ActionImplementsOp(ActionExec& /*thread*/)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       // assert(thread.code[thread.pc] == SWF::ACTION_IMPLEMENTSOP);
-
-       //as_environment& env = thread.env;
-       dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
-}
-
-void
-SWFHandlers::ActionRandom(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 1);  // max
-
-       int     max = int(env.top(0).to_number());
-       if (max < 1) max = 1;
-       env.top(0).set_int(tu_random::next_random() % max);
-}
-
-void
-SWFHandlers::ActionMbLength(ActionExec& /*thread*/)
-{
-//    GNASH_REPORT_FUNCTION;
-//    as_environment& env = thread.env;
-    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
-}
-
-void
-SWFHandlers::ActionOrd(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 1);  
-    env.top(0).set_int(env.top(0).to_string()[0]);
-}
-
-void
-SWFHandlers::ActionChr(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 1);  
-    char       buf[2];
-    buf[0] = int(env.top(0).to_number());
-    buf[1] = 0;
-    env.top(0).set_string(buf);
-}
-
-void
-SWFHandlers::ActionGetTimer(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       sprite_instance* tgt = env.get_target()->to_movie();
-       assert(tgt);
-       env.push(floorf(tgt->get_timer() * 1000.0f));
-}
-
-void
-SWFHandlers::ActionMbSubString(ActionExec& /*thread*/)
-{
-//    GNASH_REPORT_FUNCTION;
-//    as_environment& env = thread.env;
-    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
-}
-
-void
-SWFHandlers::ActionMbOrd(ActionExec& /*thread*/)
-{
-//    GNASH_REPORT_FUNCTION;
-//    as_environment& env = thread.env;
-    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
-}
-
-void
-SWFHandlers::ActionMbChr(ActionExec& /*thread*/)
-{
-//    GNASH_REPORT_FUNCTION;
-//    as_environment& env = thread.env;
-    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
-}
-
-// also known as WaitForFrame2
-void
-SWFHandlers::ActionWaitForFrameExpression(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-       const action_buffer& code = thread.code;
-
-       ensure_stack(env, 1); // expression
-
-       // how many actions to skip if frame has not been loaded
-       uint8 skip = code[thread.pc+3];
-
-       // env.top(0) contains frame specification,
-       // evaluated as for ActionGotoExpression
-       as_value& framespec = env.top(0);
-       
-       character* target = env.get_target();
-       sprite_instance* target_sprite = target->to_movie();
-       if ( ! target_sprite )
-       {
-               log_error("environment target is not a sprite_instance "
-                       "while executing ActionWaitForFrameExpression");
-               env.drop(1);
-               return;
-       }
-
-       size_t framenum = target_sprite->get_frame_number(framespec);
-
-#ifdef REALLY_WAIT_ON_WAIT_FOR_FRAME
-       target_sprite->get_movie_definition()->ensure_frame_loaded(framenum);
-       assert(target_sprite->get_loaded_frames() >= framenum);
-#endif
-
-       size_t lastloaded = target_sprite->get_loaded_frames();
-       if ( lastloaded < framenum )
-       {
-               //log_msg("ActionWaitForFrameExpression: frame %u not reached 
yet (loaded %u), skipping next %u actions", framenum, lastloaded, skip);
-               // better delegate this to ActionExec
-               thread.skip_actions(skip);
-       }
-
-       env.drop(1);
-       
-       //dbglogfile << __PRETTY_FUNCTION__ << ": testing" << endl;
-}
-
-void
-SWFHandlers::ActionPushData(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       const action_buffer& code = thread.code;
-
-       size_t pc = thread.pc;
-       int16_t length = code.read_int16(pc+1);
-       assert( length >= 0 );
-
-               IF_VERBOSE_ACTION (
-       log_action("-------------- push len=%d", length);
-               );
-
-       //---------------
-       size_t i = pc;
-       while (i - pc < static_cast<size_t>(length)) {
-             uint8_t type = code[3 + i];
-               IF_VERBOSE_ACTION (
-               log_action("-------------- push type=%d", type);
-               );
-             i++;
-             if (type == 0) {
-                 // string
-                 const char* str = code.read_string(i+3);
-                 i += strlen(str) + 1;
-                 env.push(str);
-                 
-               IF_VERBOSE_ACTION (
-                 log_action("-------------- pushed '%s'", str);
-               );
-             } else if (type == 1) {
-               
-                 float f = code.read_float_little(i+3);
-                 i += 4;
-                 env.push(f);
-               IF_VERBOSE_ACTION (
-                 log_action("-------------- pushed '%g'", f);
-               );
-             } else if (type == 2) {
-                 as_value nullvalue;
-                 nullvalue.set_null();
-                 env.push(nullvalue);  
-                 
-               IF_VERBOSE_ACTION (
-                 log_action("-------------- pushed NULL");
-               );
-             } else if (type == 3) {
-                 env.push(as_value());
-                 
-               IF_VERBOSE_ACTION (
-                 log_action("-------------- pushed UNDEFINED");
-               );
-             } else if (type == 4) {
-                 // contents of register
-                 uint8_t reg = code[3 + i];
-                 ++i;
-                 if ( thread.isFunction2() ) {
-                     env.push(env.local_register(reg));
-               IF_VERBOSE_ACTION (
-                     log_action("-------------- pushed local register[%d] = 
'%s'",
-                                 reg,
-                                 env.top(0).to_string());
-               );
-                 } else if (reg >= 4) {
-                     env.push(as_value());
-                     log_error("push register[%d] -- register out of bounds!", 
reg);
-                 } else {
-                     env.push(env.global_register(reg));
-               IF_VERBOSE_ACTION (
-                     log_action("-------------- pushed global register[%d] = 
'%s'",
-                                 reg,
-                                 env.top(0).to_string());
-               );
-                 }
-                 
-             } else if (type == 5) {
-                 bool  bool_val = code[i+3] ? true : false;
-                 i++;
-//                       log_msg("bool(%d)", bool_val);
-                 env.push(bool_val);
-                 
-               IF_VERBOSE_ACTION (
-                 log_action("-------------- pushed %s",
-                            (bool_val ? "true" : "false"));
-               );
-             } else if (type == 6) {
-                 double d = code.read_double_wacky(i+3);
-                 i += 8;
-                 env.push(d);
-                 
-               IF_VERBOSE_ACTION (
-                 log_action("-------------- pushed double %g", d);
-               );
-             } else if (type == 7) {
-                 // int32
-                 int32_t val = code.read_int32(i+3);
-                 i += 4;
-                 
-                 env.push(val);
-                 
-               IF_VERBOSE_ACTION (
-                 log_action("-------------- pushed int32 %d",val);
-               );
-
-             } else if (type == 8) {
-                 int id = code[3 + i];
-                 i++;
-                 if ( id < (int) code.dictionary_size() ) {
-                     env.push( code.dictionary_get(id) );
-                     
-               IF_VERBOSE_ACTION (
-                     log_action("-------------- pushed '%s'",
-                                code.dictionary_get(id));
-               );
-
-                 } else {
-                     log_error("dict_lookup(%d) is out of bounds!", id);
-                     env.push(0);
-               IF_VERBOSE_ACTION (
-                     log_action("-------------- pushed 0");
-               );
-
-                 }
-             } else if (type == 9) {
-                 int   id = code.read_int16(i+3);
-                 i += 2;
-                 if ( id < (int) code.dictionary_size() ) {
-                     env.push( code.dictionary_get(id) );
-               IF_VERBOSE_ACTION (
-                     log_action("-------------- pushed '%s'",
-                               code.dictionary_get(id) );
-               );
-                 } else {
-                     log_error("dict_lookup(%d) is out of bounds!", id);
-                     env.push(0);
-                     
-               IF_VERBOSE_ACTION (
-                     log_action("-------------- pushed 0");
-               );
-                 }
-             }
-       }
-}
-
-void
-SWFHandlers::ActionBranchAlways(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       int16_t offset = thread.code.read_int16(thread.pc+3);
-       thread.next_pc += offset;
-       // @@ TODO range checks
-}
-
-// Common code for GetUrl and GetUrl2. See:
-// http://sswf.sourceforge.net/SWFalexref.html#action_get_url
-// http://sswf.sourceforge.net/SWFalexref.html#action_get_url2
-//
-// Testcases:
-//
-// - http://www.garfield.com/comics/comics_todays.html           
-//   lower_todayscomic.swf should render four flash files in its canvas
-//
-// - http://www.voiptalk.org
-//   pressing 'My Account' button should open
-//   https://www.voiptalk.org/products/login.php
-//   NOTE: this is affected by the GetUrl bug reported with an excerpt
-//         from Colin Moock book, see below. (won't work, and won't fix)
-//
-void 
-SWFHandlers::CommonGetUrl(as_environment& env,
-               as_value target, // the target window, or _level1..10
-               const char* url_c,
-                uint8_t method /*
-                               * Bit-packed as follow
-                               *
-                               * SendVarsMethod:2 (0:NONE 1:GET 2:POST)
-                               * Reserved:4
-                               * LoadTargetFlag:1
-                               * LoadVariableFlag:1
-                               */
-               )
-{
-
-       assert(url_c);
-
-       if ( *url_c == '\0' )
-       {
-               log_warning("Bogus GetUrl url (empty) in SWF file, skipping");
-               return;
-       }
-
-#define GETURL2_LOADTARGET_FLAG   1<<7
-#define GETURL2_LOADVARIABLE_FLAG 1<<8
-
-       // Parse the method bitfield
-       uint8_t sendVarsMethod = method & 3;
-       bool loadTargetFlag    = method & 64;
-       bool loadVariableFlag  = method & 128;
-
-       // handle malformed sendVarsMethod
-       if ( sendVarsMethod == 3 )
-       {
-               log_warning("Bogus GetUrl2 send vars method "
-                       " in SWF file (both GET and POST requested), set to 0");
-               sendVarsMethod=0;
-       }
-
-       // Warn about unsupported features
-       if ( loadVariableFlag ) {
-               log_warning("Unhandled GetUrl2 loadVariable flag");
-       }
-       if ( sendVarsMethod ) {
-               log_warning("Unhandled GetUrl2 sendVariableMethod (%d)",
-                       sendVarsMethod);
-       }
-
-       const char* target_string = NULL;
-       if ( ! target.is_undefined() && ! target.is_null() )
-       {
-               target_string = target.to_string();
-       }
-
-       // If the url starts with "FSCommand:", then this is
-       // a message for the host app.
-       if (strncmp(url_c, "FSCommand:", 10) == 0)
-       {
-               if (s_fscommand_handler)
-               {
-                       // Call into the app.
-                       
(*s_fscommand_handler)(env.get_target()->get_root_movie(), url_c + 10, 
target_string);
-               }
-
-               return;
-       }
-
-       // If the url starts with "print:", then this is
-       // a print request.
-       if (strncmp(url_c, "print:", 6) == 0)
-       {
-               log_error("Printing unimplemented");
-               return;
-       }
-
-       //
-       // From "ActionScript: The Definitive Guide" by Colin Moock p. 470
-       // --------8<------------------------------------------------------
-       // In most browsers, getURL() relative links are resolved relative
-       // to the HTML file that contains the .swf file. In IE 4.5 and older
-       // versions on Macintosh, relative links are resolved relative to
-       // the location of the .swf file, not the HTML file, which causes
-       // problems when the two are in different directories. To avoid
-       // the problem, either place the .swf and the .html file in the
-       // same directory or use absolute URLs when invoking getURL().
-       // --------8<------------------------------------------------------
-       //
-       // We'll resolve relative to our "base url".
-       // The base url must be set with the set_base_url() command.
-       //
-
-       string url_s(url_c);
-
-       const URL& baseurl = get_base_url();
-       URL url(url_s, baseurl);
-
-       log_msg("get url: target=%s, url=%s (%s)", target_string,
-               url.str().c_str(), url_c);
-
-       // Check host security
-       if ( ! URLAccessManager::allow(url) )
-       {
-               return;
-       }
-
-
-       if ( loadTargetFlag )
-       {
-               log_msg("getURL2 target load");
-                     
-               character* target_ch = env.find_target(target);
-               if ( ! target_ch )
-               {
-                       log_error("get url: target %s not found",
-                               target_string);
-                       return;
-               }
-
-               sprite_instance* target_movie = target_ch->to_movie();
-               if ( ! target_movie ) 
-               {
-                       log_error("get url: target %s is not a sprite",
-                               target_string);
-                       return;
-               }
-
-               sprite_instance* root_movie = 
env.get_target()->get_root_movie();
-               attach_extern_movie(url.str().c_str(), target_movie, 
root_movie);
-       }
-       else
-       {
-               string command = "firefox -remote \"openurl(";
-               command += url.str();
-#if 0 // target testing
-               if ( target_string )
-               {
-                       command += ", " + string(target_string);
-               }
-#endif
-               command += ")\"";
-               dbglogfile << "Launching URL... " << command << endl;
-               system(command.c_str());
-       }
-}
-
-void
-SWFHandlers::ActionGetUrl2(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 2); // target, url
-
-       const action_buffer& code = thread.code;
-
-       assert( code[thread.pc] == SWF::ACTION_GETURL2 );
-
-       uint8_t method = code[thread.pc + 3];
-
-       as_value url_val = env.top(1);
-       if ( url_val.is_undefined() )
-       {
-               log_warning("Undefined GetUrl2 url on stack, skipping");
-       }
-       else
-       {
-               const char* url = url_val.to_string();
-               CommonGetUrl(env, env.top(0), url, method);
-       }
-                 
-       env.drop(2);
-}
-
-void
-SWFHandlers::ActionBranchIfTrue(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       // Alias these
-       as_environment& env = thread.env;
-       const action_buffer& code = thread.code;
-       size_t& pc = thread.pc;
-       size_t& next_pc = thread.next_pc;
-       size_t& stop_pc = thread.stop_pc;
-
-       assert( code[pc] == SWF::ACTION_BRANCHIFTRUE );
-
-       ensure_stack(env, 1); // bool
-
-       int16_t offset = code.read_int16(pc+3);
-
-       bool test = env.pop().to_bool();
-       if (test)
-       {
-               next_pc += offset;
-                     
-               if (next_pc > stop_pc)
-               {
-                       log_error("branch to offset " SIZET_FMT "  -- "
-                               " this section only runs to " SIZET_FMT ". "
-                               " Malformed SWF !.", next_pc, stop_pc);
-               }
-       }
-}
-
-void
-SWFHandlers::ActionCallFrame(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 1); // frame spec
-
-       // Note: no extra data in this instruction!
-       sprite_instance* tgt = env.get_target()->to_movie();
-       assert(tgt);
-       tgt->call_frame_actions(env.top(0));
-       env.drop(1);
-}
-
-void
-SWFHandlers::ActionGotoExpression(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 1); // expression
-
-       const action_buffer& code = thread.code;
-       size_t pc = thread.pc;
-
-    //dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
-
-       // From Alexi's SWF ref:
-       //
-       // Pop a value or a string and jump to the specified
-       // frame. When a string is specified, it can include a
-       // path to a sprite as in:
-       // 
-       //   /Test:55
-       // 
-       // When f_play is ON, the action is to play as soon as
-       // that frame is reached. Otherwise, the
-       // frame is shown in stop mode.
-
-       unsigned char play_flag = code[pc + 3];
-       sprite_instance::play_state state = play_flag ? sprite_instance::PLAY : 
sprite_instance::STOP;
-                 
-       sprite_instance* target = env.get_target()->to_movie();
-       if ( ! target )
-       {
-               log_error("environment target is not a sprite_instance while 
executing ActionGotoExpression");
-               env.drop(1);
-               return;
-       }
-
-       bool success = false;
-                 
-       if (env.top(0).get_type() == as_value::UNDEFINED)
-       {
-               // No-op.
-       }
-       else if (env.top(0).get_type() == as_value::STRING)
-       {
-               // @@ TODO: parse possible sprite path...
-               //
-               // Also, if the frame spec is actually a number (not a label),
-               // then we need to do the conversion...
-                     
-               const char* frame_label = env.top(0).to_string();
-               if (target->goto_labeled_frame(frame_label))
-               {
-                       success = true;
-               }
-               else
-               {
-                       // Couldn't find the label. Try converting to a number.
-                       double num;
-                       if (string_to_number(&num, env.top(0).to_string()))
-                       {
-                               int frame_number = int(num);
-                               target->goto_frame(frame_number);
-                               success = true;
-                       }
-                       // else no-op.
-                     }
-       }
-       else if (env.top(0).get_type() == as_value::OBJECT)
-       {
-               // This is a no-op; see test_goto_frame.swf
-       }
-       else if (env.top(0).get_type() == as_value::NUMBER)
-       {
-               // Frame numbers appear to be 0-based!  @@ Verify.
-               int frame_number = int(env.top(0).to_number());
-               target->goto_frame(frame_number);
-               success = true;
-       }
-                 
-       if (success)
-       {
-               target->set_play_state(state);
-       }
-                 
-       env.drop(1);
-}
-
-void
-SWFHandlers::ActionDeleteVar(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 2); // var, object
-
-       as_value var = env.pop();
-       as_value object = env.top(0);
-       if (object.get_type() == as_value::OBJECT)
-       {
-               as_object* obj = (as_object*) object.to_object();
-               if (obj)
-               {
-                       // set to NaN and eventually release memory
-                       obj->set_member(var.to_tu_string(), as_value());
-
-                       // TODO: remove a member  from object if it there is
-
-                       env.top(0).set_bool(true);
-                       return;
-               }
-       }
-
-       env.top(0).set_bool(false);
-}
-
-void
-SWFHandlers::ActionDelete(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 2); // var
-
-    as_value var = env.top(0);
-
-    std::string varstr(var.to_string());
-    
-    as_value oldval = env.get_variable_raw(varstr);
-    
-    if (!oldval.get_type() == as_value::UNDEFINED) {
-        // set variable to 'undefined'
-        // that hopefully --ref_count and eventually
-        // release memory. 
-        env.set_variable_raw(varstr, as_value());
-        env.top(0).set_bool(true);
-    } else {
-        env.top(0).set_bool(false);
-    }
-}
-
-void
-SWFHandlers::ActionVarEquals(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); // value, var
-
-    as_value value = env.pop();
-    as_value varname = env.pop();
-    env.set_local(varname.to_std_string(), value);
-}
-
-void
-SWFHandlers::ActionCallFunction(ActionExec& thread)
-{
-       //GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 2); // func name, nargs
-
-       //cerr << "At ActionCallFunction enter:"<<endl;
-       //env.dump_stack();
-
-       as_value function;
-       if (env.top(0).get_type() == as_value::STRING)
-       {
-               // Function is a string; lookup the function.
-               const std::string function_name(env.top(0).to_string());
-               function = env.get_variable(function_name);
-               
-               if (function.get_type() != as_value::AS_FUNCTION &&
-                   function.get_type() != as_value::C_FUNCTION)
-               {
-                       IF_VERBOSE_ASCODING_ERRORS(
-                   log_warning("error in call_function: '%s' is not a "
-                               "function", function_name.c_str());
-                       );
-               }
-       }
-       else
-       {
-               // Hopefully the actual
-               // function object is here.
-               // QUESTION: would this be
-               // an ActionScript-defined
-               // function ?
-               function = env.top(0);
-       }
-       int     nargs = (int)env.top(1).to_number();
-
-       ensure_stack(env, 2+nargs); // func name, nargs, args
-
-       //log_msg("Function's nargs: %d", nargs);
-    
-       as_value result = call_method(function, &env, env.get_target(),
-                                 nargs, env.get_top_index() - 2);
-
-       //log_msg("Function's result: %s", result.to_string());
-    
-       env.drop(nargs + 1);
-       env.top(0) = result;
-
-       //cerr << "After ActionCallFunction:"<<endl;
-       //env.dump_stack();
-}
-
-void
-SWFHandlers::ActionReturn(ActionExec& thread)
-{
-       //GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-       as_value* retval = thread.retval;
-
-       //log_msg("Before top/drop (retval=%p)", (void*)retval);
-       //env.dump_stack();
-
-       ensure_stack(env, 1); // ret value
-
-       // Put top of stack in the provided return slot, if
-       // it's not NULL.
-       if (retval) {
-               *retval = env.top(0);
-       }
-       env.drop(1);
-
-       //log_msg("After top/drop");
-       //env.dump_stack();
-    
-       // Skip the rest of this buffer (return from this action_buffer).
-       thread.next_pc = thread.stop_pc;
-
-}
-
-void
-SWFHandlers::ActionModulo(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 2); // x, ,y
-
-    as_value   result;
-    double     y = env.pop().to_number();
-    double     x = env.pop().to_number();
-//  Don't need to check for y being 0 here - if it's zero, fmod returns NaN
-//  which is what flash would do too
-    result = fmod(x, y);
-//  env.top(1).set_double(fmod(env.top(1).to_bool() && env.top(0).to_bool());
-//  env.drop(1);
-//  log_error("modulo x=%f, y=%f, z=%f",x,y,result.to_number());
-    env.push(result);
-}
-
-void
-SWFHandlers::ActionNew(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 2); // classname, nargs
-
-       as_value val = env.pop();
-       std::string classname;
-       if ( val.to_string() ) classname = val.to_string();
-
-       IF_VERBOSE_ACTION (
-               log_action("---new object: %s",
-                       classname.c_str());
-       );
-
-       int     nargs = (int) env.pop().to_number();
-
-       ensure_stack(env, nargs); // previous 2 entries popped
-
-       as_value constructor = env.get_variable(classname);
-
-       as_value new_obj = construct_object(constructor, env, nargs,
-               env.get_top_index());
-
-       env.drop(nargs);
-       env.push(new_obj);
-
-}
-
-void
-SWFHandlers::ActionVar(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 1); // var name
-    std::string varname = env.top(0).to_std_string();
-    env.declare_local(varname);
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionInitArray(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 1); // array size name
-
-    int        array_size = (int) env.pop().to_number();
-    assert(array_size >= 0);
-
-    ensure_stack(env, (unsigned int)array_size); // array elements
-    
-    //log_msg("xxx init array: size = %d, top of stack = %d", array_size, 
env.get_top_index());//xxxxx
-    
-    // Call the array constructor, to create an empty array.
-    as_value   result;
-    array_new(fn_call(&result, NULL, &env, 0, env.get_top_index()));
-    
-    as_object* ao = result.to_object();
-    assert(ao);
-    
-    // Fill the elements with the initial values from the stack.
-    as_value   index_number;
-    for (int i = 0; i < array_size; i++) {
-        // @@ TODO a set_member that takes an int or as_value?
-        index_number.set_int(i);
-        ao->set_member(index_number.to_string(), env.pop());
-    }
-    
-    env.push(result);
-    
-    //log_msg("xxx init array end: top of stack = %d, trace(top(0)) =", 
env.get_top_index());//xxxxxxx
-    
-    //as_global_trace(fn_call(NULL, NULL, env, 1, env.get_top_index()));       
//xxxx
-    
-}
-
-void
-SWFHandlers::ActionInitObject(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 1); // nmembers
-
-    // 
-    //    SWFACTION_PUSH
-    //     [000]   Constant: 1 "obj"
-    //     [001]   Constant: 0 "member" <-- we handle up to here
-    //     [002]   Integer: 1
-    //     [003]   Integer: 1
-    //    SWFACTION_INITOBJECT
-    
-    int nmembers = (int) env.pop().to_number();
-
-    ensure_stack(env, nmembers); // members
-    
-    boost::intrusive_ptr<as_object> 
new_obj_ptr(init_object_instance().release()); 
-    
-    // Set provided members
-    for (int i=0; i<nmembers; ++i) {
-        as_value member_value = env.pop();
-        tu_stringi member_name = env.pop().to_tu_stringi();
-        new_obj_ptr->set_member(member_name, member_value);
-    }
-    
-    // @@ TODO
-    //log_error("checkme opcode: %02X", action_id);
-    
-    as_value new_obj;
-    new_obj.set_as_object(new_obj_ptr.get());
-    
-    //env.drop(nmembers*2);
-    env.push(new_obj); 
-    
-}
-
-void
-SWFHandlers::ActionTypeOf(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 1); 
-
-    switch(env.top(0).get_type()) {
-      case as_value::UNDEFINED:
-          env.top(0).set_string("undefined");
-          break;
-      case as_value::STRING:
-          env.top(0).set_string("string");
-          break;
-      case as_value::NUMBER:
-          env.top(0).set_string("number");
-          break;
-      case as_value::BOOLEAN:
-          env.top(0).set_string("boolean");
-          break;
-      case as_value::OBJECT:
-          env.top(0).set_string("object");
-          break;
-      case as_value::NULLTYPE:
-          env.top(0).set_string("null");
-          break;
-      case as_value::AS_FUNCTION:
-          env.top(0).set_string("function");
-          break;
-      case as_value::C_FUNCTION:
-          env.top(0).set_string("function");
-          break;
-      default:
-          log_error("typeof unknown type: %02X", env.top(0).get_type());
-          env.top(0).set_undefined();
-          break;
-    }
-}
-
-void
-SWFHandlers::ActionTargetPath(ActionExec& /*thread*/)
-{
-//    GNASH_REPORT_FUNCTION;
-//    as_environment& env = thread.env;
-    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
-}
-
-// Push a each object's member value on the stack
-// This is an utility function for use by ActionEnumerate
-// and ActionEnum2. The caller is expected to have
-// already set the top-of-stack to the NULL value (as an optimization)
-static void
-enumerateObject(as_environment& env, const as_object& obj)
-{
-    
-       assert( env.top(0).get_type() == as_value::NULLTYPE );
-       obj.enumerateProperties(env);
-}
-
-void
-SWFHandlers::ActionEnumerate(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 1);  // var_name
-
-       // Get the object
-       as_value& var_name = env.top(0);
-       std::string var_string = var_name.to_std_string();
-       as_value variable = env.get_variable(var_string);
-       const as_object* obj = variable.to_object();
-
-       // The end of the enumeration, don't set top(0) *before*
-       // fetching the as_object* obj above or it will get lost
-       env.top(0).set_null();
-
-       IF_VERBOSE_ACTION (
-       log_action("---enumerate - push: NULL");
-       );
-
-       if ( ! obj )
-       {
-               log_warning("Top of stack not an object (%s) at "
-                       "ActionEnumerate execution",
-                       variable.to_string());
-               return;
-       }
-
-       enumerateObject(env, *obj);
-}
-
-void
-SWFHandlers::ActionNewAdd(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 2); 
-
-    int version = env.get_version();
-    if (env.top(0).get_type() == as_value::STRING
-        || env.top(1).get_type() == as_value::STRING) {
-        env.top(1).convert_to_string_versioned(version);
-        env.top(1).string_concat(env.top(0).to_tu_string_versioned(version));
-    } else {
-        env.top(1) += env.top(0);
-    }
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionNewLessThan(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 2); 
-
-    if (env.top(1).get_type() == as_value::STRING) {
-        env.top(1).set_bool(env.top(1).to_tu_string() < 
env.top(0).to_tu_string());
-    } else {
-        env.top(1).set_bool(env.top(1) < env.top(0));
-    }
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionNewEquals(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    assert(thread.code[thread.pc] == SWF::ACTION_NEWEQUALS);
-
-    ensure_stack(env, 2); 
-
-    /// ECMA-262 abstract equality comparison (sect 11.9.3)
-    env.top(1).set_bool(env.top(1) == env.top(0));
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionToNumber(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 1); 
-    env.top(0).convert_to_number();
-}
-
-void
-SWFHandlers::ActionToString(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 1); 
-    int version = env.get_version();
-    env.top(0).convert_to_string_versioned(version);
-}
-
-void
-SWFHandlers::ActionDup(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 1); 
-    env.push(env.top(0));
-}
-
-void
-SWFHandlers::ActionSwap(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); 
-    as_value   temp = env.top(1);
-    env.top(1) = env.top(0);
-    env.top(0) = temp;
-}
-
-void
-SWFHandlers::ActionGetMember(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 2); // member name, target
-
-    // Some corner case behaviors depend on the SWF file version.
-    int version = env.get_version();
-    
-    as_value member_name = env.top(0);
-    as_value target = env.top(1);
-    
-    as_object* obj = target.to_object();
-    if (!obj) {
-//         IF_VERBOSE_DEBUG(log_msg("getMember called against "
-//                                  "a value that does not cast "
-//                                  "to an as_object: %s", 
target.to_string()));
-        env.top(1).set_undefined();
-        env.drop(1);
-        return;
-    }
-    
-       IF_VERBOSE_ACTION (
-    log_action(" ActionGetMember: target: %s (object %p)",
-               target.to_string(), (void*)obj);
-       );
-    
-    // Special case: String has a member "length"
-    // @@ FIXME: we shouldn't have all this "special" cases --strk;
-    if (target.get_type() == as_value::STRING && member_name.to_tu_stringi() 
== "length") {
-        int len = target.to_tu_string_versioned(version).utf8_length();
-        env.top(1).set_int(len); 
-    } else {
-        if (!obj->get_member(member_name.to_tu_string(), &(env.top(1)))) {
-            env.top(1).set_undefined();
-        }
-        
-       IF_VERBOSE_ACTION (
-        log_action("-- get_member %s=%s",
-                   member_name.to_tu_string().c_str(),
-                   env.top(1).to_tu_string().c_str());
-       );
-    }
-    env.drop(1);
-    
-}
-
-void
-SWFHandlers::ActionSetMember(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 3); // value, member, object
-
-       as_object*      obj = env.top(2).to_object();
-
-
-       if (obj)
-       {
-               obj->set_member(env.top(1).to_tu_string(), env.top(0));
-               IF_VERBOSE_ACTION (
-                       log_action("-- set_member %s.%s=%s",
-                               env.top(2).to_tu_string().c_str(),
-                               env.top(1).to_tu_string().c_str(),
-                               env.top(0).to_tu_string().c_str());
-               );
-       }
-       else
-       {
-               IF_VERBOSE_ACTION (
-                       // Invalid object, can't set.
-                       log_action("-- set_member %s.%s=%s on invalid object!",
-                               env.top(2).to_tu_string().c_str(),
-                               env.top(1).to_tu_string().c_str(),
-                               env.top(0).to_tu_string().c_str());
-               );
-       }
-
-
-       env.drop(3);
-}
-
-void
-SWFHandlers::ActionIncrement(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 1); 
-
-    env.top(0) += 1;
-}
-
-void
-SWFHandlers::ActionDecrement(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 1); 
-    env.top(0) -= 1;
-}
-
-void
-SWFHandlers::ActionCallMethod(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 3);  // method_name, obj, nargs
-
-    as_value result;
-
-    // Some corner case behaviors depend on the SWF file version.
-    //int version = env.get_version();
-
-    // Get name of the method
-    const tu_string &method_name = env.top(0).to_tu_string();
-
-    // Get an object
-    as_value& obj_value = env.top(1);
-    as_object *obj = obj_value.to_object();
-
-    // Get number of arguments
-    int nargs = static_cast<int>(env.top(2).to_number());
-
-    ensure_stack(env, 3+nargs); // actual args
-
-       IF_VERBOSE_ACTION (
-    log_action(" method name: %s", method_name.c_str());
-    log_action(" method object: %p", (void*)obj);
-    log_action(" method nargs: %d", nargs);
-       );
-
-       // for temporarly storing result of automatic
-       // String and Number conversion
-       std::auto_ptr<as_object> obj_ptr;
-
-    if (!obj)
-    {
-       // try automatic casting strings to String objects
-       // and numbers to Number objects
-       // TODO: check if moving this in as_value::to_object()
-       //       would break anything (better to use in head)
-       switch ( obj_value.get_type() )
-       {
-               case as_value::STRING:
-                       obj_ptr = init_string_instance(obj_value.to_string());
-                       obj = obj_ptr.get();
-                       break;
-               case as_value::NUMBER:
-                       obj_ptr = init_number_instance(obj_value.to_number());
-                       obj = obj_ptr.get();
-                       break;
-               default:
-                       break;
-       }
-
-    }
-
-    if (!obj)
-    {
-        IF_VERBOSE_ASCODING_ERRORS(
-          log_warning("call_method invoked in something that "
-            "doesn't cast to an as_object: %s",
-            obj_value.to_string());
-        );
-    }
-    else
-    {
-        as_value method;
-        if (obj->get_member(method_name, &method))
-        {
-          if (method.get_type() != as_value::AS_FUNCTION &&
-              method.get_type() != as_value::C_FUNCTION)
-          {
-              IF_VERBOSE_ASCODING_ERRORS(
-                log_warning("call_method: '%s' is not a method",
-                    method_name.c_str());
-              );
-          }
-          else
-          {
-            result = call_method( method, &env, obj, nargs,
-                env.get_top_index() - 3);
-          }
-        }
-        else
-        {
-            IF_VERBOSE_ASCODING_ERRORS(
-                log_warning("call_method can't find method %s "
-                    "for object %s (%p)", method_name.c_str(), 
-                    typeid(*obj).name(), (void*)obj);
-            );
-        }
-    }
-    
-    env.drop(nargs + 2);
-    env.top(0) = result;
-
-    // This is to check stack status after call method
-    //log_msg("at doActionCallMethod() end, stack: "); env.dump_stack();
-    
-}
-
-void
-SWFHandlers::ActionNewMethod(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-
-       assert( thread.code[thread.pc] == SWF::ACTION_NEWMETHOD );
-
-       ensure_stack(env, 3); // method, object, nargs
-
-       as_value method_name = env.pop().to_string();
-       as_value obj_val = env.pop();
-       int nargs = (int)env.pop().to_number();
-
-       ensure_stack(env, nargs); // previous 3 entries popped
-
-       as_object* obj = obj_val.to_object();
-       if ( ! obj )
-       {
-               // SWF integrity check 
-               log_warning(
-                       "On ActionNewMethod: "
-                       "no object found on stack on ActionMethod");
-               env.drop(nargs);
-               return;
-       }
-
-       as_value method_val;
-       if ( ! obj->get_member(method_name.to_tu_stringi(), &method_val) )
-       {
-               // SWF integrity check 
-               log_warning(
-                       "On ActionNewMethod: "
-                       "can't find method %s of object %s",
-                       method_name.to_string(), obj_val.to_string());
-               env.drop(nargs);
-               return;
-       }
-
-       // Construct the object
-       as_value new_obj = construct_object(method_val, env, nargs,
-                       env.get_top_index());
-
-       log_msg("%s.%s( [%d args] ) returned %s", obj_val.to_string(),
-               method_name.to_string(), nargs, new_obj.to_string());
-
-
-       env.drop(nargs);
-       env.push(new_obj);
-
-}
-
-void
-SWFHandlers::ActionInstanceOf(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-
-    ensure_stack(env, 2); // super, instance
-
-    // Get the "super" function
-    as_function* super = env.top(0).to_as_function();
-
-    // Get the "instance" 
-    as_object* instance = env.top(1).to_object();
-
-    // Invalid args!
-    if (!super || ! instance) {
-        IF_VERBOSE_ACTION(
-        log_action("-- %s instance_of %s (invalid args?)",
-                env.top(1).to_string(),
-                env.top(0).to_string());
-        );
-
-        env.drop(1);
-        env.top(0) = as_value(false); 
-        return;
-    }
-
-    env.drop(1);
-    env.top(0) = as_value(instance->instanceOf(super));
-}
-
-void
-SWFHandlers::ActionEnum2(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 1); // object
-
-       // Get the object.
-       // Copy it so we can override env.top(0)
-       as_value obj_val = env.top(0);
-
-       // End of the enumeration. Won't override the object
-       // as we copied that as_value.
-       env.top(0).set_null(); 
-
-       as_object* obj = obj_val.to_object();
-       if ( ! obj )
-       {
-               log_warning("Top of stack not an object (%s) at ActionEnum2 "
-                       " execution",
-                       obj_val.to_string());
-               return;
-       }
-
-       enumerateObject(env, *obj);
-
-       dbglogfile << __PRETTY_FUNCTION__ << ": testing" << endl;
-}
-
-void
-SWFHandlers::ActionBitwiseAnd(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); 
-    env.top(1) &= env.top(0);
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionBitwiseOr(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); 
-    env.top(1) |= env.top(0);
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionBitwiseXor(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); 
-    env.top(1) ^= env.top(0);
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionShiftLeft(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); 
-    env.top(1).asr(env.top(0));
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionShiftRight(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); 
-    env.top(1).lsr(env.top(0));
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionShiftRight2(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); 
-    env.top(1).lsr(env.top(0));
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionStrictEq(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); 
-    if (env.top(1).get_type() != env.top(0).get_type()) {
-        // Types don't match.
-        env.top(1).set_bool(false);
-        env.drop(1);
-    } else {
-        env.top(1).set_bool(env.top(1) == env.top(0));
-        env.drop(1);
-    }
-}
-
-void
-SWFHandlers::ActionGreater(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); 
-    if (env.top(1).get_type() == as_value::STRING) {
-        env.top(1).set_bool(env.top(1).to_tu_string() > 
env.top(0).to_tu_string());
-    } else {
-        env.top(1).set_bool(env.top(1).to_number() > env.top(0).to_number());
-    }
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionStringGreater(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-    as_environment& env = thread.env;
-    ensure_stack(env, 2); 
-    env.top(1).set_bool(env.top(1).to_tu_string() > env.top(0).to_tu_string());
-    env.drop(1);
-}
-
-void
-SWFHandlers::ActionExtends(ActionExec& /*thread*/)
-{
-//    GNASH_REPORT_FUNCTION;
-    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
-}
-
-void
-SWFHandlers::ActionConstantPool(ActionExec& thread)
-{
-//    GNASH_REPORT_FUNCTION;
-       thread.code.process_decl_dict(thread.pc, thread.next_pc);
-}
-
-void
-SWFHandlers::ActionDefineFunction2(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-       const action_buffer& code = thread.code;
-
-       // Code starts at thread.next_pc as the DefineFunction tag
-       // 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.getWithStack());
-
-       func->set_is_function2();
-
-       size_t i = thread.pc + 3; // skip tag id and length
-
-       // Extract name.
-       // @@ security: watch out for possible missing terminator here!
-       std::string name = code.read_string(i);
-       i += name.length() + 1; // add NULL-termination
-
-       //cerr << " name:" << name << endl;
-
-       // Get number of arguments.
-       int nargs = code.read_int16(i);
-       i += 2;
-
-       //cerr << " nargs:" << nargs << endl;
-
-       // Get the count of local registers used by this function.
-       uint8 register_count = code[i];
-       i++;
-
-       //cerr << " nregisters:" << nargs << endl;
-
-       func->set_local_register_count(register_count);
-
-       // Flags, for controlling register assignment of implicit args.
-       uint16  flags = code.read_int16(i);
-       i += 2;
-
-       func->set_function2_flags(flags);
-
-       // Get the register assignments and names of the arguments.
-       for (int n = 0; n < nargs; n++)
-       {
-               uint8 arg_register = code[i];
-               ++i;
-       
-               // @@ security: watch out for possible missing terminator here!
-               const char* arg = code.read_string(i);
-
-               //log_msg("Setting register %d/%d to %s", arg_register, nargs, 
arg);
-
-               func->add_arg(arg_register, arg);
-               i += strlen(arg)+1;
-       }
-
-       // Get the length of the actual function code.
-       int16_t code_size = code.read_int16(i);
-       assert( code_size >= 0 );
-       i += 2;
-       func->set_length(code_size);
-
-       // Skip the function body (don't interpret it now).
-       thread.next_pc += code_size; 
-
-       // If we have a name, then save the function in this
-       // environment under that name.
-       as_value function_value(func);
-       if (name.length() > 0)
-       {
-               // @@ NOTE: should this be m_target->set_variable()???
-               env.set_member(name, function_value);
-       }
-    
-       // Also leave it on the stack.
-       env.push_val(function_value);
-}
-
-void
-SWFHandlers::ActionTry(ActionExec& /*thread*/)
-{
-//    GNASH_REPORT_FUNCTION;
-    dbglogfile << __PRETTY_FUNCTION__ << ": unimplemented!" << endl;
-}
-
-/// See: http://sswf.sourceforge.net/SWFalexref.html#action_with
-void
-SWFHandlers::ActionWith(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_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());
-       );
-
-       ++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;
-       }
-
-}
-
-void
-SWFHandlers::ActionDefineFunction(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-       const action_buffer& code = thread.code;
-
-       int16_t length = code.read_int16(thread.pc+1);
-       assert( length >= 0 );
-
-       //cerr << " length:" << length << endl;
-
-       // Create a new swf_function
-       // Code starts at thread.next_pc as the DefineFunction tag
-       // 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.getWithStack());
-
-       size_t i = thread.pc + 3;
-
-       // Extract name.
-       // @@ security: watch out for possible missing terminator here!
-       std::string name = code.read_string(i);
-       i += name.length() + 1;
-
-       //cerr << " name:" << name << endl;
-
-       // Get number of arguments.
-       int nargs = code.read_int16(i);
-       i += 2;
-
-       //cerr << " nargs:" << nargs << endl;
-
-       // Get the names of the arguments.
-       for (int n = 0; n < nargs; n++)
-       {
-               const char* arg = code.read_string(i);
-               //cerr << " arg" << n << " : " << arg << endl;
-
-               // @@ security: watch out for possible missing terminator here!
-               func->add_arg(0, arg);
-               // wouldn't it be simpler to use strlen(arg)+1 ?
-               i += strlen(arg)+1; // func->m_args.back().m_name.length() + 1;
-       }
-
-       // Get the length of the actual function code.
-       int16_t code_size = code.read_int16(i);
-
-       //cerr << " code size:" << code_size << endl;
-
-       func->set_length(code_size);
-
-    
-       // Skip the function body (don't interpret it now).
-       // next_pc is assumed to point to first action of
-       // the function body (one-past the current tag, whic
-       // is DefineFunction). We add code_size to it.
-       thread.next_pc += code_size;
-
-       // If we have a name, then save the function in this
-       // environment under that name.
-       as_value        function_value(func);
-       if (name.length() > 0)
-       {
-               // @@ NOTE: should this be m_target->set_variable()???
-               env.set_member(name, function_value);
-       }
-    
-       // Also leave it on the stack.
-       env.push_val(function_value);
-
-       //cerr << "After ActionDefineFunction:"<<endl;
-       //env.dump_stack();
-}
-
-void
-SWFHandlers::ActionSetRegister(ActionExec& thread)
-{
-//     GNASH_REPORT_FUNCTION;
-
-       as_environment& env = thread.env;
-
-       ensure_stack(env, 1); 
-
-       const action_buffer& code = thread.code;
-
-       uint8_t reg = code[thread.pc + 3];
-
-       // Save top of stack in specified register.
-       if ( thread.isFunction2() )
-       {
-               env.local_register(reg) = env.top(0);
-                     
-               IF_VERBOSE_ACTION (
-               log_action("-------------- local register[%d] = '%s'",
-                       reg, env.top(0).to_string());
-               );
-
-       }
-       else if (reg < 4)
-       {
-               env.global_register(reg) = env.top(0);
-                     
-               IF_VERBOSE_ACTION (
-               log_action("-------------- global register[%d] = '%s'",
-                       reg, env.top(0).to_string() );
-               );
-
-       }
-       else
-       {
-               log_error("store_register[%d] -- register out of bounds!",
-                       reg);
-       }
-                 
-}
-
-const char*
-SWFHandlers::action_name(action_type x) const
-{
-       if ( static_cast<size_t>(x) > get_handlers().size() )
-       {
-               log_error("at SWFHandlers::action_name(%d) call time, _handlers 
size is " 
-                         SIZET_FMT, x, get_handlers().size());
-               return NULL;
-       }
-       else
-       {
-               return get_handlers()[x].getName().c_str();
-       }
-}
-
-/*static private*/
-void
-SWFHandlers::fix_stack_underrun(as_environment& env, size_t required)
-{
-    assert ( env.stack_size() < required );
-
-    size_t missing = required-env.stack_size();
-
-    log_error("Stack underrun: " SIZET_FMT " elements required, " SIZET_FMT 
-        " available. Fixing by pushing " SIZET_FMT " undefined values on the"
-       " missing slots.", required, env.stack_size(), missing);
-
-    for (size_t i=0; i<missing; ++i)
-    {
-        env.push(as_value());
-    }
-}
-
-} // namespace gnash::SWF
-
-} // namespace gnash

Index: server/swf/ASHandlers.h
===================================================================
RCS file: server/swf/ASHandlers.h
diff -N server/swf/ASHandlers.h
--- server/swf/ASHandlers.h     29 Oct 2006 18:34:16 -0000      1.10
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,277 +0,0 @@
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-// 
-//
-
-#ifndef __ASHANDLERS_H__
-#define __ASHANDLERS_H__
-
-#include <string>
-#include <map>
-#include <vector>
-#include "action.h" // we should get rid of this probably
-#include "as_environment.h" // for ensure_stack inline (must be inlined!)
-#include "swf.h"
-
-
-// Forward declarations
-namespace gnash {
-       class ActionExec;
-}
-
-namespace gnash {
-
-/// SWF format parsing classes
-namespace SWF { // gnash::SWF
-
-typedef enum {
-    ARG_NONE = 0,
-    ARG_STR,
-    // default hex dump, in case the format is unknown or unsupported
-    ARG_HEX,
-    ARG_U8,
-    ARG_U16,
-    ARG_S16,
-    ARG_PUSH_DATA,
-    ARG_DECL_DICT,
-    ARG_FUNCTION2
-} as_arg_t;
-
-// @@strk@@ should we move this to .cpp file ? it's only
-// use is within SWFHandlers, anyway...
-typedef void (*action_callback_t)(ActionExec& thread);
-//as_environment &env, action_buffer& code, size_t& PC);
-class ActionHandler
-{
-public:
-    ActionHandler();
-    ActionHandler(action_type type, action_callback_t func);
-    ActionHandler(action_type type, std::string name, 
-                  action_callback_t func);
-    ActionHandler(action_type type, std::string name, 
-                  action_callback_t func, as_arg_t format);
-    ActionHandler(action_type type, std::string name, 
-                  action_callback_t func, as_arg_t format, int nargs);
-    ~ActionHandler();
-
-    /// Execute the action
-    void execute(ActionExec& thread) const;
-
-    void toggleDebug(bool state) const { _debug = state; }
-    action_type getType()   const { return _type; }
-    std::string getName()   const { return _name; }
-    int getNumArgs()        const { return _stack_args; }
-    as_arg_t getArgFormat() const { return _arg_format; }
-private:
-    action_type       _type;
-    std::string       _name;
-    action_callback_t _callback;
-    mutable bool      _debug;
-    int               _stack_args; // the number of args to pop from the stack
-    as_arg_t          _arg_format;
-};
-
-/// A singleton containing the supported SWF Action handlers.
-class SWFHandlers
-{
-public:
-
-       /// TODO: use a vector as we can have at most 254 actions
-       /// (127 w/out length, 127 with length, the high bit is
-       ///  used to distinguish the two types)
-       //typedef std::map<action_type, ActionHandler> container_type;
-
-       // Indexed by action id
-       typedef std::vector<ActionHandler> container_type;
-
-       /// Return the singleton instance of SWFHandlers class
-       static const SWFHandlers& instance();
-
-       /// Execute the action identified by 'type' action type
-       void execute(action_type type, ActionExec& thread) const;
-
-       void toggleDebug(bool state) { _debug = state; }
-
-       size_t size() const { return get_handlers().size(); }
-
-       action_type lastType() const
-       {
-               return ACTION_GOTOEXPRESSION;
-               //return _handlers[ACTION_GOTOEXPRESSION].getType();
-       }
-
-       const ActionHandler &operator[] (action_type x) const
-       {
-               //return const_cast<ActionHandler>(_handlers[x]);
-               return get_handlers()[x];
-       }
-
-       const char* action_name(action_type x) const;
-
-private:
-
-       static container_type & get_handlers();
-       static std::vector<std::string> & get_property_names();
-
-       // Ensure the stack has at least 'required' elements, fixing
-       // it if required.
-       // This is an inline to it can eventually be made a no-op
-       // when gnash works and input SWFs are known to be valid.
-       static void ensure_stack(as_environment& env, size_t required)
-       {
-               if ( env.stack_size() < required )
-               {
-                       fix_stack_underrun(env, required);
-               }
-       }
-
-       // Fill all the slots to reach the 'required' stack size
-       // with undefined values. This method should *only* be
-       // called by ensure_stack() above.
-       static void fix_stack_underrun(as_environment& env, size_t required);
-
-       /// Common code for ActionGetUrl and ActionGetUrl2
-       //
-       /// @see http://sswf.sourceforge.net/SWFalexref.html#action_get_url2
-       /// @see http://sswf.sourceforge.net/SWFalexref.html#action_get_url
-       ///
-       /// @param target
-       ///     the target window or _level1 to _level10
-       ///
-       /// @param method
-       ///     0:NONE, 1:GET, 2:POST
-       ///
-       static void CommonGetUrl(as_environment& env, 
-                       as_value target, const char* url,
-                       uint8_t method);
-
-       static void ActionEnd(ActionExec& thread);
-       static void ActionNextFrame(ActionExec& thread);
-       static void ActionPrevFrame(ActionExec& thread);
-       static void ActionPlay(ActionExec& thread);
-       static void ActionStop(ActionExec& thread);
-       static void ActionToggleQuality(ActionExec& thread);
-       static void ActionStopSounds(ActionExec& thread);
-       static void ActionGotoFrame(ActionExec& thread);
-       static void ActionGetUrl(ActionExec& thread);
-       static void ActionWaitForFrame(ActionExec& thread);
-       static void ActionSetTarget(ActionExec& thread);
-       static void ActionGotoLabel(ActionExec& thread);
-       static void ActionAdd(ActionExec& thread);
-       static void ActionSubtract(ActionExec& thread);
-       static void ActionMultiply(ActionExec& thread);
-       static void ActionDivide(ActionExec& thread);
-       static void ActionEqual(ActionExec& thread);
-       static void ActionLessThan(ActionExec& thread);
-       static void ActionLogicalAnd(ActionExec& thread);
-       static void ActionLogicalOr(ActionExec& thread);
-       static void ActionLogicalNot(ActionExec& thread);
-       static void ActionStringEq(ActionExec& thread);
-       static void ActionStringLength(ActionExec& thread);
-       static void ActionSubString(ActionExec& thread);
-       static void ActionPop(ActionExec& thread);
-       static void ActionInt(ActionExec& thread);
-       static void ActionGetVariable(ActionExec& thread);
-       static void ActionSetVariable(ActionExec& thread);
-       static void ActionSetTargetExpression(ActionExec& thread);
-       static void ActionStringConcat(ActionExec& thread);
-       static void ActionGetProperty(ActionExec& thread);
-       static void ActionSetProperty(ActionExec& thread);
-       static void ActionDuplicateClip(ActionExec& thread);
-       static void ActionRemoveClip(ActionExec& thread);
-       static void ActionTrace(ActionExec& thread);
-       static void ActionStartDragMovie(ActionExec& thread);
-       static void ActionStopDragMovie(ActionExec& thread);
-       static void ActionStringCompare(ActionExec& thread);
-       static void ActionThrow(ActionExec& thread);
-       static void ActionCastOp(ActionExec& thread);
-       static void ActionImplementsOp(ActionExec& thread);
-       static void ActionRandom(ActionExec& thread);
-       static void ActionMbLength(ActionExec& thread);
-       static void ActionOrd(ActionExec& thread);
-       static void ActionChr(ActionExec& thread);
-       static void ActionGetTimer(ActionExec& thread);
-       static void ActionMbSubString(ActionExec& thread);
-       static void ActionMbOrd(ActionExec& thread);
-       static void ActionMbChr(ActionExec& thread);
-       static void ActionWaitForFrameExpression(ActionExec& thread);
-       static void ActionPushData(ActionExec& thread);
-       static void ActionBranchAlways(ActionExec& thread);
-       static void ActionGetUrl2(ActionExec& thread);
-       static void ActionBranchIfTrue(ActionExec& thread);
-       static void ActionCallFrame(ActionExec& thread);
-       static void ActionGotoExpression(ActionExec& thread);
-       static void ActionDeleteVar(ActionExec& thread);
-       static void ActionDelete(ActionExec& thread);
-       static void ActionVarEquals(ActionExec& thread);
-       static void ActionCallFunction(ActionExec& thread);
-       static void ActionReturn(ActionExec& thread);
-       static void ActionModulo(ActionExec& thread);
-       static void ActionNew(ActionExec& thread);
-       static void ActionVar(ActionExec& thread);
-       static void ActionInitArray(ActionExec& thread);
-       static void ActionInitObject(ActionExec& thread);
-       static void ActionTypeOf(ActionExec& thread);
-       static void ActionTargetPath(ActionExec& thread);
-       static void ActionEnumerate(ActionExec& thread);
-       static void ActionNewAdd(ActionExec& thread);
-       static void ActionNewLessThan(ActionExec& thread);
-       static void ActionNewEquals(ActionExec& thread);
-       static void ActionToNumber(ActionExec& thread);
-       static void ActionToString(ActionExec& thread);
-       static void ActionDup(ActionExec& thread);
-       static void ActionSwap(ActionExec& thread);
-       static void ActionGetMember(ActionExec& thread);
-       static void ActionSetMember(ActionExec& thread);
-       static void ActionIncrement(ActionExec& thread);
-       static void ActionDecrement(ActionExec& thread);
-       static void ActionCallMethod(ActionExec& thread);
-       static void ActionNewMethod(ActionExec& thread);
-       static void ActionInstanceOf(ActionExec& thread);
-       static void ActionEnum2(ActionExec& thread);
-       static void ActionBitwiseAnd(ActionExec& thread);
-       static void ActionBitwiseOr(ActionExec& thread);
-       static void ActionBitwiseXor(ActionExec& thread);
-       static void ActionShiftLeft(ActionExec& thread);
-       static void ActionShiftRight(ActionExec& thread);
-       static void ActionShiftRight2(ActionExec& thread);
-       static void ActionStrictEq(ActionExec& thread);
-       static void ActionGreater(ActionExec& thread);
-       static void ActionStringGreater(ActionExec& thread);
-       static void ActionExtends(ActionExec& thread);
-       static void ActionConstantPool(ActionExec& thread);
-       static void ActionDefineFunction2(ActionExec& thread);
-       static void ActionTry(ActionExec& thread);
-       static void ActionWith(ActionExec& thread);
-       static void ActionDefineFunction(ActionExec& thread);
-       static void ActionSetRegister(ActionExec& thread);
-
-       bool _debug;
-
-       // Use the ::instance() method to get a reference
-       SWFHandlers();
-
-       // You won't destroy a singleton
-       ~SWFHandlers();
-
-};
-
-
-} // namespace gnash::SWF
-
-} // namespace gnash
-
-#endif // end of __ASHANDLERS_H__




reply via email to

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