gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11626: Fix pythonmod build.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11626: Fix pythonmod build.
Date: Mon, 16 Nov 2009 09:31:22 +0100
User-agent: Bazaar (1.16.1)

------------------------------------------------------------
revno: 11626 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2009-11-16 09:31:22 +0100
message:
  Fix pythonmod build.
  
  Move things into abc namespace.
  
  Some important cleanups for ABC block comprehensibility.
modified:
  gui/pythonmod/gnash-view.cpp
  libcore/DisplayObject.cpp
  libcore/MovieLoader.cpp
  libcore/abc_function.cpp
  libcore/abc_function.h
  libcore/asClass.cpp
  libcore/asClass.h
  libcore/asMethod.cpp
  libcore/asMethod.h
  libcore/as_object.h
  libcore/asobj/Global_as.h
  libcore/asobj/Globals.cpp
  libcore/asobj/Globals.h
  libcore/asobj/MovieClipLoader.cpp
  libcore/movie_root.cpp
  libcore/movie_root.h
  libcore/parser/AbcBlock.cpp
  libcore/parser/AbcBlock.h
  libcore/swf/DoABCTag.h
  libcore/swf/SymbolClassTag.h
  libcore/vm/ASHandlers.cpp
  libcore/vm/Machine.cpp
  libcore/vm/Machine.h
  libcore/vm/MultiName.h
  libcore/vm/VM.cpp
  libcore/vm/VM.h
