gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10483: Header cleanups, mantainabil


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10483: Header cleanups, mantainability improvements, move Array AS class where it
Date: Mon, 29 Dec 2008 11:00:44 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10483
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2008-12-29 11:00:44 +0100
message:
  Header cleanups, mantainability improvements, move Array AS class where it
  really belongs.
renamed:
  libcore/array.cpp => libcore/asobj/Array_as.cpp
  libcore/array.h => libcore/asobj/Array_as.h
modified:
  extensions/fileio/fileio.cpp
  extensions/mysql/mysql_db.cpp
  gui/gnash.cpp
  libcore/Button.cpp
  libcore/Makefile.am
  libcore/MovieClip.cpp
  libcore/TextField.cpp
  libcore/as_function.cpp
  libcore/as_object.cpp
  libcore/as_object.h
  libcore/as_value.cpp
  libcore/asobj/AsBroadcaster.cpp
  libcore/asobj/ClassHierarchy.cpp
  libcore/asobj/Global.cpp
  libcore/asobj/Key_as.cpp
  libcore/asobj/Key_as.h
  libcore/asobj/LoadVars_as.cpp
  libcore/asobj/LoadableObject.cpp
  libcore/asobj/Makefile.am
  libcore/asobj/MovieClipLoader.cpp
  libcore/asobj/Selection_as.cpp
  libcore/asobj/String_as.cpp
  libcore/asobj/XMLNode_as.cpp
  libcore/asobj/XML_as.cpp
  libcore/character.cpp
  libcore/event_id.h
  libcore/movie_root.cpp
  libcore/swf/DefineButtonTag.cpp
  libcore/swf_function.cpp
  libcore/vm/ASHandlers.cpp
  libcore/vm/Machine.cpp
  libcore/vm/action.cpp
  libmedia/FLVParser.cpp
  libcore/asobj/Array_as.cpp
  libcore/asobj/Array_as.h
    ------------------------------------------------------------
    revno: 10482.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Sat 2008-12-27 19:51:27 +0100
    message:
      Don't include array.h in FLVParser.
    modified:
      libmedia/FLVParser.cpp
    ------------------------------------------------------------
    revno: 10482.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Sat 2008-12-27 20:02:45 +0100
    message:
      Don't use namespace std.
    modified:
      libmedia/FLVParser.cpp
    ------------------------------------------------------------
    revno: 10482.1.3
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Sat 2008-12-27 20:56:32 +0100
    message:
      Move array.{h,cpp} to libcore/asobj/Array_as.{h,cpp} so it can be with
      its friends.
    renamed:
      libcore/array.cpp => libcore/asobj/Array_as.cpp
      libcore/array.h => libcore/asobj/Array_as.h
    modified:
      extensions/fileio/fileio.cpp
      extensions/mysql/mysql_db.cpp
      libcore/Makefile.am
      libcore/TextField.cpp
      libcore/as_function.cpp
      libcore/as_object.cpp
      libcore/as_value.cpp
      libcore/asobj/AsBroadcaster.cpp
      libcore/asobj/ClassHierarchy.cpp
      libcore/asobj/Global.cpp
      libcore/asobj/LoadVars_as.cpp
      libcore/asobj/LoadableObject.cpp
      libcore/asobj/Makefile.am
      libcore/asobj/MovieClipLoader.cpp
      libcore/asobj/Selection_as.cpp
      libcore/asobj/String_as.cpp
      libcore/asobj/XMLNode_as.cpp
      libcore/asobj/XML_as.cpp
      libcore/swf_function.cpp
      libcore/vm/ASHandlers.cpp
      libcore/vm/Machine.cpp
      libcore/asobj/Array_as.cpp
      libcore/asobj/Array_as.h
    ------------------------------------------------------------
    revno: 10482.1.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Sat 2008-12-27 21:14:08 +0100
    message:
      Use a map for event_id<-->function name and event_id<-->function key so
      that it doesn't tend to break every time something changes.
    modified:
      libcore/vm/action.cpp
    ------------------------------------------------------------
    revno: 10482.1.5
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Sun 2008-12-28 10:40:28 +0100
    message:
      Rename event_id functions, provide read-only accessors and make data
      members private. Other minor refactoring.
    modified:
      gui/gnash.cpp
      libcore/Button.cpp
      libcore/MovieClip.cpp
      libcore/TextField.cpp
      libcore/as_object.cpp
      libcore/as_object.h
      libcore/asobj/Key_as.cpp
      libcore/asobj/Key_as.h
      libcore/character.cpp
      libcore/event_id.h
      libcore/movie_root.cpp
      libcore/vm/action.cpp
    ------------------------------------------------------------
    revno: 10482.1.6
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Sun 2008-12-28 11:01:13 +0100
    message:
      Update event_id callers.
    modified:
      libcore/Button.cpp
      libcore/MovieClip.cpp
      libcore/swf/DefineButtonTag.cpp
=== modified file 'extensions/fileio/fileio.cpp'
--- a/extensions/fileio/fileio.cpp      2008-11-21 15:15:25 +0000
+++ b/extensions/fileio/fileio.cpp      2008-12-27 19:56:32 +0000
@@ -35,7 +35,7 @@
 #include "as_object.h"
 #include "builtin_function.h" // need builtin_function
 #include "fileio.h"
-#include "array.h"  // used by scandir()
+#include "Array_as.h"  // used by scandir()
 
 using namespace std;
 

=== modified file 'extensions/mysql/mysql_db.cpp'
--- a/extensions/mysql/mysql_db.cpp     2008-09-17 17:12:54 +0000
+++ b/extensions/mysql/mysql_db.cpp     2008-12-27 19:56:32 +0000
@@ -28,7 +28,7 @@
 #include <vector>
 
 #include "log.h"
-#include "array.h"
+#include "Array_as.h"
 #include "as_value.h"
 #include "fn_call.h"
 #include "mysql_db.h"

=== modified file 'gui/gnash.cpp'
--- a/gui/gnash.cpp     2008-10-29 09:40:07 +0000
+++ b/gui/gnash.cpp     2008-12-28 09:40:28 +0000
@@ -64,8 +64,6 @@
 
 #include <boost/format.hpp> // For i18n-friendly cerr
 
-using namespace gnash; // for log_*
-
 using std::cerr;
 using std::endl;
 using std::cout;
@@ -81,8 +79,6 @@
 #endif
 }
 
