Gnash
0.8.10
|
The ActionScript bytecode of a single ABC tag in a SWF. More...
#include <AbcBlock.h>
Public Types | |
enum | NamespaceConstant { PRIVATE_NS = 0x05, CONSTANT_NS = 0x08, PACKAGE_NS = 0x16, PACKAGE_INTERNAL_NS = 0x17, PROTECTED_NS = 0x18, EXPLICIT_NS = 0x19, STATIC_PROTECTED_NS = 0x1A } |
enum | MethodConstant { METHOD_ARGS = 0x01, METHOD_ACTIVATION = 0x02, METHOD_MORE = 0x04, METHOD_OPTIONAL_ARGS = 0x08, METHOD_IGNORE = 0x10, METHOD_NATIVE = 0x20, METHOD_DEFAULT_NS = 0x40, METHOD_ARG_NAMES = 0x80 } |
enum | InstanceConstant { INSTANCE_SEALED = 0x01, INSTANCE_FINAL = 0x02, INSTANCE_INTERFACE = 0x04, INSTANCE_DYNAMIC = 0x00, INSTANCE_PROTECTED_NS = 0x08 } |
enum | PoolConstant { POOL_STRING = 0x01, POOL_INTEGER = 0x03, POOL_UINTEGER = 0x04, POOL_DOUBLE = 0x06, POOL_NAMESPACE = 0x08, POOL_FALSE = 0x0A, POOL_TRUE = 0x0B, POOL_NULL = 0x0C } |
typedef std::vector< Namespace * > | NamespaceSet |
Public Member Functions | |
AbcBlock () | |
abc::Class * | locateClass (MultiName &m) |
abc::Class * | locateClass (const std::string &className) |
bool | read (SWFStream &in) |
void | update_global_name (unsigned int multiname_index) |
const std::vector< abc::Class * > & | scripts () const |
Scripts can contain several classes. | |
boost::uint32_t | uIntegerPoolAt (size_t i) const |
const std::string & | stringPoolAt (size_t i) const |
boost::int32_t | integerPoolAt (size_t i) const |
double | doublePoolAt (size_t i) const |
Method * | methodPoolAt (size_t i) const |
MultiName | multinamePoolAt (size_t i) const |
abc::Class * | classPoolAt (size_t i) const |
Namespace * | namespacePoolAt (size_t i) const |
void | prepare (Machine *mach) |
Friends | |
class | abc::Trait |
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. ABC blocks have a set of "namespace" resources. Some namespaces are private. We make these into anonymous namespaces. We assume all non-private namespaces are public. Some are "package" namespaces; these seem to coincide with the built-in packages or 0, the global namespace.
We always search for these public namespaces by global URI in our ClassHierarchy. If we use ABC names, "flash.text" will not find the built-in flash.text namespace. Using the global name means that we 'import' the built-in namespace into our own resources. Instances / Scriptes Likewise, classes are always given a global name, not an ABC name. This is because they become globally available, including (we assume) to other ABC blocks, so using an ABC name means they cannot be located externally. Even if ABC block resources should not be available to other blocks (which seems unlikely), using an ABC name for classes risks name conflicts with the built-in classes already in a namespace: ABC names and global names can have the same index even when the names are different. Class lookup 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 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 according to the block's namespace constants.
typedef std::vector<Namespace*> gnash::abc::AbcBlock::NamespaceSet |
gnash::abc::AbcBlock::AbcBlock | ( | ) |
References gnash::get(), and gnash::NSV::CLASS_OBJECT.
abc::Class* gnash::abc::AbcBlock::classPoolAt | ( | size_t | i | ) | const [inline] |
References gnash::key::i.
double gnash::abc::AbcBlock::doublePoolAt | ( | size_t | i | ) | const [inline] |
References gnash::key::i.
boost::int32_t gnash::abc::AbcBlock::integerPoolAt | ( | size_t | i | ) | const [inline] |
References gnash::key::i.
abc::Class * gnash::abc::AbcBlock::locateClass | ( | MultiName & | m | ) |
References gnash::abc::MultiName::getNamespace(), gnash::abc::Namespace::getScript(), gnash::abc::MultiName::getGlobalName(), gnash::abc::MultiName::namespaceSet(), and gnash::key::i.
Referenced by gnash::abc::Trait::finalize(), gnash::abc::Trait::finalize_mbody(), locateClass(), and gnash::abc::Machine::instantiateClass().
abc::Class * gnash::abc::AbcBlock::locateClass | ( | const std::string & | className | ) |
Method* gnash::abc::AbcBlock::methodPoolAt | ( | size_t | i | ) | const [inline] |
References gnash::key::i.
MultiName gnash::abc::AbcBlock::multinamePoolAt | ( | size_t | i | ) | const [inline] |
References gnash::key::i.
Namespace* gnash::abc::AbcBlock::namespacePoolAt | ( | size_t | i | ) | const [inline] |
References gnash::key::i.
void gnash::abc::AbcBlock::prepare | ( | Machine * | mach | ) |
References gnash::renderer::opengl::for_each(), gnash::abc::Class::initPrototype(), gnash::abc::Class::setPrototype(), gnash::key::_1, gnash::abc::Machine::global(), gnash::abc::Method::initPrototype(), gnash::abc::Method::initTraits(), and gnash::abc::Class::initTraits().
Referenced by gnash::SWF::DoABCTag::executeActions().
bool gnash::abc::AbcBlock::read | ( | SWFStream & | in | ) |
References gnash::key::i, and IF_VERBOSE_PARSE.
const std::vector<abc::Class*>& gnash::abc::AbcBlock::scripts | ( | ) | const [inline] |
Scripts can contain several classes.
TODO: why on earth are Scripts implemented using Classes?
Referenced by gnash::abc::Machine::initMachine().
const std::string& gnash::abc::AbcBlock::stringPoolAt | ( | size_t | i | ) | const [inline] |
References gnash::key::i.
Referenced by gnash::abc::Machine::execute().
boost::uint32_t gnash::abc::AbcBlock::uIntegerPoolAt | ( | size_t | i | ) | const [inline] |
References gnash::key::i.
void gnash::abc::AbcBlock::update_global_name | ( | unsigned int | multiname_index | ) |
friend class abc::Trait [friend] |