=== modified file 'gui/pythonmod/gnash-view.cpp'
--- a/gui/pythonmod/gnash-view.cpp      2009-11-04 17:29:00 +0000
+++ b/gui/pythonmod/gnash-view.cpp      2009-11-15 16:10:30 +0000
@@ -120,10 +120,10 @@
 
     gnash::as_value result;
     if( input_data ) {
-        result = getObject(view->movie)->callMethod(st.find(func_name),
-                                         gnash::as_value(input_data));
+        result = callMethod(getObject(view->movie),
+                st.find(func_name), gnash::as_value(input_data));
     } else {
-        result = getObject(view->movie)->callMethod(st.find(func_name));
+        result = callMethod(getObject(view->movie), st.find(func_name));
     }
     if( !result.is_string() ) {
         return NULL;

=== modified file 'libcore/DisplayObject.cpp'
--- a/libcore/DisplayObject.cpp 2009-11-13 13:18:11 +0000
+++ b/libcore/DisplayObject.cpp 2009-11-15 15:46:12 +0000
@@ -942,14 +942,17 @@
         as_value& val)
 {
     
-    string_table& st = getStringTable(*getObject(&obj));
+    as_object* o = getObject(&obj);
+    assert(o);
+
+    string_table& st = getStringTable(*o);
     const std::string& propname = st.value(key);
 
     // Check _level0.._level9
-    movie_root& mr = getRoot(*getObject(&obj));
+    movie_root& mr = getRoot(*o);
     unsigned int levelno;
-    if (mr.isLevelTarget(propname, levelno)) {
-        Movie* mo = mr.getLevel(levelno);
+    if (isLevelTarget(getSWFVersion(*o), propname, levelno)) {
+        MovieClip* mo = mr.getLevel(levelno);
         if (mo) {
             val = getObject(mo);
             return true;
@@ -974,14 +977,14 @@
         default:
             break;
         case NSV::PROP_uROOT:
-            if (getSWFVersion(*getObject(&obj)) < 5) break;
+            if (getSWFVersion(*o) < 5) break;
             val = getObject(obj.getAsRoot());
             return true;
         case NSV::PROP_uGLOBAL:
             // TODO: clean up this mess.
             assert(getObject(&obj));
-            if (getSWFVersion(*getObject(&obj)) < 6) break;
-            val = &getGlobal(*getObject(&obj));
+            if (getSWFVersion(*o) < 6) break;
+            val = &getGlobal(*o);
             return true;
     }
 

=== modified file 'libcore/MovieLoader.cpp'
--- a/libcore/MovieLoader.cpp   2009-11-15 14:33:03 +0000
+++ b/libcore/MovieLoader.cpp   2009-11-15 15:46:12 +0000
@@ -260,7 +260,8 @@
     else
     {
         unsigned int levelno;
-        if (_movieRoot.isLevelTarget(target, levelno))
+        const int version = _movieRoot.getVM().getSWFVersion();
+        if (isLevelTarget(version, target, levelno))
         {
             log_debug(_("processCompletedRequest: _level loading "
                     "(level %u)"), levelno);

=== modified file 'libcore/abc_function.cpp'
--- a/libcore/abc_function.cpp  2009-07-15 11:21:47 +0000
+++ b/libcore/abc_function.cpp  2009-11-15 16:26:27 +0000
@@ -21,7 +21,8 @@
 #include "fn_call.h"
 #include "Machine.h"
 
-namespace gnash{
+namespace gnash {
+namespace abc {
 
 abc_function::abc_function(asMethod* methodInfo, Machine* machine)
     :
@@ -36,7 +37,6 @@
 abc_function::operator()(const fn_call& fn)
 {
 
-
        log_abc("Calling an abc_function id=%u.", _methodInfo->methodID());
        as_value val = _machine->executeFunction(_methodInfo,fn);
        log_abc("Done calling abc_function id=%u value=%s",
@@ -45,5 +45,5 @@
 
 }
 
-
-}
+} // namespace abc
+} // namespace gnash

=== modified file 'libcore/abc_function.h'
--- a/libcore/abc_function.h    2009-07-02 07:39:11 +0000
+++ b/libcore/abc_function.h    2009-11-15 16:26:27 +0000
@@ -32,6 +32,7 @@
 #include "asMethod.h"
 
 namespace gnash {
+namespace abc {
 
 class Machine;
 
@@ -64,8 +65,7 @@
 
 };
 
-
-} // end of gnash namespace
-
-// __GNASH_ABC_FUNCTION_H__
+} // namespace abc
+} // gnash namespace
+
 #endif

=== modified file 'libcore/asClass.cpp'
--- a/libcore/asClass.cpp       2009-11-13 08:19:10 +0000
+++ b/libcore/asClass.cpp       2009-11-15 16:26:27 +0000
@@ -101,7 +101,8 @@
 asClass::addMethod(string_table::key name, Namespace* /*ns*/,
         asMethod* method, bool /*isstatic*/)
 {
-       as_value val = new abc_function(method, 
getVM(*_prototype).getMachine());
+       as_value val = new abc::abc_function(method,
+            getVM(*_prototype).getMachine());
        _prototype->init_member(name, val);
 //     int flags = PropFlags::readOnly | PropFlags::dontDelete
 //             | PropFlags::dontEnum;

=== modified file 'libcore/asClass.h'
--- a/libcore/asClass.h 2009-11-13 08:19:10 +0000
+++ b/libcore/asClass.h 2009-11-15 16:26:27 +0000
@@ -37,20 +37,24 @@
 #endif
 
 namespace gnash {
-
-class as_function;
-class Namespace;
-class asMethod;
-class asClass;
-typedef Property asBinding;
-class asBoundValue;
-class asBoundAccessor;
-class ClassHierarchy;
-class Property;
-class MultiName;
-class Machine;
-class abc_function;
-
+    namespace abc {
+        class Machine;
+        class MultiName;
+        class abc_function;
+    }
+    class as_function;
+    class Namespace;
+    class asMethod;
+    class asClass;
+    typedef Property asBinding;
+    class asBoundValue;
+    class asBoundAccessor;
+    class ClassHierarchy;
+    class Property;
+}
+
+namespace gnash {
+ 
 /// A class to represent, abstractly, ActionScript prototypes.
 ///
 /// This class is intended to be able to capture the structure of an
@@ -209,8 +213,8 @@
                return &i->second;
        }
 
-       asBinding* getGetBinding(as_value& v, MultiName& n);
-       asBinding* getSetBinding(as_value& v, MultiName& n);
+       asBinding* getGetBinding(as_value& v, abc::MultiName& n);
+       asBinding* getSetBinding(as_value& v, abc::MultiName& n);
     std::vector<abc::Trait> _traits;
 
 #endif

=== modified file 'libcore/asMethod.cpp'
--- a/libcore/asMethod.cpp      2009-11-13 08:19:10 +0000
+++ b/libcore/asMethod.cpp      2009-11-15 16:26:27 +0000
@@ -169,9 +169,9 @@
 }
 
 void
-asMethod::initPrototype(Machine* machine)
+asMethod::initPrototype(abc::Machine* machine)
 {
-       _prototype = new abc_function(this,machine);
+       _prototype = new abc::abc_function(this,machine);
 }
 
 bool

=== modified file 'libcore/asMethod.h'
--- a/libcore/asMethod.h        2009-11-13 08:19:10 +0000
+++ b/libcore/asMethod.h        2009-11-15 16:26:27 +0000
@@ -31,11 +31,13 @@
 
 // Forward declarations
 namespace gnash {
+    namespace abc {
+        class Machine;
+        class abc_function;
+    }
     class CodeStream;
-    class Machine;
     class as_object;
     class asClass;
-    class abc_function;
 }
 
 namespace gnash {
@@ -61,7 +63,7 @@
         _methodID = m;
     }
 
-       void initPrototype(Machine* machine);
+       void initPrototype(abc::Machine* machine);
 
        boost::uint32_t getMaxRegisters() { return _maxRegisters;}
 
@@ -97,7 +99,7 @@
         return _scopeDepth;
     }
 
-       abc_function* getPrototype() { return _prototype; }
+    abc::abc_function* getPrototype() { return _prototype; }
 
        asBinding* getBinding(string_table::key name);
 
@@ -263,7 +265,7 @@
        
     boost::uint32_t _methodID;
 
-    abc_function* _prototype;
+    abc::abc_function* _prototype;
        int _minArguments;
        int _maxArguments;
        boost::uint32_t _bodyLength;

=== modified file 'libcore/as_object.h'
--- a/libcore/as_object.h       2009-11-13 12:29:42 +0000
+++ b/libcore/as_object.h       2009-11-15 16:26:27 +0000
@@ -41,14 +41,15 @@
 
 // Forward declarations
 namespace gnash {
+    namespace abc {
+        class Machine;
+    }
     class as_function;
     class MovieClip;
     class DisplayObject;
     class as_environment;
     class VM;
-    class Machine;
     class IOChannel;
-    class event_id;
     class movie_root;
     class asClass;
     class RunResources;
@@ -164,7 +165,7 @@
 class as_object : public GcResource
 {
     friend class asClass;
-    friend class Machine;
+    friend class abc::Machine;
 
     typedef std::set<std::pair<string_table::key, string_table::key> >
         propNameSet;

=== modified file 'libcore/asobj/Global_as.h'
--- a/libcore/asobj/Global_as.h 2009-10-23 06:25:25 +0000
+++ b/libcore/asobj/Global_as.h 2009-11-15 16:26:27 +0000
@@ -26,7 +26,6 @@
 // Forward declarations
 namespace gnash {
        class builtin_function;
-       class Machine;
        class as_value;
        class VM;
        class ClassHierarchy;

=== modified file 'libcore/asobj/Globals.cpp'
--- a/libcore/asobj/Globals.cpp 2009-11-13 14:22:50 +0000
+++ b/libcore/asobj/Globals.cpp 2009-11-15 16:26:27 +0000
@@ -164,7 +164,7 @@
             string_table::key className);
 }
 
-AVM2Global::AVM2Global(Machine& /*machine*/, VM& vm)
+AVM2Global::AVM2Global(abc::Machine& /*machine*/, VM& vm)
     :
     _classes(this, 0),
     _vm(vm)

=== modified file 'libcore/asobj/Globals.h'
--- a/libcore/asobj/Globals.h   2009-10-14 14:20:47 +0000
+++ b/libcore/asobj/Globals.h   2009-11-15 16:26:27 +0000
@@ -50,7 +50,9 @@
 
 // Forward declarations
 namespace gnash {
-       class Machine;
+    namespace abc {
+        class Machine;
+    }
        class VM;
        class fn_call;
 }
@@ -120,7 +122,7 @@
     //
     /// This takes a VM argument because most access to necessary
     /// resources is still through the VM.
-       AVM2Global(Machine& m, VM& vm);
+       AVM2Global(abc::Machine& m, VM& vm);
        ~AVM2Global() {}
     
     void registerClasses();

=== modified file 'libcore/asobj/MovieClipLoader.cpp'
--- a/libcore/asobj/MovieClipLoader.cpp 2009-11-13 12:29:42 +0000
+++ b/libcore/asobj/MovieClipLoader.cpp 2009-11-15 15:46:12 +0000
@@ -129,7 +129,7 @@
     // TODO: check if this logic can be generic to movie_root::loadMovie
        DisplayObject* target = fn.env().find_target(tgt_str);
     unsigned int junk;
-       if (!target && ! mr.isLevelTarget(tgt_str, junk) ) {
+       if (!target && ! isLevelTarget(getSWFVersion(fn), tgt_str, junk) ) {
                IF_VERBOSE_ASCODING_ERRORS(
                log_aserror(_("Could not find target %s (evaluated from %s)"),
                        tgt_str, tgt_arg);

=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp    2009-11-15 14:33:03 +0000
+++ b/libcore/movie_root.cpp    2009-11-15 15:46:12 +0000
@@ -466,16 +466,15 @@
        setLevel(num, extern_movie);
 }
 
-Movie*
+MovieClip*
 movie_root::getLevel(unsigned int num) const
 {
-       Levels::const_iterator i = _movies.find(num +
-            DisplayObject::staticDepthOffset);
-       if ( i == _movies.end() ) return 0;
-
-    // TODO: if this has to be a Movie, why isn't it stored as one?
-       assert(dynamic_cast<Movie*>(i->second));
-       return dynamic_cast<Movie*>(i->second);
+       Levels::const_iterator i =
+        _movies.find(num + DisplayObject::staticDepthOffset);
+
+       if (i == _movies.end()) return 0;
+
+       return i->second;
 }
 
 void
@@ -2052,25 +2051,6 @@
 
 }
 
-bool
-movie_root::isLevelTarget(const std::string& name, unsigned int& levelno)
-{
-  if ( _vm.getSWFVersion() > 6 )
-  {
-    if ( name.compare(0, 6, "_level") ) return false;
-  }
-  else
-  {
-    StringNoCaseEqual noCaseCmp;
-    if (!noCaseCmp(name.substr(0, 6), "_level")) return false;
-  }
-
-  if ( name.find_first_not_of("0123456789", 7) != std::string::npos ) return 
false;
-  levelno = strtoul(name.c_str()+6, NULL, 0); // getting 0 here for "_level" 
is intentional
-  return true;
-
-}
-
 void
 movie_root::setScriptLimits(boost::uint16_t recursion, boost::uint16_t timeout)
 {
@@ -2177,13 +2157,33 @@
 std::string
 movie_root::callInterface(const std::string& cmd, const std::string& arg) const
 {
-       if ( _interfaceHandler ) return _interfaceHandler->call(cmd, arg);
+       if (_interfaceHandler) return _interfaceHandler->call(cmd, arg);
 
        log_error("Hosting application registered no callback for 
events/queries");
 
        return "<no iface to hosting app>";
 }
 
+bool
+isLevelTarget(int version, const std::string& name, unsigned int& levelno)
+{
+    if (version > 6) {
+        if (name.compare(0, 6, "_level")) return false;
+    }
+    else {
+        StringNoCaseEqual noCaseCmp;
+        if (!noCaseCmp(name.substr(0, 6), "_level")) return false;
+    }
+
+    if (name.find_first_not_of("0123456789", 7) != std::string::npos) {
+        return false;
+    }
+    // getting 0 here for "_level" is intentional
+    levelno = std::strtoul(name.c_str() + 6, NULL, 0); 
+    return true;
+
+}
+
 short
 stringToStageAlign(const std::string& str)
 {

=== modified file 'libcore/movie_root.h'
--- a/libcore/movie_root.h      2009-11-12 21:00:31 +0000
+++ b/libcore/movie_root.h      2009-11-15 15:46:12 +0000
@@ -186,7 +186,7 @@
     /// POST CONDITIONS:
     /// - The returned DisplayObject has a depth equal to 'num'
     ///
-    Movie* getLevel(unsigned int num) const;
+    MovieClip* getLevel(unsigned int num) const;
 
     /// Put the given movie at the given level 
     //
@@ -739,17 +739,6 @@
             const std::string& data, MovieClip::VariablesMethod method);
 
 
-    /// Return true if the given string can be interpreted as a _level name
-    //
-    /// @param name
-    ///   The target string.
-    ///   Will be considered case-insensitive if VM version is < 7.
-    ///
-    /// @param levelno
-    ///   Output parameter, will be set to the level number, if true is
-    ///   returned
-    bool isLevelTarget(const std::string& name, unsigned int& levelno);
-
     key::code lastKeyEvent() const {
         return _lastKeyEvent;
     }
@@ -1178,6 +1167,17 @@
 
 };
 
+/// Return true if the given string can be interpreted as a _level name
+//
+/// @param name
+///   The target string.
+///   Will be considered case-insensitive if VM version is < 7.
+///
+/// @param levelno
+///   Output parameter, will be set to the level number, if true is
+///   returned
+bool isLevelTarget(int version, const std::string& name, unsigned int& 
levelno);
+
 DSOEXPORT short stringToStageAlign(const std::string& s);
 
 } // namespace gnash

=== modified file 'libcore/parser/AbcBlock.cpp'
--- a/libcore/parser/AbcBlock.cpp       2009-11-13 14:21:56 +0000
+++ b/libcore/parser/AbcBlock.cpp       2009-11-15 16:26:27 +0000
@@ -314,10 +314,6 @@
     }
 }
 
-} // abc
-
-using namespace abc;
-
 AbcBlock::AbcBlock()
     :
     _stringTable(&VM::get().getStringTable())
@@ -388,7 +384,7 @@
 }
 
 void
-AbcBlock::setMultinameNames(MultiName *n, string_table::key ABCName)
+AbcBlock::setMultinameNames(MultiName *n, abc::URI ABCName)
 {
        
        n->setABCName(ABCName);
@@ -401,7 +397,7 @@
 }
 
 void
-AbcBlock::setNamespaceURI(Namespace *ns, string_table::key ABCName)
+AbcBlock::setNamespaceURI(Namespace *ns, abc::URI ABCName)
 {
        std::string name = _stringPool[ABCName];
        string_table::key global_key = _stringTable->find(name);
@@ -1485,5 +1481,6 @@
     }
 }
 
