[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11630: Move AS3-specific classes in
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11630: Move AS3-specific classes into libcore/abc and under the abc namespace. |
Date: |
Mon, 16 Nov 2009 16:50:35 +0100 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11630 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2009-11-16 16:50:35 +0100
message:
Move AS3-specific classes into libcore/abc and under the abc namespace.
This may reduce the confusion about what parts of Gnash are for what purpose.
added:
libcore/abc/
renamed:
libcore/abc_function.cpp => libcore/abc/abc_function.cpp
libcore/abc_function.h => libcore/abc/abc_function.h
libcore/asBoundValues.h => libcore/abc/BoundValues.h
libcore/asClass.cpp => libcore/abc/Class.cpp
libcore/asClass.h => libcore/abc/Class.h
libcore/asException.h => libcore/abc/asException.h
libcore/asMethod.cpp => libcore/abc/Method.cpp
libcore/asMethod.h => libcore/abc/Method.h
libcore/parser/AbcBlock.cpp => libcore/abc/AbcBlock.cpp
libcore/parser/AbcBlock.h => libcore/abc/AbcBlock.h
libcore/vm/MultiName.h => libcore/abc/MultiName.h
modified:
libcore/ClassHierarchy.cpp
libcore/ClassHierarchy.h
libcore/Makefile.am
libcore/Namespace.cpp
libcore/Namespace.h
libcore/as_object.cpp
libcore/as_object.h
libcore/parser/Makefile.am
libcore/vm/Machine.cpp
libcore/vm/Machine.h
libcore/vm/Makefile.am
libcore/abc/abc_function.cpp
libcore/abc/abc_function.h
libcore/abc/BoundValues.h
libcore/abc/Class.cpp
libcore/abc/Class.h
libcore/abc/asException.h
libcore/abc/Method.cpp
libcore/abc/Method.h
libcore/abc/AbcBlock.cpp
libcore/abc/AbcBlock.h
=== modified file 'libcore/ClassHierarchy.cpp'
--- a/libcore/ClassHierarchy.cpp 2009-11-16 11:16:48 +0000
+++ b/libcore/ClassHierarchy.cpp 2009-11-16 14:42:56 +0000
@@ -23,7 +23,7 @@
#include "ClassHierarchy.h"
#include "as_function.h"
#include "builtin_function.h"
-#include "asClass.h"
+#include "Class.h"
#include "Global_as.h"
#include "Object.h"
#include "extension.h"
=== modified file 'libcore/ClassHierarchy.h'
--- a/libcore/ClassHierarchy.h 2009-11-13 08:19:10 +0000
+++ b/libcore/ClassHierarchy.h 2009-11-16 14:42:56 +0000
@@ -25,13 +25,13 @@
#include "as_object.h"
#include "SafeStack.h"
-#include "asClass.h"
+#include "Class.h"
#include "Namespace.h"
#ifdef ENABLE_AVM2
-# include "asBoundValues.h"
+# include "BoundValues.h"
# include "asException.h"
-# include "asMethod.h"
+# include "Method.h"
#endif
#include <list>
@@ -207,8 +207,8 @@
return &mNamespaces[uri];
}
- /// Create a new asClass object for use.
- asClass* newClass() {
+ /// Create a new abc::Class object for use.
+ abc::Class* newClass() {
mClassMemory.grow(1);
return &mClassMemory.top(0);
}
@@ -220,18 +220,18 @@
return &mExceptionMemory.top(0);
}
- /// Create a new asMethod object for use.
- asMethod* newMethod() {
+ /// Create a new Method object for use.
+ abc::Method* newMethod() {
mMethodMemory.grow(1);
return &mMethodMemory.top(0);
}
- asBoundValue* newBoundValue() {
+ abc::BoundValue* newBoundValue() {
mBoundValueMemory.grow(1);
return &mBoundValueMemory.top(0);
}
- asBoundAccessor* newBoundAccessor() {
+ abc::BoundAccessor* newBoundAccessor() {
mBoundAccessorMemory.grow(1);
return &mBoundAccessorMemory.top(0);
}
@@ -249,13 +249,13 @@
namespacesContainer mNamespaces;
SafeStack<Namespace> mAnonNamespaces;
Namespace* mGlobalNamespace;
- SafeStack<asClass> mClassMemory;
+ SafeStack<abc::Class> mClassMemory;
#ifdef ENABLE_AVM2
SafeStack<asException> mExceptionMemory;
- SafeStack<asMethod> mMethodMemory;
- SafeStack<asBoundValue> mBoundValueMemory;
- SafeStack<asBoundAccessor> mBoundAccessorMemory;
+ SafeStack<abc::Method> mMethodMemory;
+ SafeStack<abc::BoundValue> mBoundValueMemory;
+ SafeStack<abc::BoundAccessor> mBoundAccessorMemory;
#endif
};
=== modified file 'libcore/Makefile.am'
--- a/libcore/Makefile.am 2009-11-16 12:29:31 +0000
+++ b/libcore/Makefile.am 2009-11-16 14:42:56 +0000
@@ -32,6 +32,7 @@
-I$(top_srcdir)/libnet \
-I$(top_srcdir)/backend \
-I$(top_srcdir)/libcore/swf \
+ -I$(top_srcdir)/libcore/abc \
-I$(top_srcdir)/libcore/asobj \
-I$(top_srcdir)/libcore/asobj/flash \
-I$(top_srcdir)/libcore/parser \
@@ -129,7 +130,7 @@
styles.cpp \
Timers.cpp \
RGBA.cpp \
- asClass.cpp \
+ abc/Class.cpp \
MovieFactory.cpp \
MovieLoader.cpp \
Namespace.cpp \
@@ -138,8 +139,9 @@
if ENABLE_AVM2
libgnashcore_la_SOURCES += \
- abc_function.cpp \
- asMethod.cpp \
+ abc/abc_function.cpp \
+ abc/Method.cpp \
+ abc/AbcBlock.cpp \
$(NULL)
endif
@@ -213,10 +215,12 @@
if ENABLE_AVM2
noinst_HEADERS += \
swf/DoABCTag.h \
- abc_function.h \
- asMethod.h \
- asException.h \
- asBoundValues.h \
+ abc/abc_function.h \
+ abc/Method.h \
+ abc/asException.h \
+ abc/BoundValues.h \
+ abc/AbcBlock.h \
+ abc/MultiName.h \
$(NULL)
endif
@@ -265,7 +269,7 @@
RGBA.h \
Geometry.h \
Video.h \
- asClass.h \
+ abc/Class.h \
Namespace.h \
$(NULL)
=== modified file 'libcore/Namespace.cpp'
--- a/libcore/Namespace.cpp 2009-11-13 14:22:20 +0000
+++ b/libcore/Namespace.cpp 2009-11-16 14:42:56 +0000
@@ -32,7 +32,7 @@
void
Namespace::stubPrototype(ClassHierarchy& ch, string_table::key name)
{
- asClass *pClass = ch.newClass();
+ abc::Class *pClass = ch.newClass();
pClass->setName(name);
addClass(name, pClass);
}
=== modified file 'libcore/Namespace.h'
--- a/libcore/Namespace.h 2009-11-13 14:22:20 +0000
+++ b/libcore/Namespace.h 2009-11-16 14:42:56 +0000
@@ -23,7 +23,9 @@
// Forward declarations
namespace gnash {
- class asClass;
+ namespace abc {
+ class Class;
+ }
class ClassHierarchy;
class string_table;
}
@@ -73,7 +75,7 @@
/// Add a class to the namespace. The namespace stores this, but
/// does not take ownership. (So don't delete it.)
- bool addClass(string_table::key name, asClass *a)
+ bool addClass(string_table::key name, abc::Class *a)
{
if (getClassInternal(name)) return false;
_classes[static_cast<std::size_t>(name)] = a;
@@ -84,11 +86,11 @@
/// Get the named class. Returns NULL if information is not known
/// about the class. (Stubbed classes still return NULL here.)
- asClass* getClass(string_table::key name)
+ abc::Class* getClass(string_table::key name)
{
if (mRecursePrevent) return NULL;
- asClass* found = getClassInternal(name);
+ abc::Class* found = getClassInternal(name);
if (found || !getParent()) return found;
@@ -118,7 +120,7 @@
string_table::key _uri;
string_table::key _prefix;
- typedef std::map<string_table::key, asClass*> container;
+ typedef std::map<string_table::key, abc::Class*> container;
container _classes;
mutable bool mRecursePrevent;
@@ -126,7 +128,7 @@
bool _protected;
bool _package;
- asClass* getClassInternal(string_table::key name) const
+ abc::Class* getClassInternal(string_table::key name) const
{
container::const_iterator i;
=== added directory 'libcore/abc'
=== renamed file 'libcore/parser/AbcBlock.cpp' => 'libcore/abc/AbcBlock.cpp'
--- a/libcore/parser/AbcBlock.cpp 2009-11-15 16:26:27 +0000
+++ b/libcore/abc/AbcBlock.cpp 2009-11-16 14:42:56 +0000
@@ -24,7 +24,7 @@
#include "VM.h"
#include "log.h"
#include "ClassHierarchy.h"
-#include "asClass.h"
+#include "Class.h"
#include "namedStrings.h"
#include "CodeStream.h"
#include "action_buffer.h"
@@ -36,7 +36,7 @@
namespace abc {
bool
-Trait::finalize(AbcBlock *pBlock, asClass *pClass, bool do_static)
+Trait::finalize(AbcBlock *pBlock, abc::Class *pClass, bool do_static)
{
log_abc("Finalize class %s (%s), trait kind: %s",
pBlock->_stringTable->value(pClass->getName()), pClass, _kind);
@@ -47,7 +47,7 @@
case KIND_CONST:
{
// Validate the type.
- asClass *pType;
+ abc::Class *pType;
if (_typeIndex) {
log_abc("Trait type: %s",
pBlock->_stringPool[
@@ -115,7 +115,7 @@
}
bool
-Trait::finalize_mbody(AbcBlock *pBlock, asMethod *pMethod)
+Trait::finalize_mbody(AbcBlock *pBlock, Method *pMethod)
{
log_abc("Finalizing method trait: kind %s", _kind);
switch (_kind)
@@ -124,7 +124,7 @@
case KIND_CONST:
{
// Validate the type.
- asClass *pType;
+ abc::Class *pType;
if (_typeIndex) {
pType =
pBlock->locateClass(pBlock->_multinamePool[_typeIndex]);
}
@@ -329,7 +329,7 @@
{
std::for_each(_classes.begin(), _classes.end(),
- std::mem_fun(&asClass::initPrototype));
+ std::mem_fun(&abc::Class::initPrototype));
// The last (entry) script has Global as its prototype.
// This can be deduced because the global classes are initialized with a
@@ -341,10 +341,10 @@
// scripts have Global as a target object (prototype), so for now we
// will do that.
std::for_each(_scripts.begin(), _scripts.end(),
- boost::bind(&asClass::setPrototype, _1, mach->global()));
+ boost::bind(&abc::Class::setPrototype, _1, mach->global()));
std::for_each(_methods.begin(), _methods.end(),
- boost::bind(&asMethod::initPrototype, _1, mach));
+ boost::bind(&Method::initPrototype, _1, mach));
std::for_each(_traits.begin(), _traits.end(),
boost::bind(&Trait::finalize, _1, this));
@@ -405,7 +405,7 @@
log_abc("Namespace: %s AbcURI=%u URI=%u.", name, ABCName, global_key);
}
-asClass*
+abc::Class*
AbcBlock::locateClass(const std::string& className)
{
@@ -436,10 +436,10 @@
}
-asClass*
+abc::Class*
AbcBlock::locateClass(MultiName& m)
{
- asClass* found = 0;
+ abc::Class* found = 0;
if (m.getNamespace())
{
@@ -798,7 +798,7 @@
for (unsigned int i = 0; i < count; ++i)
{
log_abc(" Reading method %u", i);
- asMethod *pMethod = mCH->newMethod();
+ Method *pMethod = mCH->newMethod();
pMethod->setMethodID(i);
_methods[i] = pMethod;
boost::uint32_t param_count = _stream->read_V32();
@@ -826,7 +826,7 @@
// TODO: this can be 'void', which clearly isn't a class, so this
// seems bogus. As setReturnType is a no-op, we should log it
// and ignore it.
- asClass* rtClass = locateClass(_multinamePool[return_type]);
+ abc::Class* rtClass = locateClass(_multinamePool[return_type]);
if (!rtClass) {
log_abc(_("ABC: Unknown return type."));
}
@@ -851,7 +851,7 @@
// A value of 0 is legitimate, meaning 'any (*)'.
if (ptype) {
- asClass* param_type = locateClass(_multinamePool[ptype]);
+ abc::Class* param_type = locateClass(_multinamePool[ptype]);
if (!param_type) {
log_abc((_("ABC: Unknown parameter type.")));
@@ -939,7 +939,7 @@
log_abc("There are %u instances.", count);
_classes.resize(count);
for (size_t i = 0; i < count; ++i) {
- asClass* pClass;
+ abc::Class* pClass;
//Read multiname index.
boost::uint32_t index = _stream->read_V32();
// 0 is allowed as a name, typically for the last entry.
@@ -996,7 +996,7 @@
pClass->setSuper(mTheObject);
}
else {
- asClass *pSuper =
locateClass(_multinamePool[super_index]);
+ abc::Class *pSuper =
locateClass(_multinamePool[super_index]);
if (!pSuper)
{
log_error(_("ABC: Super type not found (%s)"),
@@ -1061,7 +1061,7 @@
log_error(_("ABC: Bad name for interface."));
return false;
}
- asClass *pInterface =
locateClass(_multinamePool[i_index]);
+ abc::Class *pInterface =
locateClass(_multinamePool[i_index]);
// These may be undefined still, so don't check
interface just yet.
if (0) //!pInterface || !pInterface->isInterface())
{
@@ -1083,8 +1083,8 @@
// Don't validate for previous owner.
pClass->setConstructor(_methods[offset]);
- /* Calling the asMethod::setOwner always results in a
segmentation fault,
- since it tries to modify asMethod.mPrototype, which is never
+ /* Calling the Method::setOwner always results in a
segmentation fault,
+ since it tries to modify Method.mPrototype, which is never
initialized. The parser seems to work ok without this call.*/
// _methods[offset]->setOwner(pClass);
@@ -1112,7 +1112,7 @@
log_abc("There are %u classes.", count);
for (size_t i = 0; i < count; ++i) {
- asClass* pClass = _classes[i];
+ abc::Class* pClass = _classes[i];
boost::uint32_t offset = _stream->read_V32();
log_abc("Class %u(%s) static constructor index=%u", i, pClass,
offset);
@@ -1124,8 +1124,8 @@
// Don't validate for previous owner.
pClass->setStaticConstructor(_methods[offset]);
- /* Calling the asMethod::setOwner always results in a
segmentation fault,
- since it tries to modify asMethod.mPrototype, which is never
+ /* Calling the Method::setOwner always results in a
segmentation fault,
+ since it tries to modify Method.mPrototype, which is never
initialized. The parser seems to work ok without this call.*/
// _methods[offset]->setOwner(pClass);
@@ -1152,7 +1152,7 @@
_scripts.resize(count);
for (unsigned int i = 0; i < count; ++i)
{
- asClass* pScript = mCH->newClass();
+ abc::Class* pScript = mCH->newClass();
_scripts[i] = pScript;
boost::uint32_t offset = _stream->read_V32();
@@ -1164,8 +1164,8 @@
return false;
}
- // Calling the asMethod::setOwner always results in a
segmentation
- // fault, since it tries to modify asMethod.mPrototype, which is never
+ // Calling the Method::setOwner always results in a segmentation
+ // fault, since it tries to modify Method.mPrototype, which is never
// initialized. The parser seems to work ok without this call.
// Don't validate for previous owner.
// _methods[offset]->setOwner(pScript);
@@ -1208,7 +1208,7 @@
return false;
}
- asMethod& method = *_methods[offset];
+ Method& method = *_methods[offset];
if (method.getBody()) {
log_error(_("ABC: Only one body per method."));
@@ -1260,7 +1260,7 @@
pExcept->catchAny();
}
else {
- asClass *pType =
locateClass(_multinamePool[catch_type]);
+ abc::Class *pType =
locateClass(_multinamePool[catch_type]);
if (!pType) {
log_error(_("ABC: Unknown type of
object to catch. (%s)"),
@@ -1359,7 +1359,7 @@
IF_VERBOSE_PARSE(_methods[i]->print_body());
}
/* The loop below causes a segmentation fault, because it tries to modify
- asMethod.mPrototype, which is never initialized. The parser seems
+ Method.mPrototype, which is never initialized. The parser seems
to work ok without this call.*/
/* std::vector<Trait*>::iterator i = mTraits.begin();
for ( ; i != mTraits.end(); ++i)
=== renamed file 'libcore/parser/AbcBlock.h' => 'libcore/abc/AbcBlock.h'
--- a/libcore/parser/AbcBlock.h 2009-11-15 16:26:27 +0000
+++ b/libcore/abc/AbcBlock.h 2009-11-16 14:42:56 +0000
@@ -35,14 +35,16 @@
namespace abc {
class AbcBlock;
class Machine;
+ class Class;
+ class Method;
}
class SWFStream; // for read signature
class ClassHierarchy;
- class asMethod;
- class asClass;
}
namespace gnash {
+
+/// ABC-only resources for parsing and execution.
namespace abc {
class Trait
@@ -73,11 +75,11 @@
string_table::key _globalName;
Namespace* _namespace;
- asMethod* _method;
+ Method* _method;
bool _valueSet;
- asClass* _classTarget;
- asMethod* _methodTarget;
+ abc::Class* _classTarget;
+ Method* _methodTarget;
bool _static;
Trait()
@@ -100,16 +102,16 @@
bool read(SWFStream* in, AbcBlock *pBlock);
- bool finalize(AbcBlock* pBlock, asClass* pClass, bool do_static);
-
- bool finalize_mbody(AbcBlock* pBlock, asMethod* pMethod);
-
- void set_target(asClass* pClass, bool do_static) {
+ bool finalize(AbcBlock* pBlock, abc::Class* pClass, bool do_static);
+
+ bool finalize_mbody(AbcBlock* pBlock, Method* pMethod);
+
+ void set_target(abc::Class* pClass, bool do_static) {
_classTarget = pClass;
_static = do_static;
}
- void set_target(asMethod *pMethod) {
+ void set_target(Method *pMethod) {
_classTarget = 0;
_methodTarget = pMethod;
}
@@ -138,12 +140,13 @@
}
+
+/// The ActionScript bytecode of a single ABC tag in a SWF.
+//
/// ABC blocks have their own "names" for all resources. In Gnash, these are
/// a string table index. They are different from global names. These are used
/// to locate resources inside the ABC block.
//
-/// Namespaces
-//
/// ABC blocks have a set of "namespace" resources. Some namespaces are
/// private. We make these into anonymous namespaces.
//
@@ -230,9 +233,9 @@
AbcBlock();
- asClass* locateClass(MultiName &m);
+ abc::Class* locateClass(MultiName &m);
- asClass* locateClass(const std::string& className);
+ abc::Class* locateClass(const std::string& className);
abc::Trait &newTrait()
{
@@ -245,7 +248,7 @@
void update_global_name(unsigned int multiname_index);
- const std::vector<asClass*>& scripts() const {
+ const std::vector<abc::Class*>& scripts() const {
return _scripts;
}
@@ -269,7 +272,7 @@
return _doublePool[i];
}
- asMethod* methodPoolAt(size_t i) const {
+ Method* methodPoolAt(size_t i) const {
checkBounds(i, _methods);
return _methods[i];
}
@@ -279,7 +282,7 @@
return _multinamePool[i];
}
- asClass* classPoolAt(size_t i) const {
+ abc::Class* classPoolAt(size_t i) const {
checkBounds(i, _classes);
return _classes[i];
}
@@ -329,16 +332,16 @@
std::vector<string_table::key> _stringPoolTableIDs;
std::vector<Namespace*> _namespacePool;
std::vector<NamespaceSet> _namespaceSetPool;
- std::vector<asMethod*> _methods;
+ std::vector<Method*> _methods;
std::vector<MultiName> _multinamePool;
- std::vector<asClass*> _classes;
- std::vector<asClass*> _scripts;
- std::vector<abc::Trait*> _traits;
+ std::vector<Class*> _classes;
+ std::vector<Class*> _scripts;
+ std::vector<Trait*> _traits;
string_table* _stringTable;
SWFStream* _stream; // Not stored beyond one read.
- asClass *mTheObject;
+ abc::Class *mTheObject;
ClassHierarchy *mCH;
boost::uint32_t mVersion;
=== renamed file 'libcore/asBoundValues.h' => 'libcore/abc/BoundValues.h'
--- a/libcore/asBoundValues.h 2009-05-14 10:30:48 +0000
+++ b/libcore/abc/BoundValues.h 2009-11-16 14:42:56 +0000
@@ -19,43 +19,45 @@
#define GNASH_AS_BOUND_VALUES_H
namespace gnash {
-
-class asBoundValue;
-
-class asBoundAccessor
+namespace abc {
+
+class BoundValue;
+
+class BoundAccessor
{
public:
- bool setGetter(asMethod *p) { mGetter = p; return true; }
- bool setSetter(asMethod *p) { _setter = p; return true; }
- bool setValue(asBoundValue *p) { mValue = p; return true; }
+ bool setGetter(Method *p) { mGetter = p; return true; }
+ bool setSetter(Method *p) { _setter = p; return true; }
+ bool setValue(BoundValue *p) { mValue = p; return true; }
- asBoundValue* getValue() { return mValue; }
- asMethod *getGetter() { return mGetter; }
- asMethod *getSetter() { return _setter; }
+ BoundValue* getValue() { return mValue; }
+ Method *getGetter() { return mGetter; }
+ Method *getSetter() { return _setter; }
private:
- asMethod *mGetter;
- asMethod *_setter;
- asBoundValue *mValue;
+ Method *mGetter;
+ Method *_setter;
+ BoundValue *mValue;
};
-class asBoundValue
+class BoundValue
{
public:
- asBoundValue() : mConst(false), mValue()
+ BoundValue() : mConst(false), mValue()
{ mValue.set_undefined(); }
void setValue(as_value &v) { mValue = v; }
as_value getCurrentValue() { return mValue; }
- void setType(asClass *t) { mType = t; }
- asClass *getType() { return mType; }
+ void setType(Class *t) { mType = t; }
+ Class *getType() { return mType; }
private:
bool mConst;
- asClass *mType;
+ Class *mType;
as_value mValue;
};
+} // namespace abc
} // namespace gnash
#endif
=== renamed file 'libcore/asClass.cpp' => 'libcore/abc/Class.cpp'
--- a/libcore/asClass.cpp 2009-11-15 16:26:27 +0000
+++ b/libcore/abc/Class.cpp 2009-11-16 14:42:56 +0000
@@ -19,7 +19,7 @@
#include "gnashconfig.h"
#endif
-#include "asClass.h"
+#include "Class.h"
#include "as_object.h"
#include "ClassHierarchy.h"
#include "VM.h"
@@ -29,16 +29,17 @@
#include "Global_as.h"
#ifdef ENABLE_AVM2
-#include "asMethod.h"
+#include "Method.h"
#include "abc_function.h"
#endif
namespace gnash {
+namespace abc {
#ifdef ENABLE_AVM2
bool
-asClass::addValue(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, asClass *type, as_value& val, bool isconst,
+Class::addValue(string_table::key name, Namespace *ns,
+ boost::uint32_t slotId, Class *type, as_value& val, bool isconst,
bool isstatic)
{
Global_as* g = VM::get().getGlobal();
@@ -65,25 +66,25 @@
return true;
}
bool
-asClass::addMemberClass(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, asClass *type, bool isstatic)
+Class::addMemberClass(string_table::key name, Namespace *ns,
+ boost::uint32_t slotId, Class *type, bool isstatic)
{
return addSlot(name, ns, slotId, type, isstatic);
}
bool
-asClass::addSlotFunction(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, asMethod *method, bool isstatic)
+Class::addSlotFunction(string_table::key name, Namespace *ns,
+ boost::uint32_t slotId, Method *method, bool isstatic)
{
- asClass a;
+ Class a;
a.setName(NSV::CLASS_FUNCTION);
as_value b(method->getPrototype());
return addValue(name, ns, slotId, &a, b, false, isstatic);
}
bool
-asClass::addSlot(string_table::key name, Namespace* ns,
- boost::uint32_t slotId, asClass* /*type*/, bool /*isstatic*/)
+Class::addSlot(string_table::key name, Namespace* ns,
+ boost::uint32_t slotId, Class* /*type*/, bool /*isstatic*/)
{
string_table::key nsname = ns ? ns->getURI() : 0;
@@ -98,8 +99,8 @@
}
bool
-asClass::addMethod(string_table::key name, Namespace* /*ns*/,
- asMethod* method, bool /*isstatic*/)
+Class::addMethod(string_table::key name, Namespace* /*ns*/,
+ Method* method, bool /*isstatic*/)
{
as_value val = new abc::abc_function(method,
getVM(*_prototype).getMachine());
@@ -114,7 +115,7 @@
bool
-asClass::addGetter(string_table::key name, Namespace *ns, asMethod *method,
+Class::addGetter(string_table::key name, Namespace *ns, Method *method,
bool isstatic)
{
string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
@@ -135,7 +136,7 @@
}
bool
-asClass::addSetter(string_table::key name, Namespace *ns, asMethod *method,
+Class::addSetter(string_table::key name, Namespace *ns, Method *method,
bool isstatic)
{
string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
@@ -157,7 +158,7 @@
#if 0 // TODO
void
-asClass::buildFromPrototype(as_object *o, string_table::key name,
+Class::buildFromPrototype(as_object *o, string_table::key name,
ClassHierarchy *pCH)
{
setName(name);
@@ -184,8 +185,8 @@
}
bool
-asClass::addValue(string_table::key name, Namespace *ns, boost::uint32_t
slotId,
- asClass *type, as_value& val, bool isconst, bool isstatic,
+Class::addValue(string_table::key name, Namespace *ns, boost::uint32_t slotId,
+ Class *type, as_value& val, bool isconst, bool isstatic,
ClassHierarchy *CH)
{
asBoundValue *bv = CH->newBoundValue();
@@ -197,8 +198,8 @@
}
bool
-asClass::addSlot(string_table::key name, Namespace *ns, boost::uint32_t slotId,
- asClass *type, bool isstatic, ClassHierarchy *CH)
+Class::addSlot(string_table::key name, Namespace *ns, boost::uint32_t slotId,
+ Class *type, bool isstatic, ClassHierarchy *CH)
{
asBoundValue *bv = CH->newBoundValue();
bv->setType(type);
@@ -208,7 +209,7 @@
}
bool
-asClass::addMethod(string_table::key name, Namespace *ns, asMethod *method,
+Class::addMethod(string_table::key name, Namespace *ns, Method *method,
bool isstatic)
{
if (!isstatic)
@@ -218,8 +219,8 @@
}
bool
-asClass::addMemberClass(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, asClass *type, bool isstatic)
+Class::addMemberClass(string_table::key name, Namespace *ns,
+ boost::uint32_t slotId, Class *type, bool isstatic)
{
if (!isstatic)
return addBinding(name, asBinding(ns, type, slotId, isstatic));
@@ -228,8 +229,8 @@
// TODO: Figure out how this differs from addMethod
bool
-asClass::addSlotFunction(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, asMethod *method, bool isstatic)
+Class::addSlotFunction(string_table::key name, Namespace *ns,
+ boost::uint32_t slotId, Method *method, bool isstatic)
{
if (!isstatic)
return addBinding(name, asBinding(ns, method, slotId,
isstatic));
@@ -239,4 +240,5 @@
#endif
-} /* namespace gnash */
+} // namespace abc
+} // namespace gnash
=== renamed file 'libcore/asClass.h' => 'libcore/abc/Class.h'
--- a/libcore/asClass.h 2009-11-15 16:26:27 +0000
+++ b/libcore/abc/Class.h 2009-11-16 14:42:56 +0000
@@ -28,8 +28,8 @@
#include <iostream>
#include "string_table.h"
#include "as_value.h"
+#include "as_object.h"
#include "Property.h"
-#include "as_function.h"
#ifdef ENABLE_AVM2
# include "CodeStream.h"
@@ -41,31 +41,31 @@
class Machine;
class MultiName;
class abc_function;
+ class BoundValue;
+ class BoundAccessor;
+ class Method;
+ class Class;
+ typedef Property Binding;
}
- class as_function;
class Namespace;
- class asMethod;
- class asClass;
- typedef Property asBinding;
- class asBoundValue;
- class asBoundAccessor;
class ClassHierarchy;
class Property;
}
namespace gnash {
-
+namespace abc {
+
/// A class to represent, abstractly, ActionScript prototypes.
///
/// This class is intended to be able to capture the structure of an
/// ActionScript prototype as a type, rather than as an object. This is
/// contrary to the spirit of ActionScript as a dynamic language, but it is
/// incredibly helpful to an interpreter for that language.
-class asClass
+class Class
{
public:
- asClass()
+ Class()
:
_prototype(0),
_final(false),
@@ -104,27 +104,27 @@
#ifdef ENABLE_AVM2
bool addValue(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, asClass *type, as_value& val,
+ boost::uint32_t slotID, Class *type, as_value& val,
bool isconst, bool isstatic);
bool addSlot(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, asClass *type, bool isstatic);
-
- bool addMethod(string_table::key name, Namespace *ns, asMethod *method,
- bool isstatic);
-
- bool addGetter(string_table::key name, Namespace *ns, asMethod *method,
- bool isstatic);
-
- bool addSetter(string_table::key name, Namespace *ns, asMethod *method,
+ boost::uint32_t slotID, Class *type, bool isstatic);
+
+ bool addMethod(string_table::key name, Namespace *ns, Method *method,
+ bool isstatic);
+
+ bool addGetter(string_table::key name, Namespace *ns, Method *method,
+ bool isstatic);
+
+ bool addSetter(string_table::key name, Namespace *ns, Method *method,
bool isstatic);
bool addMemberClass(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, asClass *type, bool isstatic);
+ boost::uint32_t slotID, Class *type, bool isstatic);
// TODO: Figure out how this differs from addMethod
bool addSlotFunction(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, asMethod *method, bool isstatic);
+ boost::uint32_t slotID, Method *method, bool isstatic);
/// Is the class final?
bool isFinal() const { return _final; }
@@ -182,28 +182,28 @@
}
/// What is the type of our parent class?
- asClass* getSuper() const { return _super; }
+ Class* getSuper() const { return _super; }
/// We implement this interface.
- void pushInterface(asClass* p) { _interfaces.push_back(p); }
+ void pushInterface(Class* p) { _interfaces.push_back(p); }
/// This is our constructor.
- void setConstructor(asMethod *m) { _constructor = m; }
- asMethod *getConstructor() { return _constructor; }
+ void setConstructor(Method *m) { _constructor = m; }
+ Method *getConstructor() { return _constructor; }
- void setStaticConstructor(asMethod *m) { _staticConstructor = m; }
+ void setStaticConstructor(Method *m) { _staticConstructor = m; }
- asMethod* getStaticConstructor() const {
+ Method* getStaticConstructor() const {
return _staticConstructor;
}
- void setSuper(asClass *p) { _super = p; }
+ void setSuper(Class *p) { _super = p; }
- /// Try to build an asClass object from just a prototype.
+ /// Try to build an Class object from just a prototype.
void buildFro_prototype(as_object *o, string_table::key name,
ClassHierarchy *);
- asBinding *getBinding(string_table::key name)
+ Binding *getBinding(string_table::key name)
{
BindingContainer::iterator i;
if (_bindings.empty()) return NULL;
@@ -213,24 +213,24 @@
return &i->second;
}
- asBinding* getGetBinding(as_value& v, abc::MultiName& n);
- asBinding* getSetBinding(as_value& v, abc::MultiName& n);
+ Binding* getGetBinding(as_value& v, abc::MultiName& n);
+ Binding* getSetBinding(as_value& v, abc::MultiName& n);
std::vector<abc::Trait> _traits;
#endif
private:
- typedef std::map<string_table::key, asBinding> BindingContainer;
+ typedef std::map<string_table::key, Binding> BindingContainer;
as_object *_prototype;
- bool addBinding(string_table::key name, asBinding b)
+ bool addBinding(string_table::key name, Binding b)
{ _bindings[name] = b; return true; }
- bool addStaticBinding(string_table::key name, asBinding b)
+ bool addStaticBinding(string_table::key name, Binding b)
{ _staticBindings[name] = b; return true; }
- asBinding *getStaticBinding(string_table::key name)
+ Binding *getStaticBinding(string_table::key name)
{
BindingContainer::iterator i;
if (_staticBindings.empty())
@@ -246,11 +246,11 @@
bool _dynamic;
bool _interface;
string_table::key _name;
- std::list<asClass*> _interfaces;
+ std::list<Class*> _interfaces;
Namespace* _protectedNs;
- asClass* _super;
- asMethod* _constructor;
- asMethod* _staticConstructor;
+ Class* _super;
+ Method* _constructor;
+ Method* _staticConstructor;
BindingContainer _bindings;
BindingContainer _staticBindings;
@@ -259,6 +259,7 @@
bool _system;
};
+} // namespace abc
} // namespace gnash
#endif
=== renamed file 'libcore/asMethod.cpp' => 'libcore/abc/Method.cpp'
--- a/libcore/asMethod.cpp 2009-11-15 16:26:27 +0000
+++ b/libcore/abc/Method.cpp 2009-11-16 14:42:56 +0000
@@ -19,16 +19,17 @@
#include "gnashconfig.h"
#endif
-#include "asMethod.h"
-#include "asClass.h"
+#include "Method.h"
+#include "Class.h"
#include "CodeStream.h"
#include "abc_function.h"
#include "Global_as.h"
#include "VM.h"
namespace gnash {
+namespace abc {
-asMethod::asMethod()
+Method::Method()
:
_methodID(0),
_prototype(0),
@@ -48,7 +49,7 @@
}
void
-asMethod::print_body()
+Method::print_body()
{
if (!_body) {
log_parse("Method has no body.");
@@ -64,9 +65,9 @@
}
void
-asMethod::setOwner(asClass *pOwner)
+Method::setOwner(Class *pOwner)
{
- log_debug("asMethod::setOwner");
+ log_debug("Method::setOwner");
if (!_prototype) {
log_debug("ERROR _prototype is null.");
}
@@ -74,14 +75,14 @@
}
void
-asMethod::setReturnType(asClass* /*type*/)
+Method::setReturnType(Class* /*type*/)
{
/* No-op */
}
bool
-asMethod::addValue(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, asClass *type, as_value& val, bool isconst)
+Method::addValue(string_table::key name, Namespace *ns,
+ boost::uint32_t slotId, Class *type, as_value& val, bool isconst)
{
Global_as* g = VM::get().getGlobal();
if (val.is_object()) {
@@ -105,7 +106,7 @@
}
bool
-asMethod::addGetter(string_table::key name, Namespace *ns, asMethod *method)
+Method::addGetter(string_table::key name, Namespace *ns, Method *method)
{
string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
@@ -123,7 +124,7 @@
}
bool
-asMethod::addSetter(string_table::key name, Namespace *ns, asMethod *method)
+Method::addSetter(string_table::key name, Namespace *ns, Method *method)
{
string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
@@ -141,15 +142,15 @@
}
bool
-asMethod::addMemberClass(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, asClass *type)
+Method::addMemberClass(string_table::key name, Namespace *ns,
+ boost::uint32_t slotId, Class *type)
{
return addSlot(name, ns, slotId, type);
}
bool
-asMethod::addSlot(string_table::key name, Namespace* ns, boost::uint32_t
slotId,
- asClass */*type*/)
+Method::addSlot(string_table::key name, Namespace* ns, boost::uint32_t slotId,
+ Class */*type*/)
{
string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
int flags = PropFlags::dontDelete;
@@ -159,33 +160,33 @@
}
bool
-asMethod::addSlotFunction(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, asMethod *method)
+Method::addSlotFunction(string_table::key name, Namespace *ns,
+ boost::uint32_t slotId, Method *method)
{
- asClass a;
+ Class a;
a.setName(NSV::CLASS_FUNCTION);
as_value b(method->getPrototype());
return addValue(name, ns, slotId, &a, b, false);
}
void
-asMethod::initPrototype(abc::Machine* machine)
+Method::initPrototype(abc::Machine* machine)
{
_prototype = new abc::abc_function(this,machine);
}
bool
-asMethod::addMethod(string_table::key /*name*/, Namespace* /*ns*/, asMethod*
+Method::addMethod(string_table::key /*name*/, Namespace* /*ns*/, Method*
/*method*/)
{
// string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
// as_value val(method->getPrototype());
-// as value val = new
as_value(abc_function(asMethod->getBody,getVM(_prototype).getMachine()));
+// as value val = new
as_value(abc_function(Method->getBody,getVM(_prototype).getMachine()));
// _prototype->init_member(name, val, PropFlags::readOnly |
// PropFlags::dontDelete | PropFlags::dontEnum, nsname);
// return true;
return false;
}
-
+} // namespace abc
} // namespace gnash
=== renamed file 'libcore/asMethod.h' => 'libcore/abc/Method.h'
--- a/libcore/asMethod.h 2009-11-15 16:26:27 +0000
+++ b/libcore/abc/Method.h 2009-11-16 14:42:56 +0000
@@ -34,26 +34,27 @@
namespace abc {
class Machine;
class abc_function;
+ class Class;
}
class CodeStream;
class as_object;
- class asClass;
}
namespace gnash {
+namespace abc {
typedef Property asBinding;
/// A class to represent, abstractly, an ActionScript method.
///
/// Methods are unnamed until they are bound to an object.
-class asMethod
+class Method
{
public:
- typedef std::list<asClass*> ArgumentList;
+ typedef std::list<Class*> ArgumentList;
- asMethod();
+ Method();
boost::uint32_t methodID() const {
return _methodID;
@@ -63,7 +64,7 @@
_methodID = m;
}
- void initPrototype(abc::Machine* machine);
+ void initPrototype(Machine* machine);
boost::uint32_t getMaxRegisters() { return _maxRegisters;}
@@ -99,7 +100,7 @@
return _scopeDepth;
}
- abc::abc_function* getPrototype() { return _prototype; }
+ abc_function* getPrototype() { return _prototype; }
asBinding* getBinding(string_table::key name);
@@ -123,45 +124,45 @@
void setBody(CodeStream *b) { _body = b; }
bool addValue(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, asClass *type, as_value& val, bool
isconst);
+ boost::uint32_t slotID, Class *type, as_value& val, bool isconst);
bool addSlot(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, asClass *type);
-
- bool addMethod(string_table::key name, Namespace *ns, asMethod *method);
-
- bool addGetter(string_table::key name, Namespace *ns, asMethod *method);
-
- bool addSetter(string_table::key name, Namespace *ns, asMethod *method);
+ boost::uint32_t slotID, Class *type);
+
+ bool addMethod(string_table::key name, Namespace *ns, Method *method);
+
+ bool addGetter(string_table::key name, Namespace *ns, Method *method);
+
+ bool addSetter(string_table::key name, Namespace *ns, Method *method);
bool addMemberClass(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, asClass *type);
+ boost::uint32_t slotID, Class *type);
bool addSlotFunction(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, asMethod *method);
+ boost::uint32_t slotID, Method *method);
/// \brief
/// Set the owner of this method.
- void setOwner(asClass* s);
+ void setOwner(Class* s);
/// \brief
/// Get the unique identifier for the return type. 0 is 'anything'.
/// (This is the value of any dynamic property.)
/// Id reference: Type
- asClass* getReturnType() const;
+ Class* getReturnType() const;
/// Set the return type
//
/// TODO: This is currently a no-op, so find out what it's for and
/// implement it.
/// NB: the return type of a method can be * (any) or void, neither of
- /// which are asClasses, so this may not be an appropriate way to
+ /// which are abc::Classes, so this may not be an appropriate way to
/// handle return type.
- void setReturnType(asClass* t);
-
- asMethod *getSuper();
-
- void setSuper(asMethod* s);
+ void setReturnType(Class* t);
+
+ Method *getSuper();
+
+ void setSuper(Method* s);
/// \brief
/// Is the method final? If so, it may not be overridden.
@@ -219,7 +220,7 @@
/// Push an argument of type t into the method definition
//
/// A value of 0 stands for 'any'.
- void pushArgument(asClass* t) { _arguments.push_back(t); }
+ void pushArgument(Class* t) { _arguments.push_back(t); }
/// Push an optional argument's default value.
void pushOptional(const as_value& v) { _optionalArguments.push_back(v);
}
@@ -265,7 +266,7 @@
boost::uint32_t _methodID;
- abc::abc_function* _prototype;
+ abc_function* _prototype;
int _minArguments;
int _maxArguments;
boost::uint32_t _bodyLength;
@@ -285,6 +286,7 @@
};
+} // namespace abc
} // namespace gnash
#endif
=== renamed file 'libcore/vm/MultiName.h' => 'libcore/abc/MultiName.h'
=== renamed file 'libcore/abc_function.cpp' => 'libcore/abc/abc_function.cpp'
--- a/libcore/abc_function.cpp 2009-11-15 16:26:27 +0000
+++ b/libcore/abc/abc_function.cpp 2009-11-16 14:42:56 +0000
@@ -17,14 +17,14 @@
#include "log.h"
#include "abc_function.h"
-#include "asClass.h"
+#include "Class.h"
#include "fn_call.h"
#include "Machine.h"
namespace gnash {
namespace abc {
-abc_function::abc_function(asMethod* methodInfo, Machine* machine)
+abc_function::abc_function(Method* methodInfo, Machine* machine)
:
as_function(*machine->global()),
_methodInfo(methodInfo),
=== renamed file 'libcore/abc_function.h' => 'libcore/abc/abc_function.h'
--- a/libcore/abc_function.h 2009-11-15 16:26:27 +0000
+++ b/libcore/abc/abc_function.h 2009-11-16 14:42:56 +0000
@@ -25,11 +25,11 @@
#include "as_function.h"
#include "as_value.h"
#include "CodeStream.h"
-#include "asClass.h"
+#include "Class.h"
#include "SafeStack.h"
#include "as_object.h"
#include "as_environment.h"
-#include "asMethod.h"
+#include "Method.h"
namespace gnash {
namespace abc {
@@ -41,7 +41,7 @@
{
public:
- abc_function(asMethod* methodInfo, Machine* machine);
+ abc_function(Method* methodInfo, Machine* machine);
as_value operator()(const fn_call& fn);
@@ -59,7 +59,7 @@
private:
- asMethod* _methodInfo;
+ Method* _methodInfo;
Machine* _machine;
=== renamed file 'libcore/asException.h' => 'libcore/abc/asException.h'
--- a/libcore/asException.h 2009-11-13 08:19:10 +0000
+++ b/libcore/abc/asException.h 2009-11-16 14:42:56 +0000
@@ -27,7 +27,7 @@
void setEnd(boost::uint32_t i) { mEnd = i; }
void setCatch(boost::uint32_t i) { mCatch = i; }
void catchAny() { mCatchAny = true; }
- void setCatchType(asClass* p) { mCatchType = p; }
+ void setCatchType(abc::Class* p) { mCatchType = p; }
void setNamespace(Namespace* n) { _namespace = n; }
void setName(string_table::key name) { _name = name; }
@@ -36,7 +36,7 @@
boost::uint32_t mEnd;
boost::uint32_t mCatch;
bool mCatchAny;
- asClass *mCatchType;
+ abc::Class *mCatchType;
Namespace *_namespace;
string_table::key _name;
};
=== modified file 'libcore/as_object.cpp'
--- a/libcore/as_object.cpp 2009-11-16 12:34:46 +0000
+++ b/libcore/as_object.cpp 2009-11-16 14:42:56 +0000
@@ -44,7 +44,7 @@
#include <boost/algorithm/string/case_conv.hpp>
#include <utility> // for std::pair
#include "namedStrings.h"
-#include "asClass.h"
+#include "Class.h"
namespace gnash {
=== modified file 'libcore/as_object.h'
--- a/libcore/as_object.h 2009-11-16 12:17:00 +0000
+++ b/libcore/as_object.h 2009-11-16 14:42:56 +0000
@@ -43,6 +43,7 @@
namespace gnash {
namespace abc {
class Machine;
+ class Class;
}
class as_function;
class MovieClip;
@@ -51,7 +52,6 @@
class VM;
class IOChannel;
class movie_root;
- class asClass;
class RunResources;
class Global_as;
}
@@ -164,7 +164,7 @@
///
class as_object : public GcResource
{
- friend class asClass;
+ friend class abc::Class;
friend class abc::Machine;
typedef std::set<std::pair<string_table::key, string_table::key> >
=== modified file 'libcore/parser/Makefile.am'
--- a/libcore/parser/Makefile.am 2009-07-03 08:19:37 +0000
+++ b/libcore/parser/Makefile.am 2009-11-16 14:01:20 +0000
@@ -53,11 +53,6 @@
sound_definition.cpp \
sprite_definition.cpp
-if ENABLE_AVM2
-libgnashparser_la_SOURCES += \
- AbcBlock.cpp
-endif
-
noinst_HEADERS = \
action_buffer.h \
BitmapMovieDefinition.h \
@@ -67,11 +62,6 @@
sound_definition.h \
sprite_definition.h
-if ENABLE_AVM2
-noinst_HEADERS += \
- AbcBlock.h
-endif
-
EXTENSIONS_API = \
movie_definition.h \
$(NULL)
=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp 2009-11-16 12:34:46 +0000
+++ b/libcore/vm/Machine.cpp 2009-11-16 14:42:56 +0000
@@ -125,7 +125,7 @@
}
-inline asMethod*
+inline Method*
pool_method(boost::uint32_t index, AbcBlock* pool)
{
if (!pool) throw ASException();
@@ -137,7 +137,7 @@
}
}
-inline asClass*
+inline Class*
pool_class(boost::uint32_t index, AbcBlock* pool)
{
if (!pool) throw ASException();
@@ -1228,7 +1228,7 @@
{
boost::int32_t method_index = mStream->read_V32();
log_abc("Creating new abc_function: method
index=%u",method_index);
- asMethod *m = pool_method(method_index, mPoolObject);
+ Method *m = pool_method(method_index, mPoolObject);
abc_function* new_function = m->getPrototype();
push_stack(as_value(new_function));
@@ -1328,7 +1328,7 @@
/// ..., argN)
case SWF::ABC_ACTION_CALLSTATIC:
{
- asMethod *m = pool_method(mStream->read_V32(),
mPoolObject);
+ Method *m = pool_method(mStream->read_V32(), mPoolObject);
boost::uint32_t argc = mStream->read_V32();
as_function *func = m->getPrototype();
ENSURE_OBJECT(_stack.top(argc));
@@ -1701,7 +1701,7 @@
{
boost::uint32_t cid = mStream->read_V32();
log_abc("Class index: %s", cid);
- asClass *c = pool_class(cid, mPoolObject);
+ Class *c = pool_class(cid, mPoolObject);
log_abc("Creating new class id=%u name=%s", c->getName(),
mST.value(c->getName()));
@@ -1712,7 +1712,7 @@
new_class->set_prototype(base_class);
//Create the class.
- asMethod* scmethod = c->getStaticConstructor();
+ Method* scmethod = c->getStaticConstructor();
// What if there isn't one?
assert(scmethod);
@@ -2907,7 +2907,7 @@
}
void
-Machine::getMember(asClass* pDefinition, MultiName& name,
+Machine::getMember(Class* pDefinition, MultiName& name,
as_value& instance)
{
if (!instance.is_object())
@@ -2931,7 +2931,7 @@
}
void
-Machine::setMember(asClass *pDefinition, MultiName& name, as_value& instance,
+Machine::setMember(Class *pDefinition, MultiName& name, as_value& instance,
as_value& newvalue)
{
if (!instance.is_object())
@@ -2988,13 +2988,13 @@
return size;
}
-asClass *
+Class *
Machine::findSuper(as_value &v, bool find_for_primitive)
{
if (v.is_undefined() || v.is_null()) return NULL;
if (v.is_object()) {
- asClass *pProto = NULL; // TODO:
v.to_object(*_global)->getClass();
+ Class *pProto = NULL; // TODO:
v.to_object(*_global)->getClass();
return pProto ? pProto->getSuper() : NULL;
}
@@ -3135,9 +3135,9 @@
{
mPoolObject = pool_block;
log_debug("Getting entry script.");
- asClass* start_script = pool_block->scripts().back();
+ Class* start_script = pool_block->scripts().back();
log_debug("Getting constructor.");
- asMethod* constructor = start_script->getConstructor();
+ Method* constructor = start_script->getConstructor();
clearRegisters(constructor->getMaxRegisters());
log_debug("Loading code stream.");
mStream = constructor->getBody();
@@ -3149,7 +3149,7 @@
//TODO: There is probably a better way to do this, once we understand what the
VM is supposed
//todo, this should be fixed.
as_value
-Machine::executeFunction(asMethod* method, const fn_call& fn)
+Machine::executeFunction(Method* method, const fn_call& fn)
{
//TODO: Figure out a good way to use the State object to handle
@@ -3211,7 +3211,7 @@
log_debug("instantiateClass: class name %s", className);
- asClass* cl = mPoolObject->locateClass(className);
+ Class* cl = mPoolObject->locateClass(className);
if (!cl)
{
/// This seems like a big error.
@@ -3219,7 +3219,7 @@
return;
}
- asMethod* ctor = cl->getConstructor();
+ Method* ctor = cl->getConstructor();
if (!ctor) {
log_error("Class found has no constructor, can't instantiate "
=== modified file 'libcore/vm/Machine.h'
--- a/libcore/vm/Machine.h 2009-11-15 16:26:27 +0000
+++ b/libcore/vm/Machine.h 2009-11-16 14:42:56 +0000
@@ -23,7 +23,7 @@
#include <sstream>
#include "SafeStack.h"
#include "as_value.h"
-#include "asClass.h"
+#include "Class.h"
#include "SWF.h"
#include "as_environment.h"
#include "VM.h"
@@ -46,6 +46,8 @@
namespace abc {
+/// The virtual machine for executing ABC (ActionScript Bytecode).
+//
/// 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++.
@@ -97,7 +99,7 @@
/// the stack.
///
/// @param name
- /// A partially filled asBoundName, this should be the id
+ /// A partially filled MultiName, this should be the id
/// from the stream.
///
/// @param initial
@@ -118,7 +120,7 @@
///
/// @return
/// Null if the superclass was not found, or the superclass.
- asClass* findSuper(as_value& obj, bool find_primitive);
+ Class* findSuper(as_value& obj, bool find_primitive);
/// Get a member from an object.
///
@@ -136,7 +138,7 @@
/// 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,
+ void getMember(Class* pDefinition, MultiName& name,
as_value& source);
/// Set a member in an object.
@@ -155,9 +157,9 @@
///
/// @return
/// Nothing.
- void setMember(asClass*, MultiName&, as_value& target, as_value& val);
+ void setMember(Class*, MultiName&, as_value& target, as_value& val);
- asBinding* findProperty(MultiName&) { return NULL; }
+ Binding* findProperty(MultiName&) { return NULL; }
void execute();
@@ -236,7 +238,7 @@
void initMachine(AbcBlock* pool_block);
- as_value executeFunction(asMethod* function, const fn_call& fn);
+ as_value executeFunction(Method* function, const fn_call& fn);
void instantiateClass(std::string className, as_object* global);
/// Return the Global object for this Machine.
=== modified file 'libcore/vm/Makefile.am'
--- a/libcore/vm/Makefile.am 2009-11-16 12:29:31 +0000
+++ b/libcore/vm/Makefile.am 2009-11-16 14:01:20 +0000
@@ -27,6 +27,7 @@
-I$(top_srcdir)/libcore/asobj \
-I$(top_srcdir)/libcore/asobj/flash \
-I$(top_srcdir)/libcore/swf \
+ -I$(top_srcdir)/libcore/abc \
-I$(top_srcdir)/libcore/parser \
-I$(top_srcdir)/libbase \
-I$(top_srcdir)/libamf \
@@ -56,7 +57,6 @@
noinst_HEADERS = \
ASHandlers.h \
CodeStream.h \
- MultiName.h \
ActionExec.h \
ExecutableCode.h \
with_stack_entry.h \
@@ -72,7 +72,6 @@
if ENABLE_AVM2
noinst_HEADERS += \
- MultiName.h \
CodeStream.h \
Machine.h \
$(NULL)
- [Gnash-commit] /srv/bzr/gnash/trunk r11630: Move AS3-specific classes into libcore/abc and under the abc namespace.,
Benjamin Wolsey <=