-//extern bool g_debug;
-
 static void
 usage()
 {
@@ -154,11 +150,11 @@
 {
     cout << "Gnash " << VERSION << endl
         << endl
-        << _("Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, 
Inc.\n"
-        "Gnash comes with NO WARRANTY, to the extent permitted by law.\n"
-        "You may redistribute copies of Gnash under the terms of the GNU 
General\n"
-        "Public License.  For more information, see the file named COPYING.\n")
-    << endl;
+        << _("Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, "
+                "Inc.\nGnash comes with NO WARRANTY, to the extent permitted "
+                "by law.\nYou may redistribute copies of Gnash under the "
+                "terms of the GNU General\nPublic License.  For more "
+                "information, see the file named COPYING.\n") << endl;
 }
 
 static void build_options()
@@ -248,26 +244,26 @@
                 case 'v':
                     dbglogfile.setVerbosity();
                     // This happens once per 'v' flag 
-                    log_debug(_("Verbose output turned on"));
+                    gnash::log_debug(_("Verbose output turned on"));
                     break;
                 case 'V':
                     version_and_copyright();
                     build_options();
                     exit(EXIT_SUCCESS);          
                 case 'w':
-                    rcfile.useWriteLog(true); // dbglogfile.setWriteDisk(true);
-                    log_debug(_("Logging to disk enabled"));
+                    rcfile.useWriteLog(true); 
+                    gnash::log_debug(_("Logging to disk enabled"));
                     break;
                 case 'a':
 #if VERBOSE_ACTION
-                    dbglogfile.setActionDump(true); 
//gnash::set_verbose_action(true);
+                    dbglogfile.setActionDump(true); 
 #else
                     log_error(_("No verbose actions; disabled at compile 
time"));
 #endif
                     break;
                 case 'p':
 #if VERBOSE_PARSE
-                    dbglogfile.setParserDump(true); // 
gnash::set_verbose_parse(true);
+                    dbglogfile.setParserDump(true); 
 #else
                     log_error (_("No verbose parsing; disabled at compile 
time"));
 #endif
@@ -279,7 +275,7 @@
                     player.setStartFullscreen(true);
                     break;                    
                 case 's':
-                    player.setScale(utility::clamp<float>(
+                    player.setScale(gnash::utility::clamp<float>(
                                     parser.argument<float>(i),
                                     0.01f, 100.f));
                     break;
@@ -288,18 +284,21 @@
                     break;
                 case 'u':
                     url = parser.argument(i);
-                    log_debug (_("Setting root URL to %s"), url.c_str());
+                    gnash::log_debug (_("Setting root URL to %s"), 
url.c_str());
                     break;
-                case 'U':    // Set base URL
+                case 'U':    
+                    // Set base URL
                     player.setBaseUrl(parser.argument(i));
-                    log_debug (_("Setting base URL to %s"), 
parser.argument(i));
+                    gnash::log_debug (_("Setting base URL to %s"),
+                            parser.argument(i));
                     break;
                 case 'F':
                 {
                     int fd = parser.argument<long>(i);
                     if ( fd < 1 )
                     {
-                        cerr << boost::format(_("Invalid host communication 
filedescriptor %d\n")) % fd << endl;
+                        cerr << boost::format(_("Invalid host communication "
+                                    "filedescriptor %d\n")) % fd << endl;
                         exit(EXIT_FAILURE);
                     }
                     player.setHostFD ( fd );
@@ -307,24 +306,27 @@
                 }
                 case 'j':
                     widthGiven = true;
-                    player.setWidth ( parser.argument<long>(i));
-                    log_debug (_("Setting width to %d"), player.getWidth());
+                    player.setWidth(parser.argument<long>(i));
+                    gnash::log_debug(_("Setting width to %d"),
+                            player.getWidth());
                     break;
                 case 'g':
 #ifdef USE_DEBUGGER
-                    log_debug (_("Setting debugger ON"));
+                    gnash::log_debug(_("Setting debugger ON"));
                     debugger.enabled(true);
     //              debugger.startServer(&debugger);
                     debugger.console();
 #else
-                    log_error (_("No debugger; disabled at compile time, -g is 
invalid"));
+                    gnash::log_error(_("No debugger; disabled at compile time, 
-g "
+                                "is invalid"));
                     exit(EXIT_FAILURE);
 #endif
                     break;
                 case 'k':
                     heightGiven = true;
                     player.setHeight ( parser.argument<long>(i));
-                    log_debug (_("Setting height to %d"), player.getHeight());
+                    gnash::log_debug(_("Setting height to %d"),
+                            player.getHeight());
                     break;
                 case 'x':
                     plugin = true;
@@ -358,7 +360,8 @@
                             player.setDoSound(true);
                             break;
                         default:
-                            log_error(_("ERROR: -r must be followed by 0, 1, 2 
or 3 "));
+                            gnash::log_error(_("ERROR: -r must be followed by "
+                                        "0, 1, 2 or 3 "));
                             break;
                     }
                     break;
@@ -369,7 +372,8 @@
 #ifdef GNASH_FPS_DEBUG
                     player.setFpsPrintTime(parser.argument<float>(i));
 #else
-                    cout << _("FPS debugging disabled at compile time, -f is 
invalid") << endl;
+                    cout << _("FPS debugging disabled at compile time, -f "
+                            "is invalid") << endl;
                     exit(EXIT_FAILURE);
 #endif // ndef GNASH_FPS_DEBUG
                     break;
@@ -404,13 +408,14 @@
         }
         catch (Arg_parser::ArgParserException &e)
         {
-            cerr << _("Error parsing command line options: ") << e.what() << 
endl;
+            cerr << _("Error parsing command line options: ") << e.what() 
+                << endl;
             cerr << _("This is a Gnash bug.") << endl;
         }
     }
 
     if ( ! renderflag ) {
-        log_debug (_("No rendering flags specified, using rcfile"));
+        gnash::log_debug (_("No rendering flags specified, using rcfile"));
         if ( plugin ) {
             player.setDoSound( rcfile.usePluginSound() );
         } else {
@@ -427,9 +432,11 @@
 
 }
 
+
 int
 gnash_main(int argc, char *argv[])
 {
+
     gnash::Player player;
 
     // Enable native language support, i.e. internationalization
@@ -438,16 +445,15 @@
     bindtextdomain (PACKAGE, LOCALEDIR);
     textdomain (PACKAGE);
 #endif
-    //rcfile.loadFiles();
 
-    try { parseCommandLine(argc, argv, player); }
-    catch (const std::exception& ex)
-    {
+    try { 
+        parseCommandLine(argc, argv, player);
+    }
+    catch (const std::exception& ex) {
         cerr << ex.what() << endl;
         return EXIT_FAILURE;
     }
-    catch (...)
-    {
+    catch (...) {
         cerr << _("Exception thrown during parseCommandLine") << endl;
         return EXIT_FAILURE;
     }
@@ -459,5 +465,5 @@
         return EXIT_FAILURE;
     }
 
-    return player.run(argc, argv, infiles.front().c_str(), url.c_str());
+    return player.run(argc, argv, infiles.front(), url);
 }

=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp        2008-12-17 18:14:05 +0000
+++ b/libcore/Button.cpp        2008-12-28 10:01:13 +0000
@@ -344,10 +344,10 @@
     }
 
     // We only respond keypress events
-    if ( id.m_id != event_id::KEY_PRESS ) return false;
+    if ( id.id() != event_id::KEY_PRESS ) return false;
 
     // We only respond to valid key code (should we assert here?)
-    if ( id.keyCode == key::INVALID ) return false;
+    if ( id.keyCode() == key::INVALID ) return false;
 
     ButtonActionPusher xec(getVM().getRoot(), this); 
     _def.forEachTrigger(id, xec);
@@ -465,7 +465,7 @@
     MouseState new_state = m_mouse_state;
   
     // Set our mouse state (so we know how to render).
-    switch (event.m_id)
+    switch (event.id())
     {
         case event_id::ROLL_OUT:
         case event_id::RELEASE_OUTSIDE:
@@ -504,7 +504,7 @@
 
         int bi; // button sound array index [0..3]
 
-        switch (event.m_id)
+        switch (event.id())
         {
             case event_id::ROLL_OUT:
                 bi = 0;
@@ -582,7 +582,7 @@
 
     // Call conventional attached method.
     boost::intrusive_ptr<as_function> method =
-        getUserDefinedEventHandler(event.get_function_key());
+        getUserDefinedEventHandler(event.functionKey());
     if ( method )
     {
         mr.pushAction(method, this, movie_root::apDOACTION);

=== modified file 'libcore/Makefile.am'
--- a/libcore/Makefile.am       2008-12-16 18:44:10 +0000
+++ b/libcore/Makefile.am       2008-12-27 19:56:32 +0000
@@ -104,7 +104,6 @@
        swf_function.cpp \
        Video.cpp \
        StreamProvider.cpp \
-       array.cpp \
        Button.cpp \
        DisplayList.cpp \
        fill_style.cpp \
@@ -131,7 +130,6 @@
        SystemClock.h \
        ManualClock.h \
        RunInfo.h \
-       array.h \
        as_environment.h \
        as_function.h \
        as_object.h \

=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp     2008-12-17 07:29:09 +0000
+++ b/libcore/MovieClip.cpp     2008-12-28 10:01:13 +0000
@@ -657,7 +657,7 @@
 #endif
 
     // We do not execute ENTER_FRAME if unloaded
-    if ( id.m_id == event_id::ENTER_FRAME && isUnloaded() )
+    if ( id.id() == event_id::ENTER_FRAME && isUnloaded() )
     {
 #ifdef GNASH_DEBUG
         log_debug(_("Sprite %s ignored ENTER_FRAME event (is unloaded)"), 
getTarget());
@@ -692,7 +692,7 @@
 
 
     // user-defined onInitialize is never called
-    if ( id.m_id == event_id::INITIALIZE )
+    if ( id.id() == event_id::INITIALIZE )
     {
             testInvariant();
             return called;
@@ -713,7 +713,7 @@
     //
     //     TODO: test the case in which it's MovieClip.prototype.onLoad 
defined !
     //
-    if ( id.m_id == event_id::LOAD )
+    if ( id.id() == event_id::LOAD )
     {
         // TODO: we're likely making too much noise for nothing here,
         // there must be some action-execution-order related problem 
instead....
@@ -756,7 +756,7 @@
     if (! id.is_key_event ())
     {
         boost::intrusive_ptr<as_function> method = 
-            getUserDefinedEventHandler(id.get_function_key());
+            getUserDefinedEventHandler(id.functionKey());
 
         if ( method )
         {
@@ -1999,7 +1999,7 @@
         }
 
         // Check user-defined event handlers
-        if ( getUserDefinedEventHandler(event.get_function_key()) )
+        if ( getUserDefinedEventHandler(event.functionKey()) )
         {
             return true;
         }

=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp     2008-12-19 20:47:50 +0000
+++ b/libcore/TextField.cpp     2008-12-28 09:40:28 +0000
@@ -38,7 +38,7 @@
 #include "fontlib.h" // for searching or adding fonts the _font member
 #include "Object.h" // for getObjectInterface
 #include "namedStrings.h"
-#include "array.h" // for _listeners construction
+#include "Array_as.h" // for _listeners construction
 #include "AsBroadcaster.h" // for initializing self as a broadcaster
 #include "StringPredicates.h"
 #include "TextFormat_as.h" // for getTextFormat/setTextFormat
@@ -406,11 +406,11 @@
     _selection = std::make_pair(start, end);
 }
 bool
-TextField::on_event(const event_id& id)
+TextField::on_event(const event_id& ev)
 {
     if (isReadOnly()) return false;
 
-    switch (id.m_id)
+    switch (ev.id())
     {
         case event_id::KEY_PRESS:
         {
@@ -425,7 +425,7 @@
             // stored and displayed. See utf.h for more information.
             // This is a limit on the number of key codes, not on the
             // capacity of strings.
-            gnash::key::code c = id.keyCode;
+            gnash::key::code c = ev.keyCode();
 
             // maybe _text is changed in ActionScript
             m_cursor = std::min<size_t>(m_cursor, _text.size());

=== modified file 'libcore/as_function.cpp'
--- a/libcore/as_function.cpp   2008-11-20 15:22:13 +0000
+++ b/libcore/as_function.cpp   2008-12-27 19:56:32 +0000
@@ -22,14 +22,13 @@
 #include "as_function.h"
 #include "builtin_function.h" // for _global.Function
 #include "as_value.h"
-#include "array.h"
+#include "Array_as.h"
 #include "fn_call.h"
 #include "GnashException.h"
 #include "VM.h"
 #include "Object.h" // for getObjectInterface
 #include "namedStrings.h"
 
-#include <typeinfo>
 #include <iostream>
 
 namespace gnash {

=== modified file 'libcore/as_object.cpp'
--- a/libcore/as_object.cpp     2008-12-08 15:58:46 +0000
+++ b/libcore/as_object.cpp     2008-12-28 09:40:28 +0000
@@ -32,7 +32,7 @@
 #include "fn_call.h" // for generic methods
 #include "Object.h" // for getObjectInterface
 #include "action.h" // for call_method
-#include "array.h" // for setPropFlags
+#include "Array_as.h" // for setPropFlags
 #include "as_function.h" // for inheritance of as_super
 
 #include <set>
@@ -1176,7 +1176,7 @@
 {
        as_value event_handler;
 
-       if (get_member(id.get_function_key(), &event_handler) )
+       if (get_member(id.functionKey(), &event_handler) )
        {
                call_method0(event_handler, NULL, this);
                return true;

=== modified file 'libcore/as_object.h'
--- a/libcore/as_object.h       2008-12-16 12:20:22 +0000
+++ b/libcore/as_object.h       2008-12-28 09:40:28 +0000
@@ -31,7 +31,6 @@
 #include "smart_ptr.h"
 #include "as_prop_flags.h" // for enum
 #include "GnashException.h"
-#include "event_id.h" // for event_id
 
 #include <cmath>
 #include <utility> // for std::pair
@@ -47,6 +46,7 @@
        class VM;
        class Machine;
        class IOChannel;
+    class event_id;
 }
 
 namespace gnash {

=== modified file 'libcore/as_value.cpp'
--- a/libcore/as_value.cpp      2008-12-25 14:05:32 +0000
+++ b/libcore/as_value.cpp      2008-12-27 19:56:32 +0000
@@ -36,7 +36,7 @@
 #include "GnashException.h"
 #include "Object.h"
 #include "amf.h"
-#include "array.h"
+#include "Array_as.h"
 #include "SimpleBuffer.h"
 
 #include <cmath> // std::fmod

=== renamed file 'libcore/array.cpp' => 'libcore/asobj/Array_as.cpp'
--- a/libcore/array.cpp 2008-12-14 12:48:17 +0000
+++ b/libcore/asobj/Array_as.cpp        2008-12-27 19:56:32 +0000
@@ -1,4 +1,4 @@
-// array.cpp:  ActionScript array class, for Gnash.
+// Array_as.cpp:  ActionScript array class, for Gnash.
 // 
 //   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 // 
@@ -23,7 +23,7 @@
 
 #include "smart_ptr.h" // GNASH_USE_GC
 #include "as_value.h"
-#include "array.h"
+#include "Array_as.h"
 #include "log.h"
 #include "builtin_function.h" // for Array class
 #include "as_function.h" // for sort user-defined comparator

=== renamed file 'libcore/array.h' => 'libcore/asobj/Array_as.h'
--- a/libcore/array.h   2008-12-14 12:48:17 +0000
+++ b/libcore/asobj/Array_as.h  2008-12-27 19:56:32 +0000
@@ -278,7 +278,7 @@
                for (ValueList::iterator i=nelem.begin(), e=nelem.end(); i!=e; 
++i)
                {
                        elements[idx++] = *i;
-               };
+        }
        }
 
        /// \brief
@@ -332,7 +332,7 @@
                for (ValueList::iterator i=nelem.begin(), e=nelem.end(); i!=e; 
++i)
                {
                        elements[idx++] = *i;
-               };
+               }
 
                return as_value(this);
        }

=== modified file 'libcore/asobj/AsBroadcaster.cpp'
--- a/libcore/asobj/AsBroadcaster.cpp   2008-12-11 11:34:15 +0000
+++ b/libcore/asobj/AsBroadcaster.cpp   2008-12-27 19:56:32 +0000
@@ -21,7 +21,7 @@
 #include "gnashconfig.h"
 #endif
 
-#include "array.h" // for _listeners construction
+#include "Array_as.h" // for _listeners construction
 #include "log.h"
 #include "AsBroadcaster.h"
 #include "fn_call.h"

=== modified file 'libcore/asobj/ClassHierarchy.cpp'
--- a/libcore/asobj/ClassHierarchy.cpp  2008-12-25 19:02:32 +0000
+++ b/libcore/asobj/ClassHierarchy.cpp  2008-12-27 19:56:32 +0000
@@ -21,7 +21,6 @@
 #include "as_value.h"
 #include "as_function.h" // for function_class_init
 #include "Button.h"
-#include "array.h"
 #include "AsBroadcaster.h"
 #include "Accessibility_as.h"
 #include "Boolean_as.h"

=== modified file 'libcore/asobj/Global.cpp'
--- a/libcore/asobj/Global.cpp  2008-12-25 19:02:32 +0000
+++ b/libcore/asobj/Global.cpp  2008-12-27 19:56:32 +0000
@@ -26,7 +26,7 @@
 #include "as_prop_flags.h"
 #include "as_value.h"
 #include "as_function.h" // for function_class_init
-#include "array.h"
+#include "Array_as.h"
 #include "AsBroadcaster.h"
 #include "Boolean_as.h"
 #include "Camera.h"

=== modified file 'libcore/asobj/Key_as.cpp'
--- a/libcore/asobj/Key_as.cpp  2008-12-02 11:45:42 +0000
+++ b/libcore/asobj/Key_as.cpp  2008-12-28 09:40:28 +0000
@@ -116,18 +116,16 @@
 
 
 void 
-Key_as::notify_listeners(const event_id& key_event)
+Key_as::notify_listeners(const event_id& ev)
 {  
     // There is no user defined "onKeyPress" event handler
-    if((key_event.m_id != event_id::KEY_DOWN) &&
-            (key_event.m_id != event_id::KEY_UP)) return;
-
-    as_value ev(key_event.get_function_name());
+    if((ev.id() != event_id::KEY_DOWN) &&
+            (ev.id() != event_id::KEY_UP)) return;
 
 #ifdef GNASH_DEBUG_KEYEVENTS
     log_debug("notify_listeners calling broadcastMessage with arg %s", ev);
 #endif
-    callMethod(NSV::PROP_BROADCAST_MESSAGE, ev);
+    callMethod(NSV::PROP_BROADCAST_MESSAGE, ev.functionName());
 }
 
 int

=== modified file 'libcore/asobj/Key_as.h'
--- a/libcore/asobj/Key_as.h    2008-12-16 12:20:22 +0000
+++ b/libcore/asobj/Key_as.h    2008-12-28 09:40:28 +0000
@@ -23,13 +23,14 @@
 #include "smart_ptr.h" // GNASH_USE_GC
 #include "as_object.h" // for inheritance
 #include "fn_call.h"
-#include "event_id.h"
 #include "GnashKey.h" // for key::code
 #include "dsodefs.h"
 #include <bitset>
 
 namespace gnash {
 
+class event_id;
+    
 /************************************************************************
  *
  * This has been moved from action.cpp, when things are clean

=== modified file 'libcore/asobj/LoadVars_as.cpp'
--- a/libcore/asobj/LoadVars_as.cpp     2008-12-08 07:59:26 +0000
+++ b/libcore/asobj/LoadVars_as.cpp     2008-12-27 19:56:32 +0000
@@ -29,7 +29,6 @@
 #include "VM.h"
 #include "Object.h" // for getObjectInterface
 #include "namedStrings.h"
-#include "array.h"
 
 #include <list>
 #include <boost/algorithm/string/case_conv.hpp>

=== modified file 'libcore/asobj/LoadableObject.cpp'
--- a/libcore/asobj/LoadableObject.cpp  2008-12-08 07:59:26 +0000
+++ b/libcore/asobj/LoadableObject.cpp  2008-12-27 19:56:32 +0000
@@ -19,7 +19,7 @@
 
 #include "LoadableObject.h"
 #include "log.h"
-#include "array.h"
+#include "Array_as.h"
 #include "as_object.h"
 #include "StreamProvider.h"
 #include "URL.h"

=== modified file 'libcore/asobj/Makefile.am'
--- a/libcore/asobj/Makefile.am 2008-12-25 19:02:32 +0000
+++ b/libcore/asobj/Makefile.am 2008-12-27 19:56:32 +0000
@@ -44,6 +44,7 @@
 libgnashasobjs_la_SOURCES = \
        AsBroadcaster.cpp \
        Accessibility_as.cpp \
+       Array_as.cpp \
        Boolean_as.cpp \
        Camera.cpp \
        ClassHierarchy.cpp \
@@ -109,6 +110,7 @@
 noinst_HEADERS = \
        AsBroadcaster.h \
        Accessibility_as.h \
+       Array_as.h \
        Boolean_as.h \
        Camera.h \
        ClassHierarchy.h \

=== modified file 'libcore/asobj/MovieClipLoader.cpp'
--- a/libcore/asobj/MovieClipLoader.cpp 2008-12-19 13:35:37 +0000
+++ b/libcore/asobj/MovieClipLoader.cpp 2008-12-27 19:56:32 +0000
@@ -37,7 +37,7 @@
 #include "Object.h" // for getObjectInterface
 #include "AsBroadcaster.h" // for initializing self as a broadcaster
 #include "namedStrings.h"
-#include "array.h" // for _listeners construction
+#include "Array_as.h" // for _listeners construction
 #include "ExecutableCode.h"
 
 #include <string>

=== modified file 'libcore/asobj/Selection_as.cpp'
--- a/libcore/asobj/Selection_as.cpp    2008-12-08 11:11:44 +0000
+++ b/libcore/asobj/Selection_as.cpp    2008-12-27 19:56:32 +0000
@@ -28,7 +28,6 @@
 #include "smart_ptr.h" // for boost intrusive_ptr
 #include "builtin_function.h" // need builtin_function
 #include "Object.h" // for getObjectInterface
-#include "array.h"
 #include "AsBroadcaster.h"
 #include "TextField.h"
 

=== modified file 'libcore/asobj/String_as.cpp'
--- a/libcore/asobj/String_as.cpp       2008-12-08 14:05:33 +0000
+++ b/libcore/asobj/String_as.cpp       2008-12-27 19:56:32 +0000
@@ -26,7 +26,7 @@
 #include "as_object.h"
 #include "builtin_function.h" // need builtin_function
 #include "log.h"
-#include "array.h"
+#include "Array_as.h"
 #include "as_value.h"
 #include "GnashException.h"
 #include "VM.h" 

=== modified file 'libcore/asobj/XMLNode_as.cpp'
--- a/libcore/asobj/XMLNode_as.cpp      2008-12-08 08:30:13 +0000
+++ b/libcore/asobj/XMLNode_as.cpp      2008-12-27 19:56:32 +0000
@@ -20,7 +20,7 @@
 #include "log.h"
 #include "fn_call.h"
 #include "builtin_function.h"
-#include "array.h" // for childNodes
+#include "Array_as.h" // for childNodes
 #include "XMLNode_as.h"
 #include "XML_as.h" // escape / unescape
 #include "log.h"

=== modified file 'libcore/asobj/XML_as.cpp'
--- a/libcore/asobj/XML_as.cpp  2008-12-08 08:30:13 +0000
+++ b/libcore/asobj/XML_as.cpp  2008-12-27 19:56:32 +0000
@@ -33,7 +33,6 @@
 #include "builtin_function.h"
 #include "VM.h"
 #include "namedStrings.h"
-#include "array.h"
 #include "StringPredicates.h"
 
 #include <string>

=== modified file 'libcore/character.cpp'
--- a/libcore/character.cpp     2008-12-11 16:56:44 +0000
+++ b/libcore/character.cpp     2008-12-28 09:40:28 +0000
@@ -997,7 +997,7 @@
        if ( it != _event_handlers.end() ) return true;
 
        boost::intrusive_ptr<as_function> method = 
-        getUserDefinedEventHandler(id.get_function_key());
+        getUserDefinedEventHandler(id.functionKey());
        if (method) return true;
 
        return false;

=== modified file 'libcore/event_id.h'
--- a/libcore/event_id.h        2008-12-16 12:20:22 +0000
+++ b/libcore/event_id.h        2008-12-28 09:40:28 +0000
@@ -33,147 +33,151 @@
 class event_id
 {
 public:
-       /// These must match the function names in event_id::get_function_name()
-       enum id_code
-       {
-               INVALID,
-
-               // These are for buttons & sprites.
-               PRESS,
-               RELEASE,
-               RELEASE_OUTSIDE,
-               ROLL_OVER,
-               ROLL_OUT,
-               DRAG_OVER,
-               DRAG_OUT,
-               KEY_PRESS,
-
-               // These are for sprites only.
-               INITIALIZE,
-               LOAD,
-               UNLOAD,
-               ENTER_FRAME,
-               MOUSE_DOWN,
-               MOUSE_UP,
-               MOUSE_MOVE,
-               KEY_DOWN,
-               KEY_UP,
-               DATA,
-               
-               // These are for the MoveClipLoader ActionScript only
-               LOAD_START,
-               LOAD_ERROR,
-               LOAD_PROGRESS,
-               LOAD_INIT,
-               
-               // These are for the XMLSocket ActionScript only
-               CLOSE,
-               CONNECT,
-               XML,
-               
-               // This is for setInterval
-               TIMER,
-
-               CONSTRUCT,
-               SETFOCUS,
-               KILLFOCUS,
-
-               EVENT_COUNT
-       };
-
-       id_code m_id;
-       
-       // keyCode must be the unique gnash key identifier
-       // gnash::key::code.
-       // edit_text_character has to be able to work out the
-       // ASCII value from keyCode, while other users need 
-       // the SWF code or the Flash key code.
-       key::code keyCode;
-
-       event_id() : m_id(INVALID), keyCode(key::INVALID) {}
-
-       event_id(id_code id, key::code c = key::INVALID)
-               :
-               m_id(id),
-               keyCode(c)
-       {
-               // you must supply a key code for KEY_PRESS event
-               // 
-               // we do have a testcase with m_id == KEY_PRESS, and 
keyCode==0(KEY_INVALID)
-               // see key_event_test.swf(produced by Ming)
-               // 
-               //assert((keyCode == key::INVALID && (m_id != KEY_PRESS))
-               //      || (keyCode != key::INVALID && (m_id == KEY_PRESS)));
-       }
-
-       ///
-       /// @param SWFKey The SWF code matched to the event. This
-       /// must be converted to a unique gnash::key::code.
-       void setKeyCode(boost::uint8_t SWFkey)
-       {
-               // Lookup the SWFcode in the gnash::key::code table.
-               // Some are not unique (keypad numbers are the
-               // same as normal numbers), so we take the first match.
-               // As long as we can work out the SWFCode from the
-               // gnash::key::code it's all right.
-               int i = 0;
-               while (key::codeMap[i][key::SWF] != SWFkey && i < 
key::KEYCOUNT) i++;
-
-               if (i == key::KEYCOUNT) keyCode = key::INVALID;
-               else keyCode = static_cast<key::code>(i);
-       }
-
-       bool    operator==(const event_id& id) const
-       {
-           return m_id == id.m_id && keyCode == id.keyCode;
-       }
-
-       bool operator< (const event_id& id) const
-       {
-               if ( m_id < id.m_id ) return true;
-               if ( m_id > id.m_id ) return false;
-
-               // m_id are equal, check key code
-               if ( keyCode < id.keyCode ) return true;
-               return false;
-       }
-
-       /// Return the name of a method-handler function
-       /// corresponding to this event.
-       const std::string& get_function_name() const;
-
-       /// Return the string_table key of a method-handler function
-       /// corresponding to this event.
-       string_table::key get_function_key() const;
-
-       /// \brief
-       /// Return true if this is a mouse event
-       /// (triggerable with a mouse activity)
-       bool is_mouse_event() const;
+
+    enum EventCode
+    {
+        INVALID,
+
+        // These are for buttons & sprites.
+        PRESS,
+        RELEASE,
+        RELEASE_OUTSIDE,
+        ROLL_OVER,
+        ROLL_OUT,
+        DRAG_OVER,
+        DRAG_OUT,
+        KEY_PRESS,
+
+        // These are for sprites only.
+        INITIALIZE,
+        LOAD,
+        UNLOAD,
+        ENTER_FRAME,
+        MOUSE_DOWN,
+        MOUSE_UP,
+        MOUSE_MOVE,
+        KEY_DOWN,
+        KEY_UP,
+        DATA,
+        
+        // These are for the MoveClipLoader ActionScript only
+        LOAD_START,
+        LOAD_ERROR,
+        LOAD_PROGRESS,
+        LOAD_INIT,
+        
+        // These are for the XMLSocket ActionScript only
+        CLOSE,
+        CONNECT,
+        XML,
+        
+        // This is for setInterval
+        TIMER,
+
+        CONSTRUCT,
+        SETFOCUS,
+        KILLFOCUS,
+
+        EVENT_COUNT
+    };
+    
+    event_id() : _id(INVALID), _keyCode(key::INVALID) {}
+
+    event_id(EventCode id, key::code c = key::INVALID)
+        :
+        _id(id),
+        _keyCode(c)
+    {
+        // you must supply a key code for KEY_PRESS event
+        // 
+        // we do have a testcase with _id == KEY_PRESS,
+        // and keyCode==0(KEY_INVALID)
+        // see key_event_test.swf(produced by Ming)
+    }
+
+    ///
+    /// @param SWFKey The SWF code matched to the event. This
+    /// must be converted to a unique gnash::key::code.
+    void setKeyCode(boost::uint8_t SWFkey)
+    {
+        // Lookup the SWFcode in the gnash::key::code table.
+        // Some are not unique (keypad numbers are the
+        // same as normal numbers), so we take the first match.
+        // As long as we can work out the SWFCode from the
+        // gnash::key::code it's all right.
+        int i = 0;
+        while (key::codeMap[i][key::SWF] != SWFkey && i < key::KEYCOUNT) i++;
+
+        if (i == key::KEYCOUNT) _keyCode = key::INVALID;
+        else _keyCode = static_cast<key::code>(i);
+    }
+
+    bool operator==(const event_id& id) const
+    {
+        return _id == id._id && _keyCode == id._keyCode;
+    }
+
+    bool operator< (const event_id& id) const
+    {
+        if ( _id < id._id ) return true;
+        if ( _id > id._id ) return false;
+
+        // Same event, check key code
+        if (_keyCode < id._keyCode ) return true;
+        return false;
+    }
+
+    /// Return the name of a method-handler function
+    /// corresponding to this event.
+    const std::string& functionName() const;
+
+    /// Return the string_table key of a method-handler function
+    /// corresponding to this event.
+    string_table::key functionKey() const;
+
+    /// \brief
+    /// Return true if this is a mouse event
+    /// (triggerable with a mouse activity)
+    bool is_mouse_event() const;
   
-       /// Return true if this is a key event
-       bool is_key_event() const;
-
-       /// Return true if this is a button-like event
-       //
-       /// Button-like events are: PRESS, RELEASE, RELEASE_OUTSIDE,
-       ///                         ROLL_OVER, ROLL_OUT,
-       ///                         DRAG_OVER, DRAG_OUT,
-       ///                         KEY_PRESS
-       ///
-       /// TODO: check if we need anything more
-       ///       The way to test is using the 'enabled'
-       ///       property to see which ones are disabled
-       ///       by setting it to false.
-       ///
-       bool is_button_event() const;
-
-       id_code id() const { return m_id; }
+    /// Return true if this is a key event
+    bool is_key_event() const;
+
+    /// Return true if this is a button-like event
+    //
+    /// Button-like events are: PRESS, RELEASE, RELEASE_OUTSIDE,
+    ///                         ROLL_OVER, ROLL_OUT,
+    ///                         DRAG_OVER, DRAG_OUT,
+    ///                         KEY_PRESS
+    ///
+    /// TODO: check if we need anything more
+    ///       The way to test is using the 'enabled'
+    ///       property to see which ones are disabled
+    ///       by setting it to false.
+    ///
+    bool is_button_event() const;
+
+    EventCode id() const { return _id; }
+
+    key::code keyCode() const { return _keyCode; }
+
+private:
+
+    EventCode _id;
+    
+    // keyCode must be the unique gnash key identifier
+    // gnash::key::code.
+    // edit_text_character has to be able to work out the
+    // ASCII value from keyCode, while other users need 
+    // the SWF code or the Flash key code.
+    key::code _keyCode;
+
+
 };
 
 std::ostream& operator<< (std::ostream& o, const event_id& ev);
 
-}      // end namespace gnash
+} // namespace gnash
 
 
 #endif // GNASH_EVENT_ID_H

=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp    2008-12-05 09:37:07 +0000
+++ b/libcore/movie_root.cpp    2008-12-28 09:40:28 +0000
@@ -1307,7 +1307,8 @@
             // Can throw an action limit exception if the stack limit is 0 or 
1.
             // A stack limit like that is hardly of any use, but could be used
             // maliciously to crash Gnash.
-                   mouseObj->callMethod(NSV::PROP_BROADCAST_MESSAGE, 
as_value(PROPNAME(event.get_function_name())));
+                   mouseObj->callMethod(NSV::PROP_BROADCAST_MESSAGE, 
+                    event.functionName());
                }
            catch (ActionLimitException &e)
            {

=== modified file 'libcore/swf/DefineButtonTag.cpp'
--- a/libcore/swf/DefineButtonTag.cpp   2008-11-07 16:14:21 +0000
+++ b/libcore/swf/DefineButtonTag.cpp   2008-12-28 10:01:13 +0000
@@ -89,7 +89,7 @@
                {
                        int keycode = getKeyCode();
                        if ( ! keycode ) return false; // not a keypress event
-                       return key::codeMap[ev.keyCode][key::SWF] == keycode;
+                       return key::codeMap[ev.keyCode()][key::SWF] == keycode;
                }
                default: return false;
        }

=== modified file 'libcore/swf_function.cpp'
--- a/libcore/swf_function.cpp  2008-10-25 10:38:32 +0000
+++ b/libcore/swf_function.cpp  2008-12-27 19:56:32 +0000
@@ -17,7 +17,7 @@
 
 #include "log.h"
 #include "swf_function.h"
-#include "array.h"
+#include "Array_as.h"
 #include "fn_call.h"
 #include "MovieClip.h"
 #include "action_buffer.h"

=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2008-12-14 13:57:23 +0000
+++ b/libcore/vm/ASHandlers.cpp 2008-12-27 19:56:32 +0000
@@ -28,7 +28,7 @@
 #include "rc.h"
 #include "ASHandlers.h"
 #include "movie_definition.h"
-#include "array.h"
+#include "Array_as.h"
 #include "swf_function.h"
 #include "as_function.h"
 #include "fn_call.h"

=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp    2008-11-28 08:23:30 +0000
+++ b/libcore/vm/Machine.cpp    2008-12-27 19:56:32 +0000
@@ -21,7 +21,7 @@
 #include "as_object.h"
 #include "ClassHierarchy.h"
 #include "namedStrings.h"
-#include "array.h"
+#include "Array_as.h"
 #include "abc_block.h"
 #include "fn_call.h"
 

=== modified file 'libcore/vm/action.cpp'
--- a/libcore/vm/action.cpp     2008-11-19 16:51:17 +0000
+++ b/libcore/vm/action.cpp     2008-12-28 09:40:28 +0000
@@ -30,12 +30,11 @@
 #include "StringPredicates.h"
 #include "namedStrings.h"
 
-#include <typeinfo>
 #include <string>
 #include <algorithm>
 #include <boost/format.hpp>
 #include <cassert>
-
+#include <boost/assign/list_of.hpp>
 
 namespace gnash {
 
@@ -47,14 +46,11 @@
 // Function/method dispatch.
 //
 
+/// @param this_ptr     this is ourself.
 as_value
-call_method(
-    const as_value& method,
-    as_environment* env,
-    as_object* this_ptr, // this is ourself
-    std::auto_ptr< std::vector<as_value> > args,
-    as_object* super,
-    const movie_definition* callerDef)
+call_method(const as_value& method, as_environment* env, as_object* this_ptr,
+        std::auto_ptr< std::vector<as_value> > args, as_object* super,
+        const movie_definition* callerDef)
 {
        as_value val;
        fn_call call(this_ptr, env, args);
@@ -70,9 +66,9 @@
                }
                else
                {
-                       boost::format fmt =
-                                   boost::format(_("Attempt to call a value 
which is neither a "
-                                                   "C nor an ActionScript 
function (%s)")) % method;
+                       boost::format fmt = boost::format(_("Attempt to call a "
+                        "value which is neither a C nor an ActionScript "
+                        "function (%s)")) % method;
                        throw ActionTypeError(fmt.str());
                }
        }
@@ -87,10 +83,8 @@
        return val;
 }
 
-as_value       call_method0(
-    const as_value& method,
-    as_environment* env,
-    as_object* this_ptr)
+as_value call_method0( const as_value& method, as_environment* env,
+        as_object* this_ptr)
 {
     // TODO: avoid allocating a vector here
     std::auto_ptr< std::vector<as_value> > args(new std::vector<as_value>);
@@ -103,93 +97,90 @@
 //
 
 const std::string&
-event_id::get_function_name() const
+event_id::functionName() const
 {
-       // TODO: use a case-insensitive matching
-       static std::string s_function_names[EVENT_COUNT] =
-       {
-               "INVALID",               // INVALID
-               "onPress",               // PRESS
-               "onRelease",             // RELEASE
-               "onReleaseOutside",      // RELEASE_OUTSIDE
-               "onRollOver",            // ROLL_OVER
-               "onRollOut",             // ROLL_OUT
-               "onDragOver",            // DRAG_OVER
-               "onDragOut",             // 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
-               "onLoadStart",           // LOAD_START
-               "onLoadError",           // LOAD_ERROR
-               "onLoadProgress",        // LOAD_PROGRESS
-               "onLoadInit",            // LOAD_INIT
-               "onClose",               // CLOSE
-               "onConnect",     // CONNECT
-               "onXML",                 // XML
-               "onTimer",               // setInterval Timer expired
-               "onConstruct",
-               "onSetFocus",
-               "onKillFocus"
-       };
+    typedef std::map<EventCode, std::string> EventFunctionNameMap;
+    static const EventFunctionNameMap e = boost::assign::map_list_of
+        (INVALID, "INVALID")
+               (PRESS, "onPress")
+               (RELEASE, "onRelease")
+               (RELEASE_OUTSIDE, "onReleaseOutside")
+               (ROLL_OVER, "onRollOver")
+               (ROLL_OUT, "onRollOut") 
+               (DRAG_OVER, "onDragOver")
+               (DRAG_OUT, "onDragOut") 
+               (KEY_PRESS, "onKeyPress")
+               (INITIALIZE, "onInitialize")
+               (LOAD, "onLoad")
+               (UNLOAD, "onUnload")
+               (ENTER_FRAME, "onEnterFrame")
+               (MOUSE_DOWN, "onMouseDown")     
+               (MOUSE_UP, "onMouseUp")
+               (MOUSE_MOVE, "onMouseMove")
+               (KEY_DOWN, "onKeyDown")
+               (KEY_UP, "onKeyUp")     
+               (DATA, "onData")
+               (LOAD_START, "onLoadStart")     
+               (LOAD_ERROR, "onLoadError")
+               (LOAD_PROGRESS, "onLoadProgress")       
+               (LOAD_INIT, "onLoadInit")
+               (CLOSE, "onClose")
+               (CONNECT, "onConnect")
+               (XML, "onXML")
+               (TIMER, "onTimer")
+               (CONSTRUCT, "onConstruct")
+               (SETFOCUS, "onSetFocus")
+               (KILLFOCUS, "onKillFocus");
 
-       assert(m_id > INVALID && m_id < EVENT_COUNT);
-       return s_function_names[m_id];
+    EventFunctionNameMap::const_iterator it = e.find(_id);
+    assert(it != e.end());
+    return it->second;
 }
 
 string_table::key
-event_id::get_function_key() const
+event_id::functionKey() const
 {
-       // TODO: use a case-insensitive matching
-       static string_table::key function_keys[EVENT_COUNT] =
-       {
-               0,                              // INVALID
-               NSV::PROP_ON_PRESS,             // PRESS
-               NSV::PROP_ON_RELEASE,           // RELEASE
-               NSV::PROP_ON_RELEASE_OUTSIDE,   // RELEASE_OUTSIDE
-               NSV::PROP_ON_ROLL_OVER,         // ROLL_OVER
-               NSV::PROP_ON_ROLL_OUT,          // ROLL_OUT
-               NSV::PROP_ON_DRAG_OVER,         // DRAG_OVER
-               NSV::PROP_ON_DRAG_OUT,          // DRAG_OUT
-               NSV::PROP_ON_KEY_PRESS,         // KEY_PRESS
-               NSV::PROP_ON_INITIALIZE,        // INITIALIZE
-               NSV::PROP_ON_LOAD,              // LOAD
-               NSV::PROP_ON_UNLOAD,            // UNLOAD
-               NSV::PROP_ON_ENTER_FRAME,       // ENTER_FRAME
-               NSV::PROP_ON_MOUSE_DOWN,        // MOUSE_DOWN
-               NSV::PROP_ON_MOUSE_UP,          // MOUSE_UP
-               NSV::PROP_ON_MOUSE_MOVE,        //  MOUSE_MOVE
-               NSV::PROP_ON_KEY_DOWN,          // KEY_DOWN
-               NSV::PROP_ON_KEY_UP,            // KEY_UP
-               NSV::PROP_ON_DATA,              // DATA
-               NSV::PROP_ON_LOAD_START,        // LOAD_START
-               NSV::PROP_ON_LOAD_ERROR,        // LOAD_ERROR
-               NSV::PROP_ON_LOAD_PROGRESS,     // LOAD_PROGRESS
-               NSV::PROP_ON_LOAD_INIT,         // LOAD_INIT
-               NSV::PROP_ON_CLOSE,     // CLOSE
-               NSV::PROP_ON_CONNECT,   // CONNECT
-               NSV::PROP_ON_XML,               // XML
-               NSV::PROP_ON_TIMER,             // setInterval Timer expired
-               NSV::PROP_ON_CONSTRUCT,         // onConstruct
-               NSV::PROP_ON_SET_FOCUS,         // onSetFocus
-               NSV::PROP_ON_KILL_FOCUS         // onKillFocus
-       };
+    typedef std::map<EventCode, string_table::key> EventFunctionMap;
+    static const EventFunctionMap e = boost::assign::map_list_of
+               (PRESS, NSV::PROP_ON_PRESS)
+               (RELEASE, NSV::PROP_ON_RELEASE)
+               (RELEASE_OUTSIDE, NSV::PROP_ON_RELEASE_OUTSIDE)
+               (ROLL_OVER, NSV::PROP_ON_ROLL_OVER )
+               (ROLL_OUT, NSV::PROP_ON_ROLL_OUT)
+               (DRAG_OVER, NSV::PROP_ON_DRAG_OVER)
+               (DRAG_OUT, NSV::PROP_ON_DRAG_OUT)
+               (KEY_PRESS, NSV::PROP_ON_KEY_PRESS)
+               (INITIALIZE, NSV::PROP_ON_INITIALIZE)
+               (LOAD, NSV::PROP_ON_LOAD)
+               (UNLOAD, NSV::PROP_ON_UNLOAD)
+               (ENTER_FRAME, NSV::PROP_ON_ENTER_FRAME)
+               (MOUSE_DOWN, NSV::PROP_ON_MOUSE_DOWN)
+               (MOUSE_UP, NSV::PROP_ON_MOUSE_UP)
+               (MOUSE_MOVE, NSV::PROP_ON_MOUSE_MOVE)
+               (KEY_DOWN, NSV::PROP_ON_KEY_DOWN)
+               (KEY_UP, NSV::PROP_ON_KEY_UP)
+               (DATA, NSV::PROP_ON_DATA)
+               (LOAD_START, NSV::PROP_ON_LOAD_START)
+               (LOAD_ERROR, NSV::PROP_ON_LOAD_ERROR)
+               (LOAD_PROGRESS, NSV::PROP_ON_LOAD_PROGRESS)
+               (LOAD_INIT, NSV::PROP_ON_LOAD_INIT)
+               (CLOSE, NSV::PROP_ON_CLOSE)
+               (CONNECT, NSV::PROP_ON_CONNECT)
+               (XML, NSV::PROP_ON_XML)
+               (TIMER, NSV::PROP_ON_TIMER)
+               (CONSTRUCT, NSV::PROP_ON_CONSTRUCT)
+               (SETFOCUS, NSV::PROP_ON_SET_FOCUS)
+               (KILLFOCUS, NSV::PROP_ON_KILL_FOCUS);
 
-       assert(m_id > INVALID && m_id < EVENT_COUNT);
-       return function_keys[m_id];
+    EventFunctionMap::const_iterator it = e.find(_id);
+    assert(it != e.end());
+    return it->second;
 }
 
 bool
 event_id::is_mouse_event() const
 {
-       switch (m_id)
+       switch (_id)
        {
                case event_id::PRESS:
                case event_id::RELEASE:
@@ -209,7 +200,7 @@
 bool
 event_id::is_key_event() const
 {
-       switch (m_id)
+       switch (_id)
        {
                case event_id::KEY_DOWN:
                case event_id::KEY_PRESS :
@@ -223,7 +214,7 @@
 bool
 event_id::is_button_event() const
 {
-       switch (m_id)
+       switch (_id)
        {
                case event_id::PRESS:
                case event_id::RELEASE :
@@ -241,7 +232,7 @@
 
 std::ostream& operator<< (std::ostream& o, const event_id& ev)
 {
-    return (o << ev.get_function_name());
+    return (o << ev.functionName());
 }
 
 } // end of namespace gnash

=== modified file 'libmedia/FLVParser.cpp'
--- a/libmedia/FLVParser.cpp    2008-12-20 17:11:55 +0000
+++ b/libmedia/FLVParser.cpp    2008-12-27 19:02:45 +0000
@@ -29,7 +29,6 @@
 #include "SimpleBuffer.h"
 
 #include "as_object.h"
-#include "array.h"
 #include "element.h"
 #include "VM.h"
 
@@ -43,7 +42,6 @@
 # include <io.h>
 #endif
 
-using namespace std;
 
 #define PADDING_BYTES 64
 #define READ_CHUNKS 64


reply via email to

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