-} /* namespace gnash */
+} // namespace abc
+} // namespace gnash
 

=== modified file 'libcore/parser/AbcBlock.h'
--- a/libcore/parser/AbcBlock.h 2009-11-13 08:19:10 +0000
+++ b/libcore/parser/AbcBlock.h 2009-11-15 16:26:27 +0000
@@ -32,23 +32,24 @@
 #include <stdexcept>
 
 namespace gnash {
-       class SWFStream; // for read signature
+    namespace abc {
+        class AbcBlock;
+        class Machine;
+    }
+    class SWFStream; // for read signature
+    class ClassHierarchy;
+    class asMethod;
+    class asClass;
 }
 
 namespace gnash {
-
-class AbcBlock;
-class ClassHierarchy;
-class asMethod;
-class asClass;
-class Machine;
-
 namespace abc {
 
 class Trait
 {
 public:
 
+
     enum Kind
        {
                KIND_SLOT = 0,
@@ -66,8 +67,11 @@
        boost::uint32_t _typeIndex;
        boost::uint32_t _classInfoIndex;
        as_value _value;
-       string_table::key _name;
+
+       URI _name;
+
        string_table::key _globalName;
+
        Namespace* _namespace;
        asMethod* _method;
        bool _valueSet;
@@ -122,8 +126,6 @@
 /// Output stream operator for abc::Trait::Kind
 std::ostream& operator<<(std::ostream& o, const Trait::Kind k);
 
-} // namespace abc
-
 namespace {
 
 template<typename T>
@@ -316,9 +318,9 @@
 
        void check_multiname_namespaceset(boost::uint32_t nsset);
 
-       void setMultinameNames(MultiName *n,string_table::key ABCName);
+       void setMultinameNames(MultiName *n, abc::URI ABCName);
 
-       void setNamespaceURI(Namespace *ns,string_table::key ABCName);
+       void setNamespaceURI(Namespace *ns, abc::URI ABCName);
 
        std::vector<boost::int32_t> _integerPool;
        std::vector<boost::uint32_t> _uIntegerPool;
@@ -349,8 +351,9 @@
 std::ostream& operator<<(std::ostream& o, AbcBlock::InstanceConstant c);
 std::ostream& operator<<(std::ostream& o, AbcBlock::PoolConstant c);
 
-} 
-
-
-#endif /* GNASH_ABC_BLOCK_H */
+} // namespace abc
+} // namespace gnash
+
+
+#endif 
 

=== modified file 'libcore/swf/DoABCTag.h'
--- a/libcore/swf/DoABCTag.h    2009-10-27 09:44:54 +0000
+++ b/libcore/swf/DoABCTag.h    2009-11-15 16:26:27 +0000
@@ -53,7 +53,7 @@
                VM& vm = getVM(*getObject(m));
         
         log_debug("getting machine.");
-               Machine *mach = vm.getMachine();
+        abc::Machine *mach = vm.getMachine();
                
         _abc->prepare(mach);
 
@@ -92,7 +92,7 @@
                        in.read_string(name);
                }
 
