gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/asobj/ClassHierarchy.cpp...


From: Chad Musick
Subject: [Gnash-commit] gnash ChangeLog server/asobj/ClassHierarchy.cpp...
Date: Mon, 24 Sep 2007 15:39:32 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Chad Musick <cmusick>   07/09/24 15:39:32

Modified files:
        .              : ChangeLog 
        server/asobj   : ClassHierarchy.cpp ClassHierarchy.h Global.cpp 
                         Global.h 
        server/parser  : Makefile.am Namespace.h abc_block.cpp 
                         abc_block.h 
        server/swf     : tag_loaders.cpp 
        server/vm      : VM.cpp VM.h 

Log message:
        Various changes to make ActionScript 3 parsing more capable, especially
        at finding out whether or not a superclass exists.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4394&r2=1.4395
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/ClassHierarchy.cpp?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/ClassHierarchy.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.69&r2=1.70
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.h?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/Makefile.am?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/Namespace.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/abc_block.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/abc_block.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/tag_loaders.cpp?cvsroot=gnash&r1=1.140&r2=1.141
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.h?cvsroot=gnash&r1=1.16&r2=1.17

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4394
retrieving revision 1.4395
diff -u -b -r1.4394 -r1.4395
--- ChangeLog   24 Sep 2007 13:43:08 -0000      1.4394
+++ ChangeLog   24 Sep 2007 15:39:30 -0000      1.4395
@@ -1,3 +1,20 @@
+2007-09-25 Chad Musick <address@hidden>
+
+       * server/VM.cpp,.h: Add ClassHierarchy object to VM. Doesn't yet
+         mark objects, though it will very soon.
+       * server/asobj/ClassHierarchy.cpp,.h: Extend to use as a namespace
+         object for ActionScript independent of the "Global" object.
+       * server/asobj/Global.cpp,.h: Accept a passed ClassHierarchy,
+         rather than stack constructing one.
+       * server/parser/Makefile.am: Add asobj directory for use of
+         ClassHierarchy by abc_block.
+       * server/parser/Namespace.h: Namespaces contain names, and this
+         enables that.
+       * server/abc_block.h: Change Namespaces to be stored by pointer,
+         since the ClassHiearchy object does the creation now.
+       * server/abc_block.cpp: More parsing. Validate super class
+         of all declared classes, declare stubs in the correct namespaces.
+       
 2007-09-24 Benjamin Wolsey <address@hidden>
 
        * server/gnash.h: correct some keycodes, extend support to

Index: server/asobj/ClassHierarchy.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/ClassHierarchy.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/asobj/ClassHierarchy.cpp     23 Sep 2007 08:48:18 -0000      1.1
+++ server/asobj/ClassHierarchy.cpp     24 Sep 2007 15:39:31 -0000      1.2
@@ -189,6 +189,8 @@
        if (mExtension == NULL)
                return false; // Extensions can't be loaded.
 
+       mGlobalNamespace.stubPrototype(c.name);
+
        boost::intrusive_ptr<as_function> getter =
                new declare_extension_function(c, mGlobal, mExtension);
        boost::intrusive_ptr<as_function> setter =
