[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11676: Restore class name from Scri
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11676: Restore class name from Script to Class. |
Date: |
Wed, 02 Dec 2009 17:47:14 +0100 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11676 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2009-12-02 17:47:14 +0100
message:
Restore class name from Script to Class.
Improve documentation and includes.
renamed:
libcore/abc/Script.cpp => libcore/abc/Class.cpp
libcore/abc/Script.h => libcore/abc/Class.h
modified:
libcore/ClassHierarchy.cpp
libcore/ClassHierarchy.h
libcore/Makefile.am
libcore/abc/AbcBlock.cpp
libcore/abc/AbcBlock.h
libcore/abc/Method.cpp
libcore/abc/Method.h
libcore/abc/Namespace.cpp
libcore/abc/Namespace.h
libcore/abc/asException.h
libcore/vm/ActionExec.cpp
libcore/vm/Machine.cpp
libcore/vm/Machine.h
libcore/abc/Class.cpp
libcore/abc/Class.h
=== modified file 'libcore/ClassHierarchy.cpp'
--- a/libcore/ClassHierarchy.cpp 2009-12-02 14:27:13 +0000
+++ b/libcore/ClassHierarchy.cpp 2009-12-02 15:57:58 +0000
@@ -23,7 +23,7 @@
#include "ClassHierarchy.h"
#include "as_function.h"
#include "builtin_function.h"
-#include "Script.h"
+#include "Class.h"
#include "Global_as.h"
#include "extension.h"
=== modified file 'libcore/ClassHierarchy.h'
--- a/libcore/ClassHierarchy.h 2009-12-02 12:30:12 +0000
+++ b/libcore/ClassHierarchy.h 2009-12-02 16:47:14 +0000
@@ -27,7 +27,7 @@
#ifdef ENABLE_AVM2
# include "SafeStack.h"
-# include "Script.h"
+# include "Class.h"
# include "Namespace.h"
# include "BoundValues.h"
# include "asException.h"
@@ -110,7 +110,7 @@
,
mAnonNamespaces(),
mGlobalNamespace(addNamespace(0)),
- mScriptMemory(),
+ _classMemory(),
mExceptionMemory(),
mMethodMemory(),
mBoundValueMemory(),
@@ -195,9 +195,9 @@
}
/// Create a new abc::Class object for use.
- abc::Script* newScript() {
- mScriptMemory.grow(1);
- return &mScriptMemory.top(0);
+ abc::Class* newClass() {
+ _classMemory.grow(1);
+ return &_classMemory.top(0);
}
asException* newException() {
@@ -235,7 +235,7 @@
namespacesContainer mNamespaces;
SafeStack<abc::Namespace> mAnonNamespaces;
abc::Namespace* mGlobalNamespace;
- SafeStack<abc::Script> mScriptMemory;
+ SafeStack<abc::Class> _classMemory;
SafeStack<asException> mExceptionMemory;
SafeStack<abc::Method> mMethodMemory;
SafeStack<abc::BoundValue> mBoundValueMemory;
=== modified file 'libcore/Makefile.am'
--- a/libcore/Makefile.am 2009-12-02 12:30:12 +0000
+++ b/libcore/Makefile.am 2009-12-02 15:57:58 +0000
@@ -137,7 +137,7 @@
if ENABLE_AVM2
libgnashcore_la_SOURCES += \
- abc/Script.cpp \
+ abc/Class.cpp \
abc/Namespace.cpp \
abc/as_class.cpp \
abc/abc_function.cpp \
@@ -215,7 +215,7 @@
if ENABLE_AVM2
noinst_HEADERS += \
- abc/Script.h \
+ abc/Class.h \
abc/Namespace.h \
swf/DoABCTag.h \
abc/as_class.h \
=== modified file 'libcore/abc/AbcBlock.cpp'
--- a/libcore/abc/AbcBlock.cpp 2009-12-01 12:45:00 +0000
+++ b/libcore/abc/AbcBlock.cpp 2009-12-02 16:47:14 +0000
@@ -24,7 +24,7 @@
#include "VM.h"
#include "log.h"
#include "ClassHierarchy.h"
-#include "Script.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, abc::Script *pScript, bool do_static)
+Trait::finalize(AbcBlock *pBlock, abc::Class *pScript, bool do_static)
{
log_abc("Finalize class %s (%s), trait kind: %s",
pBlock->_stringTable->value(pScript->getName()), pScript, _kind);
@@ -47,12 +47,12 @@
case KIND_CONST:
{
// Validate the type.
- abc::Script *pType;
+ abc::Class *pType;
if (_typeIndex) {
log_abc("Trait type: %s",
pBlock->_stringPool[
pBlock->_multinamePool[_typeIndex].getABCName()]);
- pType =
pBlock->locateScript(pBlock->_multinamePool[_typeIndex]);
+ pType =
pBlock->locateClass(pBlock->_multinamePool[_typeIndex]);
}
else {
pType = pBlock->mTheObject;
@@ -124,9 +124,9 @@
case KIND_CONST:
{
// Validate the type.
- abc::Script *pType;
+ abc::Class *pType;
if (_typeIndex) {
- pType =
pBlock->locateScript(pBlock->_multinamePool[_typeIndex]);
+ pType =
pBlock->locateClass(pBlock->_multinamePool[_typeIndex]);
}
else {
pType = pBlock->mTheObject;
@@ -250,13 +250,13 @@
{
_slotID = in->read_V32();
_classInfoIndex = in->read_V32();
- log_abc("Slot id: %u Script index: %u Script Name: %s", _slotID,
+ log_abc("Slot id: %u Class index: %u Class Name: %s", _slotID,
_classInfoIndex,
pBlock->_stringTable->value(
pBlock->_classes[_classInfoIndex]->getName()));
if (_classInfoIndex >= pBlock->_classes.size()) {
- log_error(_("Bad Script id in trait."));
+ log_error(_("Bad Class id in trait."));
return false;
}
break;
@@ -329,7 +329,7 @@
{
std::for_each(_classes.begin(), _classes.end(),
- std::mem_fun(&abc::Script::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,7 +341,7 @@
// scripts have Global as a target object (prototype), so for now we
// will do that.
std::for_each(_scripts.begin(), _scripts.end(),
- boost::bind(&abc::Script::setPrototype, _1, mach->global()));
+ boost::bind(&abc::Class::setPrototype, _1, mach->global()));
std::for_each(_methods.begin(), _methods.end(),
boost::bind(&Method::initPrototype, _1, mach));
@@ -405,8 +405,8 @@
log_abc("Namespace: %s AbcURI=%u URI=%u.", name, ABCName, global_key);
}
-abc::Script*
-AbcBlock::locateScript(const std::string& className)
+abc::Class*
+AbcBlock::locateClass(const std::string& className)
{
const std::string::size_type pos = className.rfind(".");
@@ -432,14 +432,14 @@
}
}
- return locateScript(a);
+ return locateClass(a);
}
-abc::Script*
-AbcBlock::locateScript(MultiName& m)
+abc::Class*
+AbcBlock::locateClass(MultiName& m)
{
- abc::Script* found = 0;
+ abc::Class* found = 0;
if (m.getNamespace())
{
@@ -823,7 +823,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.
- abc::Script* rtScript = locateScript(_multinamePool[return_type]);
+ abc::Class* rtScript = locateClass(_multinamePool[return_type]);
if (!rtScript) {
log_abc(_("ABC: Unknown return type."));
}
@@ -848,7 +848,7 @@
// A value of 0 is legitimate, meaning 'any (*)'.
if (ptype) {
- abc::Script* param_type = locateScript(_multinamePool[ptype]);
+ abc::Class* param_type = locateClass(_multinamePool[ptype]);
if (!param_type) {
log_abc((_("ABC: Unknown parameter type.")));
@@ -936,7 +936,7 @@
log_abc("There are %u instances.", count);
_classes.resize(count);
for (size_t i = 0; i < count; ++i) {
- abc::Script* pScript;
+ abc::Class* pScript;
//Read multiname index.
boost::uint32_t index = _stream->read_V32();
// 0 is allowed as a name, typically for the last entry.
@@ -958,13 +958,13 @@
return false;
}
- pScript = locateScript(multiname);
+ pScript = locateClass(multiname);
if (!pScript) {
const string_table::key className = multiname.getGlobalName();
- pScript = mCH->newScript();
+ pScript = mCH->newClass();
pScript->setName(className);
if (!multiname.getNamespace()->addScript(className,
pScript)) {
@@ -993,7 +993,7 @@
pScript->setSuper(mTheObject);
}
else {
- abc::Script *pSuper =
locateScript(_multinamePool[super_index]);
+ abc::Class *pSuper =
locateClass(_multinamePool[super_index]);
if (!pSuper)
{
log_error(_("ABC: Super type not found (%s)"),
@@ -1015,7 +1015,7 @@
if (pSuper == pScript)
{
- log_error(_("ABC: Script cannot be its own
supertype."));
+ log_error(_("ABC: Class cannot be its own
supertype."));
return false;
}
pScript->setSuper(pSuper);
@@ -1058,7 +1058,7 @@
log_error(_("ABC: Bad name for interface."));
return false;
}
- abc::Script *pInterface =
locateScript(_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())
{
@@ -1109,9 +1109,9 @@
log_abc("There are %u classes.", count);
for (size_t i = 0; i < count; ++i) {
- abc::Script* pScript = _classes[i];
+ abc::Class* pScript = _classes[i];
boost::uint32_t offset = _stream->read_V32();
- log_abc("Script %u(%s) static constructor index=%u", i,
pScript, offset);
+ log_abc("Class %u(%s) static constructor index=%u", i, pScript,
offset);
if (offset >= _methods.size()) {
log_error(_("ABC: Out of bound static constructor for
class."));
@@ -1149,7 +1149,7 @@
_scripts.resize(count);
for (unsigned int i = 0; i < count; ++i)
{
- abc::Script* pScript = mCH->newScript();
+ abc::Class* pScript = mCH->newClass();
_scripts[i] = pScript;
boost::uint32_t offset = _stream->read_V32();
@@ -1161,12 +1161,6 @@
return false;
}
- // 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);
-
pScript->setConstructor(_methods[offset]);
pScript->setSuper(mTheObject);
@@ -1257,7 +1251,7 @@
pExcept->catchAny();
}
else {
- abc::Script *pType =
locateScript(_multinamePool[catch_type]);
+ abc::Class *pType =
locateClass(_multinamePool[catch_type]);
if (!pType) {
log_error(_("ABC: Unknown type of
object to catch. (%s)"),
=== modified file 'libcore/abc/AbcBlock.h'
--- a/libcore/abc/AbcBlock.h 2009-12-01 11:02:43 +0000
+++ b/libcore/abc/AbcBlock.h 2009-12-02 15:57:58 +0000
@@ -35,7 +35,7 @@
namespace abc {
class AbcBlock;
class Machine;
- class Script;
+ class Class;
class Method;
}
class SWFStream; // for read signature
@@ -78,7 +78,7 @@
Method* _method;
bool _valueSet;
- abc::Script* _classTarget;
+ abc::Class* _classTarget;
Method* _methodTarget;
bool _static;
@@ -102,11 +102,11 @@
bool read(SWFStream* in, AbcBlock *pBlock);
- bool finalize(AbcBlock* pBlock, abc::Script* pScript, bool do_static);
+ bool finalize(AbcBlock* pBlock, abc::Class* pScript, bool do_static);
bool finalize_mbody(AbcBlock* pBlock, Method* pMethod);
- void set_target(abc::Script* pScript, bool do_static) {
+ void set_target(abc::Class* pScript, bool do_static) {
_classTarget = pScript;
_static = do_static;
}
@@ -169,14 +169,14 @@
/// the built-in classes already in a namespace: ABC names and global names
/// can have the same index even when the names are different.
//
-/// Script lookup
+/// Class lookup
//
-/// This is particularly important for locateScript (called by
instantiateScript
+/// This is particularly important for locateClass (called by instantiateScript
/// from SymbolScript tag execution). The SymbolScript tag identifies a class
/// using a global name, which may be qualified with a namespace. If it is
/// not qualified, we look in the global namespace 0.
//
-/// When we call locateScript, we use global names, not ABC names, because
+/// When we call locateClass, we use global names, not ABC names, because
/// classes are identified by global names (see above). However, we
/// still look only in the ABC block's namespaces. The block's first namespace
/// is always the global namespace; other package namespaces are imported
@@ -233,9 +233,9 @@
AbcBlock();
- abc::Script* locateScript(MultiName &m);
+ abc::Class* locateClass(MultiName &m);
- abc::Script* locateScript(const std::string& className);
+ abc::Class* locateClass(const std::string& className);
abc::Trait &newTrait()
{
@@ -248,7 +248,10 @@
void update_global_name(unsigned int multiname_index);
- const std::vector<abc::Script*>& scripts() const {
+ /// Scripts can contain several classes.
+ //
+ /// TODO: why on earth are Scripts implemented using Classes?
+ const std::vector<abc::Class*>& scripts() const {
return _scripts;
}
@@ -282,7 +285,7 @@
return _multinamePool[i];
}
- abc::Script* classPoolAt(size_t i) const {
+ abc::Class* classPoolAt(size_t i) const {
checkBounds(i, _classes);
return _classes[i];
}
@@ -333,14 +336,14 @@
std::vector<NamespaceSet> _namespaceSetPool;
std::vector<Method*> _methods;
std::vector<MultiName> _multinamePool;
- std::vector<Script*> _classes;
- std::vector<Script*> _scripts;
+ std::vector<Class*> _classes;
+ std::vector<Class*> _scripts;
std::vector<Trait*> _traits;
string_table* _stringTable;
SWFStream* _stream; // Not stored beyond one read.
- abc::Script *mTheObject;
+ abc::Class *mTheObject;
ClassHierarchy *mCH;
boost::uint32_t mVersion;
=== renamed file 'libcore/abc/Script.cpp' => 'libcore/abc/Class.cpp'
--- a/libcore/abc/Script.cpp 2009-12-02 14:27:13 +0000
+++ b/libcore/abc/Class.cpp 2009-12-02 15:57:58 +0000
@@ -19,7 +19,7 @@
#include "gnashconfig.h"
#endif
-#include "Script.h"
+#include "Class.h"
#include "as_object.h"
#include "ClassHierarchy.h"
#include "VM.h"
@@ -39,8 +39,8 @@
#ifdef ENABLE_AVM2
bool
-Script::addValue(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, Script *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();
@@ -67,32 +67,32 @@
}
void
-Script::initPrototype()
+Class::initPrototype()
{
Global_as& gl = *VM::get().getGlobal();
_prototype = new as_class(gl);
}
bool
-Script::addMemberScript(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, Script *type, bool isstatic)
+Class::addMemberScript(string_table::key name, Namespace *ns,
+ boost::uint32_t slotId, Class *type, bool isstatic)
{
return addSlot(name, ns, slotId, type, isstatic);
}
bool
-Script::addSlotFunction(string_table::key name, Namespace *ns,
+Class::addSlotFunction(string_table::key name, Namespace *ns,
boost::uint32_t slotId, Method *method, bool isstatic)
{
- Script a;
+ Class a;
a.setName(NSV::CLASS_FUNCTION);
as_value b(method->getPrototype());
return addValue(name, ns, slotId, &a, b, false, isstatic);
}
bool
-Script::addSlot(string_table::key name, Namespace* ns,
- boost::uint32_t slotId, Script* /*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;
@@ -107,7 +107,7 @@
}
bool
-Script::addMethod(string_table::key name, Namespace* /*ns*/,
+Class::addMethod(string_table::key name, Namespace* /*ns*/,
Method* method, bool /*isstatic*/)
{
as_value val = new abc::abc_function(method,
@@ -118,7 +118,7 @@
bool
-Script::addGetter(string_table::key name, Namespace *ns, Method *method,
+Class::addGetter(string_table::key name, Namespace *ns, Method *method,
bool isstatic)
{
string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
@@ -141,7 +141,7 @@
}
bool
-Script::addSetter(string_table::key name, Namespace *ns, Method *method,
+Class::addSetter(string_table::key name, Namespace *ns, Method *method,
bool isstatic)
{
string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
@@ -163,7 +163,7 @@
#if 0 // TODO
void
-Script::buildFromPrototype(as_object *o, string_table::key name,
+Class::buildFromPrototype(as_object *o, string_table::key name,
ClassHierarchy *pCH)
{
setName(name);
@@ -190,8 +190,8 @@
}
bool
-Script::addValue(string_table::key name, Namespace *ns, boost::uint32_t slotId,
- Script *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();
@@ -203,8 +203,8 @@
}
bool
-Script::addSlot(string_table::key name, Namespace *ns, boost::uint32_t slotId,
- Script *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);
@@ -214,7 +214,7 @@
}
bool
-Script::addMethod(string_table::key name, Namespace *ns, Method *method,
+Class::addMethod(string_table::key name, Namespace *ns, Method *method,
bool isstatic)
{
if (!isstatic)
@@ -224,8 +224,8 @@
}
bool
-Script::addMemberScript(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, Script *type, bool isstatic)
+Class::addMemberScript(string_table::key name, Namespace *ns,
+ boost::uint32_t slotId, Class *type, bool isstatic)
{
if (!isstatic)
return addBinding(name, asBinding(ns, type, slotId, isstatic));
@@ -234,7 +234,7 @@
// TODO: Figure out how this differs from addMethod
bool
-Script::addSlotFunction(string_table::key name, Namespace *ns,
+Class::addSlotFunction(string_table::key name, Namespace *ns,
boost::uint32_t slotId, Method *method, bool isstatic)
{
if (!isstatic)
=== renamed file 'libcore/abc/Script.h' => 'libcore/abc/Class.h'
--- a/libcore/abc/Script.h 2009-12-02 14:27:13 +0000
+++ b/libcore/abc/Class.h 2009-12-02 15:57:58 +0000
@@ -44,7 +44,7 @@
class BoundValue;
class BoundAccessor;
class Method;
- class Script;
+ class Class;
typedef Property Binding;
class Namespace;
}
@@ -55,32 +55,31 @@
namespace gnash {
namespace abc {
-/// A class to represent, AS3 scripts.
+/// A class to represent AS3 Classes.
//
-/// Used to store ABC scripts. These are not themselves AS-referenceable
+/// Used to store ABC classes. These are not themselves AS-referenceable
/// objects, but can be associated with AS3 Class objects in a way that
/// is yet to be determined.
//
/// TODO: update this documentation when we've worked it out.
//
-/// A Script is a static description of a Class. Scripts have the following
-/// important properties:
+/// An abc::Class is a static description of an ActionScript Class. Classes
+/// have the following important properties:
//
/// 1. A static initialization method ("cinit"). This is executed no more
-/// than once. The point at which the cinit method is called depends on
-/// the structure of the SWF. It is always executed before the iinit
-/// method is called.
+/// than once.
/// 2. A constructor method ("iinit"). This is run every time the Class
/// is constructed. As not all Classes are constructed, the iinit method
/// may never be executed.
//
-/// Note that Gnash (and AS3), a Class is regarded as an instance of a
-/// Script, and an Object is an instance of a Class.
-class Script
+/// A Script may contain more than one class. When a Script runs, the cinit
+/// methods of all its classes are executed in the order they appear in the
+/// Script.
+class Class
{
public:
- Script()
+ Class()
:
_prototype(0),
_final(false),
@@ -119,11 +118,11 @@
#ifdef ENABLE_AVM2
bool addValue(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, Script *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, Script *type, bool isstatic);
+ boost::uint32_t slotID, Class *type, bool isstatic);
bool addMethod(string_table::key name, Namespace *ns, Method *method,
bool isstatic);
@@ -135,7 +134,7 @@
bool isstatic);
bool addMemberScript(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, Script *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,
@@ -195,11 +194,11 @@
void initPrototype();
/// TODO: see if these are useful.
- Script* getSuper() const { return _super; }
- void setSuper(Script *p) { _super = p; }
+ Class* getSuper() const { return _super; }
+ void setSuper(Class *p) { _super = p; }
/// We implement this interface.
- void pushInterface(Script* p) { _interfaces.push_back(p); }
+ void pushInterface(Class* p) { _interfaces.push_back(p); }
/// Set the iinit method.
//
@@ -208,7 +207,7 @@
/// Get the iinit method or 'constructor'.
//
- /// A Script is also valid if it does not have an iinit method, so this
+ /// A Class is also valid if it does not have an iinit method, so this
/// function can return 0.
Method* getConstructor() const {
return _constructor;
@@ -221,7 +220,7 @@
/// Get the cinit method or 'static constructor'.
//
- /// A Script may have no cinit method, so this function can return 0.
+ /// A Class may have no cinit method, so this function can return 0.
Method* getStaticConstructor() const {
return _staticConstructor;
}
@@ -274,9 +273,9 @@
bool _dynamic;
bool _interface;
string_table::key _name;
- std::list<Script*> _interfaces;
+ std::list<Class*> _interfaces;
Namespace* _protectedNs;
- Script* _super;
+ Class* _super;
Method* _constructor;
Method* _staticConstructor;
=== modified file 'libcore/abc/Method.cpp'
--- a/libcore/abc/Method.cpp 2009-12-02 14:27:13 +0000
+++ b/libcore/abc/Method.cpp 2009-12-02 15:57:58 +0000
@@ -20,7 +20,7 @@
#endif
#include "Method.h"
-#include "Script.h"
+#include "Class.h"
#include "CodeStream.h"
#include "abc_function.h"
#include "Global_as.h"
@@ -65,7 +65,7 @@
}
void
-Method::setOwner(Script *pOwner)
+Method::setOwner(Class *pOwner)
{
log_debug("Method::setOwner");
if (!_prototype) {
@@ -75,14 +75,14 @@
}
void
-Method::setReturnType(Script* /*type*/)
+Method::setReturnType(Class* /*type*/)
{
/* No-op */
}
bool
Method::addValue(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, Script *type, as_value& val, bool isconst)
+ boost::uint32_t slotId, Class *type, as_value& val, bool isconst)
{
Global_as* g = VM::get().getGlobal();
if (val.is_object()) {
@@ -147,14 +147,14 @@
bool
Method::addMemberScript(string_table::key name, Namespace *ns,
- boost::uint32_t slotId, Script *type)
+ boost::uint32_t slotId, Class *type)
{
return addSlot(name, ns, slotId, type);
}
bool
Method::addSlot(string_table::key name, Namespace* ns, boost::uint32_t slotId,
- Script */*type*/)
+ Class */*type*/)
{
string_table::key nsname = ns ? ns->getURI() : string_table::key(0);
int flags = PropFlags::dontDelete;
@@ -167,7 +167,7 @@
Method::addSlotFunction(string_table::key name, Namespace *ns,
boost::uint32_t slotId, Method *method)
{
- Script a;
+ Class a;
a.setName(NSV::CLASS_FUNCTION);
as_value b(method->getPrototype());
return addValue(name, ns, slotId, &a, b, false);
=== modified file 'libcore/abc/Method.h'
--- a/libcore/abc/Method.h 2009-12-01 13:01:45 +0000
+++ b/libcore/abc/Method.h 2009-12-02 15:57:58 +0000
@@ -35,7 +35,7 @@
class Machine;
class abc_function;
class Namespace;
- class Script;
+ class Class;
}
class CodeStream;
class as_object;
@@ -53,7 +53,7 @@
{
public:
- typedef std::list<Script*> ArgumentList;
+ typedef std::list<Class*> ArgumentList;
Method();
@@ -125,10 +125,10 @@
void setBody(CodeStream *b) { _body = b; }
bool addValue(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, Script *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, Script *type);
+ boost::uint32_t slotID, Class *type);
bool addMethod(string_table::key name, Namespace *ns, Method *method);
@@ -137,20 +137,20 @@
bool addSetter(string_table::key name, Namespace *ns, Method *method);
bool addMemberScript(string_table::key name, Namespace *ns,
- boost::uint32_t slotID, Script *type);
+ boost::uint32_t slotID, Class *type);
bool addSlotFunction(string_table::key name, Namespace *ns,
boost::uint32_t slotID, Method *method);
/// \brief
/// Set the owner of this method.
- void setOwner(Script* 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
- Script* getReturnType() const;
+ Class* getReturnType() const;
/// Set the return type
//
@@ -159,7 +159,7 @@
/// NB: the return type of a method can be * (any) or void, neither of
/// which are known names, so this may not be an appropriate way to
/// handle return type.
- void setReturnType(Script* t);
+ void setReturnType(Class* t);
Method *getSuper();
@@ -221,7 +221,7 @@
/// Push an argument of type t into the method definition
//
/// A value of 0 stands for 'any'.
- void pushArgument(Script* 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);
}
=== modified file 'libcore/abc/Namespace.cpp'
--- a/libcore/abc/Namespace.cpp 2009-12-01 11:02:43 +0000
+++ b/libcore/abc/Namespace.cpp 2009-12-02 16:47:14 +0000
@@ -33,7 +33,7 @@
void
Namespace::stubPrototype(ClassHierarchy& ch, string_table::key name)
{
- abc::Script *pClass = ch.newScript();
+ abc::Class *pClass = ch.newClass();
pClass->setName(name);
addScript(name, pClass);
}
=== modified file 'libcore/abc/Namespace.h'
--- a/libcore/abc/Namespace.h 2009-12-01 11:11:21 +0000
+++ b/libcore/abc/Namespace.h 2009-12-02 15:57:58 +0000
@@ -24,7 +24,7 @@
// Forward declarations
namespace gnash {
namespace abc {
- class Script;
+ class Class;
}
class ClassHierarchy;
class string_table;
@@ -77,9 +77,9 @@
/// What is the XML prefix?
string_table::key getPrefix() const { return _prefix; }
- /// Add a Script to the namespace. The namespace stores this, but
+ /// Add a Class to the namespace. The namespace stores this, but
/// does not take ownership.
- bool addScript(string_table::key name, Script* a)
+ bool addScript(string_table::key name, Class* a)
{
if (getScriptInternal(name)) return false;
_scripts[static_cast<std::size_t>(name)] = a;
@@ -90,11 +90,11 @@
/// Get the named class. Returns NULL if information is not known
/// about the class. (Stubbed classes still return NULL here.)
- Script* getScript(string_table::key name)
+ Class* getScript(string_table::key name)
{
if (mRecursePrevent) return NULL;
- Script* found = getScriptInternal(name);
+ Class* found = getScriptInternal(name);
if (found || !getParent()) return found;
@@ -124,7 +124,7 @@
string_table::key _uri;
string_table::key _prefix;
- typedef std::map<string_table::key, Script*> container;
+ typedef std::map<string_table::key, Class*> container;
container _scripts;
mutable bool mRecursePrevent;
@@ -132,7 +132,7 @@
bool _protected;
bool _package;
- Script* getScriptInternal(string_table::key name) const
+ Class* getScriptInternal(string_table::key name) const
{
container::const_iterator i;
=== modified file 'libcore/abc/asException.h'
--- a/libcore/abc/asException.h 2009-12-01 11:02:43 +0000
+++ b/libcore/abc/asException.h 2009-12-02 15:57:58 +0000
@@ -21,7 +21,7 @@
namespace gnash {
namespace abc {
class Namespace;
- class Script;
+ class Class;
}
}
@@ -34,7 +34,7 @@
void setEnd(boost::uint32_t i) { mEnd = i; }
void setCatch(boost::uint32_t i) { mCatch = i; }
void catchAny() { mCatchAny = true; }
- void setCatchType(abc::Script* p) { mCatchType = p; }
+ void setCatchType(abc::Class* p) { mCatchType = p; }
void setNamespace(abc::Namespace* n) { _namespace = n; }
void setName(string_table::key name) { _name = name; }
@@ -43,7 +43,7 @@
boost::uint32_t mEnd;
boost::uint32_t mCatch;
bool mCatchAny;
- abc::Script *mCatchType;
+ abc::Class *mCatchType;
abc::Namespace *_namespace;
string_table::key _name;
};
=== modified file 'libcore/vm/ActionExec.cpp'
--- a/libcore/vm/ActionExec.cpp 2009-12-01 08:51:26 +0000
+++ b/libcore/vm/ActionExec.cpp 2009-12-02 15:57:58 +0000
@@ -343,7 +343,7 @@
}
}
catch (ActionLimitException& ex) {
- // Script execution should stop (for this frame only?)
+ // Class execution should stop (for this frame only?)
// Here's were we should pop-up a window to prompt user about
// what to do next (abort or not ?)
cleanupAfterRun(true); // we expect inconsistencies here
=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp 2009-12-02 14:27:13 +0000
+++ b/libcore/vm/Machine.cpp 2009-12-02 16:47:14 +0000
@@ -28,6 +28,7 @@
#include "VM.h"
#include "Globals.h"
#include "Global_as.h"
+#include "Class.h"
namespace gnash {
namespace abc {
@@ -136,7 +137,7 @@
}
}
-inline Script*
+inline Class*
pool_script(boost::uint32_t index, AbcBlock* pool)
{
if (!pool) throw ASException();
@@ -1703,8 +1704,8 @@
case SWF::ABC_ACTION_NEWCLASS:
{
boost::uint32_t cid = mStream->read_V32();
- log_abc("Script index: %s", cid);
- Script* c = pool_script(cid, mPoolObject);
+ log_abc("Class index: %s", cid);
+ Class* c = pool_script(cid, mPoolObject);
log_abc("Creating new class id=%u name=%s", c->getName(),
mST.value(c->getName()));
@@ -2906,7 +2907,7 @@
}
void
-Machine::getMember(Script* pDefinition, MultiName& name,
+Machine::getMember(Class* pDefinition, MultiName& name,
as_value& instance)
{
if (!instance.is_object())
@@ -2930,7 +2931,7 @@
}
void
-Machine::setMember(Script *pDefinition, MultiName& name, as_value& instance,
+Machine::setMember(Class *pDefinition, MultiName& name, as_value& instance,
as_value& newvalue)
{
if (!instance.is_object())
@@ -2987,13 +2988,13 @@
return size;
}
-Script *
+Class *
Machine::findSuper(as_value &v, bool find_for_primitive)
{
if (v.is_undefined() || v.is_null()) return NULL;
if (v.is_object()) {
- Script *pProto = NULL; // TODO:
v.to_object(*_global)->getScript();
+ Class *pProto = NULL; // TODO:
v.to_object(*_global)->getScript();
return pProto ? pProto->getSuper() : NULL;
}
@@ -3134,7 +3135,7 @@
{
mPoolObject = pool_block;
log_debug("Getting entry script.");
- Script* start_script = pool_block->scripts().back();
+ Class* start_script = pool_block->scripts().back();
log_debug("Getting constructor.");
Method* constructor = start_script->getConstructor();
clearRegisters(constructor->getMaxRegisters());
@@ -3210,7 +3211,7 @@
log_debug("instantiateClass: class name %s", className);
- Script* cl = mPoolObject->locateScript(className);
+ Class* cl = mPoolObject->locateClass(className);
if (!cl)
{
/// This seems like a big error.
@@ -3221,7 +3222,7 @@
Method* ctor = cl->getConstructor();
if (!ctor) {
- log_error("Script found has no constructor, can't instantiate "
+ log_error("Class found has no constructor, can't instantiate "
"class");
return;
}
=== modified file 'libcore/vm/Machine.h'
--- a/libcore/vm/Machine.h 2009-12-01 11:02:43 +0000
+++ b/libcore/vm/Machine.h 2009-12-02 16:47:14 +0000
@@ -23,7 +23,6 @@
#include <sstream>
#include "SafeStack.h"
#include "as_value.h"
-#include "Script.h"
#include "SWF.h"
#include "as_environment.h"
#include "VM.h"
@@ -33,6 +32,11 @@
namespace abc {
class AbcBlock;
class MultiName;
+ class Class;
+ class abc_function;
+ typedef Property Binding;
+ class Method;
+ class Namespace;
}
class Global_as;
class DisplayObject;
@@ -120,7 +124,7 @@
///
/// @return
/// Null if the superclass was not found, or the superclass.
- Script* findSuper(as_value& obj, bool find_primitive);
+ Class* findSuper(as_value& obj, bool find_primitive);
/// Get a member from an object.
///
@@ -138,7 +142,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(Script* pDefinition, MultiName& name,
+ void getMember(Class* pDefinition, MultiName& name,
as_value& source);
/// Set a member in an object.
@@ -157,7 +161,7 @@
///
/// @return
/// Nothing.
- void setMember(Script*, MultiName&, as_value& target, as_value& val);
+ void setMember(Class*, MultiName&, as_value& target, as_value& val);
Binding* findProperty(MultiName&) { return NULL; }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11676: Restore class name from Script to Class.,
Benjamin Wolsey <=