-        std::auto_ptr<AbcBlock> block(new AbcBlock());
+        std::auto_ptr<abc::AbcBlock> block(new abc::AbcBlock());
                if (!block->read(in)) {
             log_error("ABC parsing error while processing DoABCTag. This "
                     "tag will never be executed");
@@ -112,9 +112,9 @@
 
 private:
 
-       DoABCTag(AbcBlock* block) : _abc(block) {}
+       DoABCTag(abc::AbcBlock* block) : _abc(block) {}
 
-       AbcBlock* _abc;
+    abc::AbcBlock* _abc;
        
 };
 

=== modified file 'libcore/swf/SymbolClassTag.h'
--- a/libcore/swf/SymbolClassTag.h      2009-10-27 09:44:54 +0000
+++ b/libcore/swf/SymbolClassTag.h      2009-11-15 16:26:27 +0000
@@ -45,7 +45,7 @@
        virtual void execute(MovieClip* m, DisplayList& /* dlist */) const
        {
                VM& vm = getVM(*getObject(m));
-               Machine* mach = vm.getMachine();
+        abc::Machine* mach = vm.getMachine();
                log_debug("SymbolClassTag: Creating class %s.", _rootClass);
                mach->instantiateClass(_rootClass, vm.getGlobal());
        }

=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2009-11-13 13:43:08 +0000
+++ b/libcore/vm/ASHandlers.cpp 2009-11-15 15:46:12 +0000
@@ -2099,8 +2099,7 @@
         const std::string& url, boost::uint8_t method)
 {
 
-    if (url.empty())
-    {
+    if (url.empty()) {
         log_error(_("Bogus empty GetUrl url in SWF file, skipping"));
         return;
     }
@@ -2112,8 +2111,7 @@
     MovieClip::VariablesMethod sendVarsMethod;
 
     // handle malformed sendVarsMethod
-    if ((method & 3) == 3)
-    {
+    if ((method & 3) == 3) {
         log_error(_("Bogus GetUrl2 send vars method "
             " in SWF file (both GET and POST requested). Using GET"));
         sendVarsMethod = MovieClip::METHOD_GET;
@@ -2217,7 +2215,7 @@
         if (!target_ch)
         {
             unsigned int levelno;
-            if (m.isLevelTarget(target_string, levelno))
+            if (isLevelTarget(getSWFVersion(env), target_string, levelno))
             {
                 log_debug(_("Testing _level loading (level %u)"), levelno);
  
@@ -2260,7 +2258,7 @@
     }
 
     unsigned int levelno;
-    if (m.isLevelTarget(target_string, levelno))
+    if (isLevelTarget(getSWFVersion(env), target_string, levelno))
     {
         log_debug(_("Testing _level loading (level %u)"), levelno);
         m.loadMovie(url, target_string, varsToSend, sendVarsMethod);

=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp    2009-11-13 12:29:42 +0000
+++ b/libcore/vm/Machine.cpp    2009-11-15 16:26:27 +0000
@@ -22,6 +22,7 @@
 #include "ClassHierarchy.h"
 #include "namedStrings.h"
 #include "AbcBlock.h"
+#include "MultiName.h"
 #include "fn_call.h"
 #include "abc_function.h"
 #include "action.h"
@@ -31,6 +32,8 @@
 #include "Global_as.h"
 
 namespace gnash {
+namespace abc {
+
 /// The type of exceptions thrown by ActionScript.
 class ASException
 {
@@ -314,24 +317,24 @@
 }
 
 Machine::Machine(VM& vm)
-        :
-        _stack(),
-        _registers(),
-        _scopeStack(),
-        mStream(0),
-        mST(vm.getStringTable()),
-        mDefaultXMLNamespace(0),
-        mCurrentScope(0),
-        mGlobalScope(0),
-        mDefaultThis(0),
-        mThis(0),
-        _global(0),
-        mGlobalReturn(),
-        mIgnoreReturn(),
-        mExitWithReturn(false),
-        mPoolObject(0),
-        mCurrentFunction(0),
-        _vm(vm)
+    :
+    _stack(),
+    _registers(),
+    _scopeStack(),
+    mStream(0),
+    mST(vm.getStringTable()),
+    mDefaultXMLNamespace(0),
+    mCurrentScope(0),
+    mGlobalScope(0),
+    mDefaultThis(0),
+    mThis(0),
+    _global(0),
+    mGlobalReturn(),
+    mIgnoreReturn(),
+    mExitWithReturn(false),
+    mPoolObject(0),
+    mCurrentFunction(0),
+    _vm(vm)
 {
                
 }
@@ -3335,5 +3338,5 @@
 }
 
 
-
-} // end of namespace gnash
+} // namespace abc
+} // namespace gnash

=== modified file 'libcore/vm/Machine.h'
--- a/libcore/vm/Machine.h      2009-11-13 08:19:10 +0000
+++ b/libcore/vm/Machine.h      2009-11-15 16:26:27 +0000
@@ -30,11 +30,13 @@
 #include "fn_call.h"
 
 namespace gnash {
+    namespace abc {
+        class AbcBlock;
+        class MultiName;
+    }
     class Global_as;
     class DisplayObject;
     class as_object;
-    class AbcBlock;
-    class MultiName;
     class Property;
     class CodeStream;
 }
@@ -42,6 +44,8 @@
 
 namespace gnash {
 
+namespace abc {
+
 /// This machine is intended to work without relying on the C++ call stack,
 /// by resetting its Stream and Stack members (actually, by limiting the stack)
 /// to make function calls, rather than calling them directly in C++.
@@ -132,7 +136,8 @@
        /// This returns the value, but on the stack.
        /// (Since the return value is not known until after control has left
        /// the caller of this, it's impossible to return a meaningful value.
-       void getMember(asClass* pDefinition, MultiName& name, as_value& source);
+       void getMember(asClass* pDefinition, MultiName& name,
+            as_value& source);
 
        /// Set a member in an object.
        ///
@@ -368,12 +373,12 @@
        as_value mIgnoreReturn; // Throw away returns go here.
 
        bool mExitWithReturn;
-       AbcBlock* mPoolObject; // Where all of the pools are stored.
+    AbcBlock* mPoolObject; // Where all of the pools are stored.
 
        abc_function* mCurrentFunction;
 
        VM& _vm;
 };
-
+} // namespace abc
 } // namespace gnash
 #endif 

=== modified file 'libcore/vm/MultiName.h'
--- a/libcore/vm/MultiName.h    2009-11-13 08:19:10 +0000
+++ b/libcore/vm/MultiName.h    2009-11-15 16:26:27 +0000
@@ -25,6 +25,16 @@
 class Namespace;
 class Property;
 
+namespace abc {
+
+/// This type should always be used for the index of AbcBlocks' names.
+//
+/// It serves to distinguish them from global names, which are identified
+/// by a string_table::key. This identifies global names' position in the
+/// string_table. AbcBlock resources have nothing to do with the string_table
+/// and their URI does not correspond to a string_table entry, so it
+/// makes no sense whatsoever to use string_table::key to index them.   
+typedef size_t URI;
 
 /// An MultiName represents a single ABC multiname.
 //
@@ -80,8 +90,8 @@
        void setNamespace(Namespace *ns) { _namespace = ns; }
        Namespace* getNamespace() const { return _namespace; }
 
-       string_table::key getABCName() const { return _abcName; }
-       void setABCName(string_table::key n) { _abcName = n;}
+    abc::URI getABCName() const { return _abcName; }
+       void setABCName(abc::URI n) { _abcName = n;}
 
        string_table::key getGlobalName() const { return _globalName;}
        void setGlobalName(string_table::key n) { _globalName = n;}
@@ -115,11 +125,14 @@
 
     std::vector<Namespace*>* _namespaceSet;
 
-       string_table::key _abcName;
+    abc::URI _abcName;
+
        string_table::key _globalName;
+
        Namespace* _namespace;
 
 };
 
+} // namespace abc
 } // namespace gnash
 #endif 

=== modified file 'libcore/vm/VM.cpp'
--- a/libcore/vm/VM.cpp 2009-10-09 05:39:24 +0000
+++ b/libcore/vm/VM.cpp 2009-11-15 16:26:27 +0000
@@ -73,7 +73,7 @@
     gl->registerClasses();
 
 #ifdef ENABLE_AVM2
-       _singleton->_machine = new Machine(*_singleton);
+       _singleton->_machine = new abc::Machine(*_singleton);
     _singleton->_machine->init();
 #endif
 

=== modified file 'libcore/vm/VM.h'
--- a/libcore/vm/VM.h   2009-10-07 07:46:44 +0000
+++ b/libcore/vm/VM.h   2009-11-15 16:26:27 +0000
@@ -37,6 +37,9 @@
 
 // Forward declarations
 namespace gnash {
+    namespace abc {
+        class Machine;
+    }
        class Global_as;
        class VM;
        class fn_call;
@@ -45,7 +48,6 @@
     class SharedObjectLibrary;
        class as_value;
        class as_object;
-       class Machine;
        class VirtualClock;
 }
 
@@ -182,7 +184,7 @@
 
 #ifdef ENABLE_AVM2
        /// Get a pointer to the machine, if it exists.
-       Machine* getMachine() const { return _machine; }
+    abc::Machine* getMachine() const { return _machine; }
 #endif
 
        /// Get version of the player, in a compatible representation
@@ -323,7 +325,7 @@
 
 #ifdef ENABLE_AVM2
        /// A running execution thread.
-       Machine *_machine;
+    abc::Machine *_machine;
 #endif
 
        VirtualClock& _clock;


reply via email to

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