@@ -201,6 +203,8 @@
 bool
 ClassHierarchy::declareClass(nativeClass& c)
 {
+       mGlobalNamespace.stubPrototype(c.name);
+
        boost::intrusive_ptr<as_function> getter =
                new declare_native_function(c, mGlobal, mExtension);
        boost::intrusive_ptr<as_function> setter =

Index: server/asobj/ClassHierarchy.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/ClassHierarchy.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/asobj/ClassHierarchy.h       23 Sep 2007 08:48:18 -0000      1.1
+++ server/asobj/ClassHierarchy.h       24 Sep 2007 15:39:31 -0000      1.2
@@ -20,6 +20,7 @@
 #define GNASH_CLASS_HIERARCHY_H
 
 #include "as_object.h"
+#include "Namespace.h"
 
 namespace gnash {
 
@@ -109,16 +110,56 @@
        ///
        void massDeclare(int version);
 
-       /// \brief
-       /// Construct the declaration object with the given global object
-       /// and extension object.
-       ClassHierarchy(as_object *global, Extension *e) :
-               mGlobal(global), mExtension(e)
+       /// The global namespace
+       ///
+       /// Get the global namespace.  This is not the Global object -- it only
+       /// contains the classes, not any globally available functions or 
anything
+       /// else.
+       Namespace *getGlobalNs() { return &mGlobalNamespace; }
+
+       /// Find a namespace with the given uri.
+       ///
+       /// @return 
+       /// The namespace with the given uri or NULL if it doesn't exist.
+       Namespace *findNamespace(string_table::key uri)
+       {
+               if (uri == 0)
+                       return getGlobalNs();
+
+               std::map<string_table::key, Namespace>::iterator i;
+               i = mNamespaces.find(uri);
+               if (i == mNamespaces.end())
+                       return NULL;
+               return &(i->second);
+       }
+
+       /// \brief
+       /// Add a namespace to the set. Don't use to add unnamed namespaces.
+       /// Will overwrite existing namespaces 'kind' and 'prefix' values. 
+       /// Returns the added space.
+       Namespace* addNamespace(string_table::key uri, Namespace::kinds kind)
+       { Namespace &n = mNamespaces[uri]; n.initialize(uri, 0, kind);
+         return &mNamespaces[uri];}
+
+       /// Set the extension object, since it wasn't set on construction.
+       void setExtension(Extension *e) { mExtension = e; }
+
+       /// Set the global object, for registrations.
+       void setGlobal(as_object *g) { mGlobal = g; }
+
+       /// \brief
+       /// Construct the declaration object. Later set the global and
+       /// extension objects using setGlobal and setExtension
+       ClassHierarchy() :
+               mGlobal(NULL), mGlobalNamespace(), mExtension(NULL)
        {/**/}
 
 private:
        as_object *mGlobal;
+       Namespace mGlobalNamespace;
        Extension *mExtension;
+
+       std::map<string_table::key, Namespace> mNamespaces;
 };
 
 } /* namespace gnash */

Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -b -r1.69 -r1.70
--- server/asobj/Global.cpp     23 Sep 2007 08:48:18 -0000      1.69
+++ server/asobj/Global.cpp     24 Sep 2007 15:39:31 -0000      1.70
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: Global.cpp,v 1.69 2007/09/23 08:48:18 cmusick Exp $ */
+/* $Id: Global.cpp,v 1.70 2007/09/24 15:39:31 cmusick Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -66,6 +66,7 @@
 #include "edit_text_character.h"
 #include "rc.h"
 #include "ClassHierarchy.h"
+#include "namedStrings.h"
 
 #include "fn_call.h"
 #include "sprite_instance.h"
@@ -354,7 +355,7 @@
     return as_value();
 }
 
-Global::Global(VM& vm)
+Global::Global(VM& vm, ClassHierarchy *ch)
        :
        as_object()
 {
@@ -379,22 +380,26 @@
        init_member("setInterval", new builtin_function(timer_setinterval));
        init_member("clearInterval", new builtin_function(timer_clearinterval));
 
+       ch->setGlobal(this);
+
 // If extensions aren't used, then no extensions will be loaded.
 #ifdef USE_EXTENSIONS
-       ClassHierarchy CH(this, &et);
-#else
-       ClassHierarchy CH(this, NULL);
+       ch->setExtension(&et);
 #endif
-       CH.massDeclare(vm.getSWFVersion());
+
+       ch->massDeclare(vm.getSWFVersion());
 
        if (vm.getSWFVersion() >= 5)
        {
                object_class_init(*this);
+               ch->getGlobalNs()->stubPrototype(NSV::CLASS_OBJECT);
                array_class_init(*this);
+               ch->getGlobalNs()->stubPrototype(NSV::CLASS_ARRAY);
        }
        if (vm.getSWFVersion() >= 6)
        {
                function_class_init(*this);
+               ch->getGlobalNs()->stubPrototype(NSV::CLASS_FUNCTION);
        }
        
        if ( vm.getSWFVersion() < 3 ) goto extscan;

Index: server/asobj/Global.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/asobj/Global.h       9 Jul 2007 02:13:43 -0000       1.7
+++ server/asobj/Global.h       24 Sep 2007 15:39:31 -0000      1.8
@@ -31,6 +31,7 @@
 namespace gnash {
        class VM;
        class fn_call;
+       class ClassHierarchy;
 }
 
 namespace gnash {
@@ -38,7 +39,7 @@
 class Global: public as_object
 {
 public:
-       Global(VM& vm);
+       Global(VM& vm, ClassHierarchy *ch);
        ~Global() {}
 private:
 

Index: server/parser/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/parser/Makefile.am,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- server/parser/Makefile.am   21 Sep 2007 13:40:32 -0000      1.38
+++ server/parser/Makefile.am   24 Sep 2007 15:39:31 -0000      1.39
@@ -15,7 +15,7 @@
 # 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.38 2007/09/21 13:40:32 cmusick Exp $
+# $Id: Makefile.am,v 1.39 2007/09/24 15:39:31 cmusick Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -32,6 +32,7 @@
        -I$(top_srcdir)/server/swf \
        -I$(top_srcdir)/server/parser \
        -I$(top_srcdir)/server/vm \
+       -I$(top_srcdir)/server/asobj \
         -I$(top_srcdir)/libbase \
         -I$(top_srcdir)/libgeometry \
         -I$(top_srcdir)/libamf \

Index: server/parser/Namespace.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/Namespace.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/parser/Namespace.h   20 Sep 2007 17:07:21 -0000      1.1
+++ server/parser/Namespace.h   24 Sep 2007 15:39:31 -0000      1.2
@@ -25,12 +25,20 @@
 #include "config.h"
 #endif
 
+#include <map>
 #include "string_table.h"
 
 namespace gnash {
 
 class abc_block;
+class as_object;
 
+/// A namespace for ActionScript. Not really functional in AS2.
+///
+/// A namespace contains the prototypes of the objects in its
+/// namespace and nothing else.  In AS3 and up, namespaces are
+/// not semantically nested. (Though they may look nested by their
+/// names, this is not a true nesting as done by the bytecode.)
 class Namespace
 {
 public:
@@ -47,22 +55,123 @@
                KIND_STATIC_PROTECTED = 0x1A
        } kinds;
 
+       /// the Uri is the name of the nameSpace.
        string_table::key getUri() const { return mUri; }
+
+       /// the Prefix is used for XML, but not otherwise.
        string_table::key getPrefix() const { return mPrefix; }
 
+       /// \brief
+       /// Create a namespace with the given characteristics. Such a namespace
+       /// will be empty upon creation.
        Namespace(string_table::key uri, string_table::key prefix, kinds kind) :
-               mUri(uri), mPrefix(prefix), mKind(kind)
+               mUri(uri), mPrefix(prefix), mKind(kind), mMembers()
        {/**/}
 
