Go to the documentation of this file.
22 #ifndef GNASH_ABC_BLOCK_H
23 #define GNASH_ABC_BLOCK_H
42 class ClasstHierarchy;
123 return finalize(block, _classTarget, _static);
134 std::uint32_t _slotID;
135 std::uint32_t _typeIndex;
136 std::uint32_t _classInfoIndex;
158 inline void checkBounds(
size_t i,
const T& container)
160 if (
i >= container.size()) {
161 throw std::range_error(
"Attempt to access pool out of range");
271 const std::vector<abc::Class*>&
scripts()
const {
276 checkBounds(
i, _uIntegerPool);
277 return _uIntegerPool[
i];
281 checkBounds(
i, _stringPool);
282 return _stringPool[
i];
286 checkBounds(
i, _integerPool);
287 return _integerPool[
i];
291 checkBounds(
i, _doublePool);
292 return _doublePool[
i];
296 checkBounds(
i, _methods);
301 checkBounds(
i, _multinamePool);
302 return _multinamePool[
i];
306 checkBounds(
i, _classes);
311 checkBounds(
i, _namespacePool);
312 return _namespacePool[
i];
324 bool read_integer_constants();
325 bool read_unsigned_integer_constants();
326 bool read_double_constants();
327 bool read_string_constants();
328 bool read_namespaces();
329 bool read_namespace_sets();
330 bool read_multinames();
331 bool read_method_infos();
332 bool skip_metadata();
333 bool read_instances();
336 bool read_method_bodies();
338 void check_multiname_name(std::uint32_t
name);
340 void check_multiname_namespace(std::uint32_t ns);
342 void check_multiname_namespaceset(std::uint32_t nsset);
348 std::vector<std::int32_t> _integerPool;
349 std::vector<std::uint32_t> _uIntegerPool;
350 std::vector<double> _doublePool;
351 std::vector<std::string> _stringPool;
352 std::vector<Namespace*> _namespacePool;
353 std::vector<NamespaceSet> _namespaceSetPool;
355 std::vector<MultiName> _multinamePool;
356 std::vector<Class*> _classes;
357 std::vector<Class*> _scripts;
365 std::uint32_t mVersion;
string_table::key getName() const
The global name of the class.
Definition: Class.h:182
@ INSTANCE_INTERFACE
Definition: AbcBlock.h:239
@ KIND_CLASS
Definition: AbcBlock.h:82
@ KIND_FUNCTION
Definition: AbcBlock.h:83
bool finalize(AbcBlock *block)
Definition: AbcBlock.h:120
@ STATIC_PROTECTED_NS
Definition: AbcBlock.h:220
@ PRIVATE_NS
Definition: AbcBlock.h:214
Class describing a static property.
Definition: AbcBlock.h:72
@ POOL_NULL
Definition: AbcBlock.h:253
std::string name
Definition: LocalConnection_as.cpp:149
void setPrototype(as_object *prototype)
Necessary for the current bogus implementation.
Definition: Class.h:248
@ INSTANCE_SEALED
Definition: AbcBlock.h:237
The base class for all ActionScript objects.
Definition: as_object.h:162
bool addSlotFunction(string_table::key name, Namespace *ns, std::uint32_t slotID, Method *method, bool isstatic)
Definition: Class.cpp:97
bool addMethod(string_table::key name, Namespace *ns, Method *method)
Definition: Method.cpp:196
bool addValue(string_table::key name, Namespace *ns, std::uint32_t slotID, Class *type, as_value &val, bool isconst)
Definition: Method.cpp:95
bool read(SWFStream *in, AbcBlock *block)
Read an AS3 'trait'.
Definition: AbcBlock.cpp:183
double doublePoolAt(size_t i) const
Definition: AbcBlock.h:290
const std::string & stringPoolAt(size_t i) const
Definition: AbcBlock.h:280
Trait()
Definition: AbcBlock.h:86
@ T
Definition: GnashKey.h:132
@ PACKAGE_NS
Definition: AbcBlock.h:216
A general use string table.
Definition: string_table.h:42
abc::Class * classPoolAt(size_t i) const
Definition: AbcBlock.h:305
const std::string & value(key to_find) const
Find a string by its key.
Definition: string_table.h:102
@ CLASS_OBJECT
Definition: namedStrings.h:233
void log_debug(StringType msg, Args... args)
Definition: log.h:301
Represent an ActionScript Namespace.
Definition: Namespace.h:49
@ i
Definition: GnashKey.h:155
bool read(SWFStream &in)
Definition: AbcBlock.cpp:1294
@ KIND_Qname
Definition: MultiName.h:57
Global_as * global()
Return the Global object for this Machine.
Definition: Machine.cpp:365
@ KIND_RTQnameLA
Definition: MultiName.h:62
#define _(String)
Definition: log.h:44
@ POOL_STRING
Definition: AbcBlock.h:246
void initTraits(AbcBlock &bl)
This initializes all the traits.
Definition: Class.cpp:80
size_t URI
This type should always be used for the index of AbcBlocks' names.
Definition: MultiName.h:42
The AVM1 virtual machine.
Definition: VM.h:72
@ POOL_DOUBLE
Definition: AbcBlock.h:249
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
@ KIND_CONST
Definition: AbcBlock.h:78
An MultiName represents a single ABC multiname.
Definition: MultiName.h:52
bool addSetter(string_table::key name, Namespace *ns, Method *method, bool isstatic)
Definition: Class.cpp:154
@ m
Definition: GnashKey.h:159
Method * methodPoolAt(size_t i) const
Definition: AbcBlock.h:295
double read_d64()
Read a 64-bit double value.
Definition: SWFStream.cpp:300
@ INSTANCE_FINAL
Definition: AbcBlock.h:238
@ n
Definition: GnashKey.h:160
void setGlobalName(string_table::key n)
Definition: MultiName.h:102
The ActionScript bytecode of a single ABC tag in a SWF.
Definition: AbcBlock.h:209
@ PACKAGE_INTERNAL_NS
Definition: AbcBlock.h:217
bool addGetter(string_table::key name, Namespace *ns, Method *method, bool isstatic)
Definition: Class.cpp:134
@ METHOD_MORE
Definition: AbcBlock.h:227
@ PROTECTED_NS
Definition: AbcBlock.h:218
std::vector< Namespace * > NamespaceSet
Definition: AbcBlock.h:256
@ KIND_MultinameA
Definition: MultiName.h:64
void log_error(StringType msg, Args... args)
Definition: log.h:283
@ INSTANCE_DYNAMIC
Definition: AbcBlock.h:240
abc::URI getABCName() const
Definition: MultiName.h:98
@ k
Definition: GnashKey.h:157
@ POOL_NAMESPACE
Definition: AbcBlock.h:250
std::int32_t integerPoolAt(size_t i) const
Definition: AbcBlock.h:285
@ METHOD_NATIVE
Definition: AbcBlock.h:230
bool finalize_mbody(AbcBlock *block, Method *m)
Definition: AbcBlock.cpp:115
NamespaceConstant
Definition: AbcBlock.h:213
PoolConstant
Definition: AbcBlock.h:245
@ t
Definition: GnashKey.h:166
bool addValue(string_table::key name, Namespace *ns, std::uint32_t slotID, Class *type, as_value &val, bool isconst, bool isstatic)
Definition: Class.cpp:42
@ METHOD_ARGS
Definition: AbcBlock.h:225
@ KIND_GETTER
Definition: AbcBlock.h:80
void initPrototype()
Necessary for the current bogus implementation.
Definition: Class.cpp:72
bool addSlotFunction(string_table::key name, Namespace *ns, std::uint32_t slotID, Method *method)
Definition: Method.cpp:180
void for_each(C &container, R(T::*pmf)(const A &), const A &arg)
Definition: Renderer_ogl.cpp:690
@ KIND_Multiname
Definition: MultiName.h:63
bool finalize(AbcBlock *block, abc::Class *cl, bool do_static)
Definition: AbcBlock.cpp:42
@ a
Definition: GnashKey.h:147
type
Definition: GnashKey.h:330
@ KIND_QnameA
Definition: MultiName.h:58
void prepare(Machine *mach)
Definition: AbcBlock.cpp:322
Kind
Definition: AbcBlock.h:76
@ KIND_SETTER
Definition: AbcBlock.h:81
void log_abc(StringType msg, Args... args)
Definition: log.h:337
T * get(as_object *o)
Extract the DisplayObject attached to an object.
Definition: as_object.h:842
@ length
Definition: klash_part.cpp:329
void initTraits(AbcBlock &bl)
Initialize Traits. This is bogus.
Definition: Method.cpp:82
bool addMemberScript(string_table::key name, Namespace *ns, std::uint32_t slotID, Class *type, bool isstatic)
Definition: Class.cpp:90
@ CONSTANT_NS
Definition: AbcBlock.h:215
@ POOL_INTEGER
Definition: AbcBlock.h:247
The virtual machine for executing ABC (ActionScript Bytecode).
Definition: Machine.h:74
A class to represent AS3 Classes.
Definition: Class.h:76
const std::vector< abc::Class * > & scripts() const
Scripts can contain several classes.
Definition: AbcBlock.h:271
@ METHOD_ARG_NAMES
Definition: AbcBlock.h:232
@ _1
Definition: GnashKey.h:95
Namespace * namespacePoolAt(size_t i) const
Definition: AbcBlock.h:310
@ KIND_MultinameLA
Definition: MultiName.h:66
An SWF parsing exception.
Definition: GnashException.h:90
ActionScript value type.
Definition: as_value.h:95
@ KIND_RTQnameL
Definition: MultiName.h:61
bool addMemberScript(string_table::key name, Namespace *ns, std::uint32_t slotID, Class *type)
Definition: Method.cpp:162
AbcBlock()
Definition: AbcBlock.cpp:311
@ j
Definition: GnashKey.h:156
@ KIND_METHOD
Definition: AbcBlock.h:79
#define IF_VERBOSE_PARSE(x)
Definition: log.h:378
key find(const std::string &to_find, bool insert_unfound=true)
Find a key for a string.
Definition: string_table.cpp:40
@ POOL_UINTEGER
Definition: AbcBlock.h:248
bool addGetter(string_table::key name, Namespace *ns, Method *method)
Definition: Method.cpp:122
@ KIND_RTQnameA
Definition: MultiName.h:60
bool addMethod(string_table::key name, Namespace *ns, Method *method, bool isstatic)
Definition: Class.cpp:123
@ POOL_FALSE
Definition: AbcBlock.h:251
Kind
Definition: MultiName.h:56
InstanceConstant
Definition: AbcBlock.h:236
@ KIND_MultinameL
Definition: MultiName.h:65
abc::Class * locateClass(MultiName &m)
Definition: AbcBlock.cpp:437
std::uint16_t read_u16()
Read a aligned unsigned 16-bit value from the stream.
Definition: SWFStream.cpp:332
void set_target(Method *m)
Definition: AbcBlock.h:115
@ METHOD_ACTIVATION
Definition: AbcBlock.h:226
@ c
Definition: GnashKey.h:149
string_table & getStringTable(const as_environment &env)
Definition: as_environment.cpp:639
bool addSetter(string_table::key name, Namespace *ns, Method *method)
Definition: Method.cpp:142
std::uint8_t read_u8()
Read a aligned unsigned 8-bit value from the stream.
Definition: SWFStream.cpp:319
void skip_V32()
Skip a variable length unsigned 32-bit value in the stream. This is faster than doing the bitwise ari...
Definition: SWFStream.h:220
void update_global_name(unsigned int multiname_index)
Definition: AbcBlock.cpp:1346
std::uint32_t read_V32()
Read a variable length unsigned 32-bit value from the stream. These values continue until either the ...
Definition: SWFStream.h:191
void read_string_with_length(std::string &to)
Reads a sized string into a provided std::string.
Definition: SWFStream.cpp:411
std::size_t key
Definition: string_table.h:83
SWF stream wrapper class.
Definition: SWFStream.h:59
@ METHOD_OPTIONAL_ARGS
Definition: AbcBlock.h:228
Register all of the ActionScript classes, with their dependencies.
Definition: ClassHierarchy.h:41
@ POOL_TRUE
Definition: AbcBlock.h:252
@ o
Definition: GnashKey.h:161
void initPrototype(Machine *machine)
Definition: Method.cpp:190
@ METHOD_IGNORE
Definition: AbcBlock.h:229
MultiName multinamePoolAt(size_t i) const
Definition: AbcBlock.h:300
std::map< NPIdentifier, NPInvokeFunctionPtr > _methods
Definition: gshell.cpp:402
MethodConstant
Definition: AbcBlock.h:224
@ EXPLICIT_NS
Definition: AbcBlock.h:219
@ METHOD_DEFAULT_NS
Definition: AbcBlock.h:231
std::uint32_t uIntegerPoolAt(size_t i) const
Definition: AbcBlock.h:275
@ KIND_RTQname
Definition: MultiName.h:59
std::ostream & operator<<(std::ostream &o, const Trait::Kind k)
Output stream operator for abc::Trait::Kind.
Definition: AbcBlock.cpp:289
@ KIND_SLOT
Definition: AbcBlock.h:77
void set_target(abc::Class *cl, bool do_static)
Definition: AbcBlock.h:110
@ INSTANCE_PROTECTED_NS
Definition: AbcBlock.h:241