-       Namespace() : mUri(0), mPrefix(0), mKind(KIND_NORMAL) {/**/}
+       /// \brief
+       /// Default constructor so that Namespaces can appear in containers.
+       Namespace() : mUri(0), mPrefix(0), mKind(KIND_NORMAL), mMembers()
+        {/**/}
 
-       void Initialize(string_table::key uri, string_table::key prefix, kinds 
kind)
+       /// \brief
+       /// Initialize the namespace with the given values.  Does not clear
+       /// the list of members of the namespace.
+       void initialize(string_table::key uri, string_table::key prefix, kinds 
kind)
        { mUri = uri; mPrefix = prefix; mKind = kind; }
 
+       /// \brief
+       /// Add a prototype
+       ///
+       /// It is intentional that there is no facility for deleting a 
prototype.
+       /// It doesn't make any sense, and this would cause multiple problems.
+       /// If this functionality is needed, the whole namespace is probably
+       /// invalidated, and the namespace can be discarded.
+       ///
+       /// @param name
+       /// The string table key corresponding to the unqualified name of the
+       /// class.
+       ///
+       /// @param obj
+       /// The object which is the prototype of the named class.
+       ///
+       /// @return
+       /// true if the object is added, false if a different prototype object
+       /// already existed.
+       bool addPrototype(string_table::key name, as_object* obj)
+       {
+               std::map<string_table::key, as_object*>::iterator i =
+                       mMembers.find(name);
+
+               if (i != mMembers.end())
+                       return false;
+
+               mMembers[name] = obj;
+               return true;
+       }
+
+       /// \brief
+       /// Declare a class stub.
+       bool stubPrototype(string_table::key name)
+       { return addPrototype(name, NULL); }
+
+       /// \brief
+       /// Has a prototype been either stubbed or entered?
+       bool prototypeExists(string_table::key name)
+       { return mMembers.find(name) != mMembers.end(); }
+
+       /// \brief
+       /// Set a prototype for an existing stub.
+       ///
+       /// The difference between this and addPrototype is that addPrototype
+       /// will not allow the addition of the object if there is already an
+       /// entry, and this will.
+       ///
+       /// @param name
+       /// The string table key of the unqualified name of the class.
+       ///
+       /// @param obj
+       /// The object which is the prototype of the named class.
+       ///
+       /// @return
+       /// true if the stub existed, otherwise false.
+       /// The prototype is added either way.
+       bool setPrototype(string_table::key name, as_object *obj)
+       {
+               std::map<string_table::key, as_object*>::iterator i =
+                       mMembers.find(name);
+               if (i == mMembers.end())
+               {
+                       mMembers[name] = obj;
+                       return false;
+               }
+               i->second = obj;
+               return true;
+       }
+
+       /// \brief
+       /// Get a prototype
+       ///
+       /// Find a prototype object given its string table key. Returns an empty
+       /// pointer if there is no such object. Because prototypes are unique,
+       /// returns the actual prototype, not a copy. Might return NULL if the
+       /// prototype is stubbed but not set.
+       as_object* getPrototype(string_table::key name)
+       {
+               std::map<string_table::key, as_object*>::iterator i = 
+                       mMembers.find(name);
+
+               if (i == mMembers.end())
+                       return NULL;
+
+               return i->second;
+       }
+
 private:
        string_table::key mUri;
        string_table::key mPrefix;
        kinds mKind;
+
+       std::map<string_table::key, as_object*> mMembers;
 };
 
 }; /* namespace gnash */

Index: server/parser/abc_block.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/abc_block.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/parser/abc_block.cpp 23 Sep 2007 08:51:16 -0000      1.5
+++ server/parser/abc_block.cpp 24 Sep 2007 15:39:31 -0000      1.6
@@ -22,8 +22,10 @@
 #include "stream.h"
 #include "VM.h"
 #include "log.h"
+#include "ClassHierarchy.h"
 
 #define ERR(x) IF_VERBOSE_MALFORMED_SWF(log_swferror x;);
+//#define ERR(x) printf x
 
 namespace gnash {
 
@@ -100,8 +102,7 @@
 abc_block::read(stream* in)
 {
        using namespace abc_parsing;
-
-       std::vector<abc_Trait> traitVec;
+       ClassHierarchy *ch = VM::get().getClassHierarchy();
 
        // Minor version, major version.
        uint32_t version = (in->read_u16()) | (in->read_u16() << 16);
@@ -163,16 +164,13 @@
        mNamespacePool.resize(namespacePoolCount);
        if (namespacePoolCount)
        {
-               mNamespacePool[0].mUri = mNamespacePool[0].mPrefix = 0;
-               mNamespacePool[0].mKind = Namespace::KIND_NORMAL;
+               mNamespacePool[0] = ch->getGlobalNs();
        }
        for (unsigned int i = 1; i < namespacePoolCount; ++i)
        {
                uint8_t kind = in->read_u8();
                if (kind == Namespace::KIND_PACKAGE)
                        kind = Namespace::KIND_NORMAL;
-               else
-                       kind = static_cast<Namespace::kinds> (kind);
                // All namespaces have the same structure, though the usage 
differs.
 
                uint32_t nameIndex = in->read_V32();
@@ -192,10 +190,21 @@
                        return false;
                }
 
-               // And set the name in the Namespace itself.
-               mNamespacePool[i].mUri = nameIndex;
-               // The prefix is unknown right now.
-               mNamespacePool[i].mPrefix = 0;
+               // If this is a private namespace, it is special.
+               if (kind == Namespace::KIND_PRIVATE)
+               {
+                       // TODO: This is a leak. Plug it.
+                       mNamespacePool[i] = new Namespace(nameIndex, 0, 
static_cast<Namespace::kinds>(kind));
+               }
+               else
+               {
+                       // And do the Namespace itself.
+                       Namespace *n = ch->findNamespace(nameIndex);
+                       if (n == NULL)
+                               n = ch->addNamespace(nameIndex, 
+                                       static_cast<Namespace::kinds>(kind));
+                       mNamespacePool[i] = n;
+               }
        }
 
        // These are sets of namespaces, which use the individual ones above.
@@ -220,7 +229,7 @@
                                ERR((_("Action Block: Out of Bound namespace in 
namespace set.\n")));
                                return false;
                        }
-                       mNamespaceSetPool[i][j] = &mNamespacePool[selection];
+                       mNamespaceSetPool[i][j] = mNamespacePool[selection];
                }
        }
 
@@ -229,8 +238,7 @@
        uint32_t multinamePoolCount = in->read_V32();
 
        // Any two namespaces with the same uri here are the same namespace,
-       // excepting private nameSpaces.  This will be handled at verify time.
-       // TODO: Handle this.
+       // excepting private nameSpaces.
        mMultinamePool.resize(multinamePoolCount);
        for (unsigned int i = 1; i < multinamePoolCount; ++i)
        {
@@ -338,7 +346,7 @@
                mMultinamePool[i].mName = mStringPoolTableIds[name];
 
                if (ns)
-                       mMultinamePool[i].mNamespace = &mNamespacePool[ns];
+                       mMultinamePool[i].mNamespace = mNamespacePool[ns];
                if (nsset)
                        mMultinamePool[i].mNamespaceSet = 
&mNamespaceSetPool[nsset];
 
@@ -456,24 +464,49 @@
                else
                        instance.mSuperType = &mMultinamePool[super_index];
 
-               as_object *global = VM::get().getGlobal();
-               as_value vstore;
-               if (super_index && 
!global->get_member(instance.mSuperType->mName, &vstore))
-               {
-                       ERR((_("Action Block: Non-existent super type (%d).\n"),
-                               super_index));
-                       fprintf(stderr, "Super type doesn't exist, but 
continuing (%s).\n",
-                               
mStringTable->value(instance.mSuperType->mName).c_str());
-                       //return false;
+               int found = 0;
+               // If there is a super_index, we ought to be able to find this 
thing.
+               if (super_index)
+               {
+                       if (!instance.mSuperType->mNamespace)
+                       {
+                               if (instance.mSuperType->mNamespaceSet)
+                               {
+                                       int found = 0;
+                                       for (std::vector<Namespace*>::iterator 
i = 
+                                               
instance.mSuperType->mNamespaceSet->begin();
+                                               i != 
instance.mSuperType->mNamespaceSet->end();
+                                               ++i)
+                                       {
+                                               if 
((*i)->prototypeExists(super_index))
+                                                       ++found;
+                                       }
+                               }
+                       }
+                       else if 
(instance.mSuperType->mNamespace->prototypeExists(
+                               instance.mSuperType->mName))
+                       {
+                               ++found;
                }
 
-               // vstore now contains the object (we hope) which is the class 
that
-               // we want to be the super of this instance.
-               if (!vstore.is_object())
+                       if (found == 0)
+                       {
+                               if 
(!ch->getGlobalNs()->prototypeExists(instance.mSuperType->mName))
                {
-                       ERR((_("Action Block: Super prospect is not an 
object.\n")));
+                                       ERR((_("Action Block: Super type not 
found (%s), faking.\n"),
+                                               
mStringTable->value(instance.mSuperType->mName).c_str()));
+                                       // While testing, we will add the super 
to the global object to fake.
+                                       
ch->getGlobalNs()->stubPrototype(instance.mSuperType->mName);
                        //return false;
                }
+                       }
+                       else if (found > 1)
+                       {
+                               ERR((_("Action Block: Ambiguous declaration 
(%s)\n"),
+                                       
mStringTable->value(instance.mSuperType->mName).c_str()));
+                               return false;
+                       }
+               }
 
                uint8_t flags = in->read_u8();
                instance.mFlags = static_cast<abc_Instance::flags> (flags);
@@ -489,7 +522,7 @@
                                return false;
                        }
                        if (ns_index)
-                               instance.mProtectedNamespace = 
&mNamespacePool[ns_index];
+                               instance.mProtectedNamespace = 
mNamespacePool[ns_index];
                }
 
                // Get the interfaces.
@@ -528,15 +561,17 @@
                                return false;
                }
 
-               // And now we add this instance to the type names of the VM...
-               // TODO: Quit faking!
-               as_value fake;
-               if (global->get_member(instance.mName->mName, &fake))
+               if (instance.mName->mNamespace == NULL)
+               {
+                       ERR((_("Action Block: No namespace to use for storing 
class.\n")));
+                       return false;
+               }
+               if 
(!instance.mName->mNamespace->stubPrototype(instance.mName->mName))
                {
-                       fprintf(stderr, "Already registered, but doing it 
again?"
-                               "Type is %s\n", 
mStringTable->value(instance.mName->mName).c_str());
+                       ERR((_("Duplicate class registration for type %s.\n"),
+                               
mStringTable->value(instance.mName->mName).c_str()));
+                       return false;
                }
-               global->set_member(instance.mName->mName, as_value(2));
        } // end of instances list
 
        // Now the classes are read. TODO: Discover what these do.

Index: server/parser/abc_block.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/abc_block.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/parser/abc_block.h   23 Sep 2007 08:48:19 -0000      1.3
+++ server/parser/abc_block.h   24 Sep 2007 15:39:31 -0000      1.4
@@ -193,7 +193,7 @@
        std::vector<long double> mDoublePool;
        std::vector<std::string> mStringPool;
        std::vector<string_table::key> mStringPoolTableIds;
-       std::vector<Namespace> mNamespacePool;
+       std::vector<Namespace*> mNamespacePool;
        std::vector<NamespaceSet> mNamespaceSetPool;
        std::vector<abc_parsing::abc_Method> mMethods;
        std::vector<abc_parsing::abc_Multiname> mMultinamePool;

Index: server/swf/tag_loaders.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/tag_loaders.cpp,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -b -r1.140 -r1.141
--- server/swf/tag_loaders.cpp  21 Sep 2007 13:40:32 -0000      1.140
+++ server/swf/tag_loaders.cpp  24 Sep 2007 15:39:31 -0000      1.141
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: tag_loaders.cpp,v 1.140 2007/09/21 13:40:32 cmusick Exp $ */
+/* $Id: tag_loaders.cpp,v 1.141 2007/09/24 15:39:31 cmusick Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1974,7 +1974,10 @@
        if (success)
        {
                /* TODO: Run the script if needed. */
+               fprintf(stderr, "Block read was successful.\n");
        }
+       else
+               fprintf(stderr, "Block read failed.\n");
 
        log_unimpl(_("Action Block tags are parsed but not yet used"));
 }

Index: server/vm/VM.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/vm/VM.cpp    23 Sep 2007 08:48:19 -0000      1.20
+++ server/vm/VM.cpp    24 Sep 2007 15:39:31 -0000      1.21
@@ -16,7 +16,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: VM.cpp,v 1.20 2007/09/23 08:48:19 cmusick Exp $ */
+/* $Id: VM.cpp,v 1.21 2007/09/24 15:39:31 cmusick Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -30,6 +30,7 @@
 #include "tu_timer.h" // for tu_timer::get_ticks()
 #include "rc.h" //for overriding default version string with rcfile
 #include "namedStrings.h"
+#include "ClassHierarchy.h"
 
 #include <memory>
 
@@ -53,7 +54,8 @@
        assert(_singleton.get());
        NSV::load_strings(&_singleton->mStringTable, 
_singleton->getSWFVersion());
 
-       _singleton->setGlobal(new Global(*_singleton));
+       _singleton->mClassHierarchy = new ClassHierarchy;
+       _singleton->setGlobal(new Global(*_singleton, 
_singleton->mClassHierarchy));
        assert(_singleton->getGlobal());
 
        return *_singleton;

Index: server/vm/VM.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- server/vm/VM.h      19 Sep 2007 14:20:51 -0000      1.16
+++ server/vm/VM.h      24 Sep 2007 15:39:31 -0000      1.17
@@ -40,6 +40,8 @@
 
 namespace gnash {
 
+class ClassHierarchy;
+
 /// A GC root used to mark all reachable collectable pointers
 class VmGcRoot : public GcRoot 
 {
@@ -128,7 +130,10 @@
        ResVect _statics;
 #endif
 
+       /// Mutable since it should not affect how the VM runs.
        mutable string_table mStringTable;
+       /// Not mutable since changing this changes behavior of the VM.
+       ClassHierarchy *mClassHierarchy;
 
 public:
 
@@ -169,6 +174,7 @@
        /// Get the number of milliseconds since VM was started
        uint64_t getTime();
 
+       /// Get a reference to the string table used by the VM.
        string_table& getStringTable() const { return mStringTable; }
 
        /// Get version of the player, in a compatible representation
@@ -184,6 +190,9 @@
        /// Get a pointer to this VM's _global Object
        as_object* getGlobal() const;
 
+       /// Get a pointer to this VM's global ClassHierarchy object.
+       ClassHierarchy* getClassHierarchy() const { return mClassHierarchy; }
+       
        /// Get the SWF locale to use 
        std::locale& getLocale() const;
 
@@ -192,6 +201,7 @@
        /// - root movie / stage (_root_movie)
        /// - Global object (_global)
        /// - registered static GcResources (_statics)
+       /// - Class Hierarchy object
        ///
        ///
        void markReachableResources() const;




reply via email to

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