Gnash  0.8.11dev
Machine.h
Go to the documentation of this file.
1 // Machine.h A VM to run AS3 code, and AS2 code in the future.
2 //
3 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc.
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 #ifndef GNASH_MACHINE_H
21 #define GNASH_MACHINE_H
22 
23 #include <string>
24 #include <vector>
25 #include "SafeStack.h"
26 #include "as_value.h"
27 #include "log.h"
28 
29 namespace gnash {
30  namespace abc {
31  class AbcBlock;
32  class MultiName;
33  class Class;
34  class abc_function;
35  class Method;
36  class Namespace;
37  }
38  class Global_as;
39  class DisplayObject;
40  class as_object;
41  class Property;
42  class CodeStream;
43  class VM;
44  template <typename T> class FunctionArgs;
45  class string_table;
46 }
47 
48 
49 namespace gnash {
50 
51 namespace abc {
52 
54 //
73 class Machine
74 {
75 public:
76 
78  Machine(VM& vm);
79 
81  //
88  //
90  void init();
91 
92 
93  // Flash specific members.
96 
99  void setTarget(DisplayObject* target);
100 
115  int completeName(MultiName& name, int initial = 0);
116 
127  Class* findSuper(as_value& obj, bool find_primitive);
128 
145  void getMember(Class* pDefinition, MultiName& name, as_value& source);
146 
163  void setMember(Class*, MultiName&, as_value& target, as_value& val);
164 
165  Property* findProperty(MultiName&) { return NULL; }
166 
167  void execute();
168 
188  void pushGet(as_object *this_obj, as_value& return_slot, Property *prop);
189 
204  void pushSet(as_object *this_obj, as_value& value, Property *prop);
205 
231  void pushCall(as_function *func, as_object *pThis, as_value& return_slot,
232  unsigned char stack_in, short stack_out);
233 
234  void immediateFunction(const as_function *to_call, as_object* pThis,
235  as_value& storage, unsigned char stack_in, short stack_out);
236 
237  void immediateProcedure(const as_function *to_call, as_object *pthis,
238  unsigned char stack_in, short stack_out) {
239  immediateFunction(to_call, pthis, mIgnoreReturn, stack_in, stack_out);
240  }
241 
242  void initMachine(AbcBlock* pool_block);
243 
244  as_value executeFunction(Method* function, const fn_call& fn);
245 
246  void instantiateClass(std::string className, as_object* global);
248  //
253  Global_as* global();
254 
255  void markReachableResources() const;
256 
257 private:
259  class State
260  {
261  public:
262  unsigned int _stackDepth;
263  unsigned int _stackTotalSize;
264  unsigned int _scopeStackDepth;
265  unsigned int mScopeTotalSize;
266  bool mReturn;
267  CodeStream *mStream;
268  Namespace *mDefaultXMLNamespace;
269  as_object *mCurrentScope;
270  as_value *mGlobalReturn;
271  as_object *mThis;
272  std::vector<as_value> _registers;
273  abc_function* mFunction;
274  void to_debug_string(){
275  log_abc("StackDepth=%u StackTotalSize=%u ScopeStackDepth=%u ScopeTotalSize=%u",_stackDepth,_stackTotalSize,_scopeStackDepth,mScopeTotalSize);
276 
277  }
278  };
279 
280  class Scope
281  {
282  public:
283  unsigned int mHeightAfterPop;
284  as_object *mScope;
285 
286  Scope() : mHeightAfterPop(0), mScope(NULL) {}
287  Scope(unsigned int i, as_object *o) : mHeightAfterPop(i),
288  mScope(o)
289  {}
290  };
291 
292  void saveState();
293  void restoreState();
294 
295  as_value find_prop_strict(MultiName multiname);
296 
297  void print_stack();
298 
299  void print_scope_stack();
300 
301  void get_args(size_t argc, FunctionArgs<as_value>& args);
302 
303  void load_function(CodeStream* stream, std::uint32_t maxRegisters);
304 
305  void executeCodeblock(CodeStream* stream);
306 
307  void clearRegisters(std::uint32_t maxRegsiters);
308 
309  const as_value& getRegister(int index){
310  log_abc("Getting value at a register %d ", index);
311  return _registers[index];
312  }
313 
314  void setRegister(size_t index, const as_value& val) {
315  log_abc("Putting %s in register %s", val, index);
316  if (_registers.size() <= index) {
317  log_abc("Register doesn't exist! Adding new registers!");
318  _registers.resize(index + 1);
319  }
320  _registers[index] = val;
321  }
322 
323  void push_stack(as_value object){
324  log_abc("Pushing value %s onto stack.", object);
325  _stack.push(object);
326  }
327 
328  as_value pop_stack(){
329  as_value value = _stack.pop();
330  log_abc("Popping value %s off the stack.", value);
331  return value;
332  }
333 
334  void push_scope_stack(as_value object);
335 
336  as_object* pop_scope_stack() {
337  log_abc("Popping value %s off the scope stack. There will be "
338  "%u items left.", as_value(_scopeStack.top(0)),
339  _scopeStack.size()-1);
340  return _scopeStack.pop();
341  }
342 
343  as_object* get_scope_stack(std::uint8_t depth) const {
344  log_abc("Getting value from scope stack %u from the bottom.",
345  depth | 0x0);
346  return _scopeStack.value(depth);
347  }
348 
349  SafeStack<as_value> _stack;
350  SafeStack<State> mStateStack;
351  std::vector<as_value> _registers;
352 
354  //
361  SafeStack<as_object*> _scopeStack;
362 
363  CodeStream *mStream;
364 
365  string_table& mST;
366 
367  Namespace* mDefaultXMLNamespace;
368  as_object* mCurrentScope;
369  as_object* mGlobalScope;
370  as_object* mDefaultThis;
371  as_object* mThis;
372 
374  Global_as* _global;
375 
376  as_value mGlobalReturn;
377  as_value mIgnoreReturn; // Throw away returns go here.
378 
379  bool mExitWithReturn;
380  AbcBlock* mPoolObject; // Where all of the pools are stored.
381 
382  abc_function* mCurrentFunction;
383 
384  VM& _vm;
385 };
386 } // namespace abc
387 } // namespace gnash
388 #endif
gnash::SWF::ABC_ACTION_IFEQ
@ ABC_ACTION_IFEQ
Definition: SWF.h:467
gnash::abc::Machine::findProperty
Property * findProperty(MultiName &)
Definition: Machine.h:165
gnash::abc::Machine::immediateFunction
void immediateFunction(const as_function *to_call, as_object *pThis, as_value &storage, unsigned char stack_in, short stack_out)
Definition: Machine.cpp:3033
gnash::SWF::ABC_ACTION_IN
@ ABC_ACTION_IN
Definition: SWF.h:1338
gnash::SWF::ABC_ACTION_URSHIFT
@ ABC_ACTION_URSHIFT
Definition: SWF.h:1246
gnash::SWF::ABC_ACTION_CALLSUPER
@ ABC_ACTION_CALLSUPER
Definition: SWF.h:737
gnash::setNaN
void setNaN(as_value &v)
Set a value to NaN.
Definition: as_value.h:524
gnash::SWF::ABC_ACTION_FINDPROPSTRICT
@ ABC_ACTION_FINDPROPSTRICT
Definition: SWF.h:874
gnash::SWF::ABC_ACTION_CONVERT_O
@ ABC_ACTION_CONVERT_O
Definition: SWF.h:1046
gnash::SWF::ABC_ACTION_ISTYPE
@ ABC_ACTION_ISTYPE
Definition: SWF.h:1323
gnash::toNumber
double toNumber(const as_value &v, const VM &vm)
Convert an as_value to a double.
Definition: VM.cpp:451
gnash::as_value::to_bool
DSOTEXPORT bool to_bool(int version) const
Conversion to boolean.
Definition: as_value.cpp:423
gnash::abc::Namespace::getURI
string_table::key getURI() const
What is the Uri of the namespace?
Definition: Namespace.h:76
gnash::SWF::ABC_ACTION_IFSTRICTNE
@ ABC_ACTION_IFSTRICTNE
Definition: SWF.h:530
gnash::SWF::ABC_ACTION_NEGATE
@ ABC_ACTION_NEGATE
Definition: SWF.h:1132
gnash::SWF::ABC_ACTION_NEWOBJECT
@ ABC_ACTION_NEWOBJECT
Definition: SWF.h:822
gnash::abc::Machine::completeName
int completeName(MultiName &name, int initial=0)
Definition: Machine.cpp:2986
name
std::string name
Definition: LocalConnection_as.cpp:149
gnash::SWF::ABC_ACTION_SUBTRACT
@ ABC_ACTION_SUBTRACT
Definition: SWF.h:1204
gnash::SWF::ABC_ACTION_NEWCLASS
@ ABC_ACTION_NEWCLASS
Definition: SWF.h:846
gnash::SWF::ABC_ACTION_IFLT
@ ABC_ACTION_IFLT
Definition: SWF.h:485
gnash::toInt
std::int32_t toInt(const as_value &v, const VM &vm)
AS2-compatible conversion to 32bit integer.
Definition: VM.cpp:463
Class.h
gnash::SWF::ABC_ACTION_DECLOCAL_I
@ ABC_ACTION_DECLOCAL_I
See: 0x94 (ABC_ACTION_DECLOCAL), but forces types to int, not double.
Definition: SWF.h:1362
gnash::SWF::ABC_ACTION_CONSTRUCTSUPER
@ ABC_ACTION_CONSTRUCTSUPER
Definition: SWF.h:765
gnash::SWF::ABC_ACTION_JUMP
@ ABC_ACTION_JUMP
Definition: SWF.h:441
gnash::as_object
The base class for all ActionScript objects.
Definition: as_object.h:162
as_object.h
gnash::CodeStream::read_as3op
std::uint8_t read_as3op()
Read an opcode for ActionScript 3.
Definition: CodeStream.cpp:54
gnash::SWF::ABC_ACTION_DIVIDE
@ ABC_ACTION_DIVIDE
Definition: SWF.h:1218
gnash::abc::AbcBlock::stringPoolAt
const std::string & stringPoolAt(size_t i) const
Definition: AbcBlock.h:280
CodeStream.h
gnash::SWF::ABC_ACTION_IFSTRICTEQ
@ ABC_ACTION_IFSTRICTEQ
Definition: SWF.h:521
gnash::SWF::ABC_ACTION_CALLPROPVOID
@ ABC_ACTION_CALLPROPVOID
Definition: SWF.h:802
gnash::getName
string_table::key getName(const ObjectURI &o)
Get the name element of an ObjectURI.
Definition: ObjectURI.h:116
gnash::SWF::ABC_ACTION_PUSHDOUBLE
@ ABC_ACTION_PUSHDOUBLE
Definition: SWF.h:652
gnash::SWF::ABC_ACTION_COERCE_I
@ ABC_ACTION_COERCE_I
Definition: SWF.h:1084
gnash::SWF::ABC_ACTION_IFNE
@ ABC_ACTION_IFNE
Definition: SWF.h:476
gnash::SWF::ABC_ACTION_COERCE_S
@ ABC_ACTION_COERCE_S
Definition: SWF.h:1095
gnash::abc::Class::getSuper
Class * getSuper() const
Retrieve the Class from which this Class derives.
Definition: Class.h:185
gnash::SWF::ABC_ACTION_NOT
@ ABC_ACTION_NOT
Definition: SWF.h:1170
gnash::abc::Method
Definition: Method.h:54
gnash::string_table::value
const std::string & value(key to_find) const
Find a string by its key.
Definition: string_table.h:102
gnash::abc::Machine::setMember
void setMember(Class *, MultiName &, as_value &target, as_value &val)
Definition: Machine.cpp:2954
gnash::abc::Class::getConstructor
Method * getConstructor() const
Get the iinit method or 'constructor'.
Definition: Class.h:204
gnash::SWF::ABC_ACTION_FINDDEF
@ ABC_ACTION_FINDDEF
Definition: SWF.h:887
gnash::SWF::ABC_ACTION_IFNLT
@ ABC_ACTION_IFNLT
Definition: SWF.h:409
gnash::abc::Machine::getMember
void getMember(Class *pDefinition, MultiName &name, as_value &source)
Definition: Machine.cpp:2930
gnash::SWF::ABC_ACTION_HASNEXT2
@ ABC_ACTION_HASNEXT2
Definition: SWF.h:673
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
gnash::abc::Namespace
Represent an ActionScript Namespace.
Definition: Namespace.h:49
gnash::SWF::ABC_ACTION_LSHIFT
@ ABC_ACTION_LSHIFT
Definition: SWF.h:1232
gnash::CodeStream::seekBy
void seekBy(int change)
Change the current position by a relative value.
Definition: CodeStream.cpp:68
gnash::key::i
@ i
Definition: GnashKey.h:155
LOG_ONCE
#define LOG_ONCE(x)
Definition: log.h:49
gnash::SWF::ABC_ACTION_GETPROPERTY
@ ABC_ACTION_GETPROPERTY
Definition: SWF.h:939
gnash::SWF::ABC_ACTION_NEWACTIVATION
@ ABC_ACTION_NEWACTIVATION
Definition: SWF.h:837
gnash::as_object::set_prototype
void set_prototype(const as_value &proto)
Set this object's proto member.
Definition: as_object.cpp:518
gnash::SWF::ABC_ACTION_PUSHBYTE
@ ABC_ACTION_PUSHBYTE
Definition: SWF.h:594
gnash::abc::Machine::global
Global_as * global()
Return the Global object for this Machine.
Definition: Machine.cpp:365
gnash::SWF::ABC_ACTION_BITXOR
@ ABC_ACTION_BITXOR
Definition: SWF.h:1266
_
#define _(String)
Definition: log.h:44
gnash::SWF::ABC_ACTION_THROW
@ ABC_ACTION_THROW
Definition: SWF.h:354
gnash::SWF::ABC_ACTION_BKPTLINE
@ ABC_ACTION_BKPTLINE
Definition: SWF.h:1473
gnash::as_environment
Provides information about timeline context.
Definition: as_environment.h:51
gnash::as_object::instanceOf
bool instanceOf(as_object *ctor)
Check whether this object is an instance of the given constructor.
Definition: as_object.cpp:769
gnash::SWF::ABC_ACTION_LESSEQUALS
@ ABC_ACTION_LESSEQUALS
Definition: SWF.h:1295
gnash::SWF::ABC_ACTION_SETLOCAL1
@ ABC_ACTION_SETLOCAL1
Definition: SWF.h:1417
gnash::as_object::init_member
void init_member(const std::string &name, const as_value &val, int flags=DefaultFlags)
Initialize a member value by string.
Definition: as_object.cpp:669
gnash::VM
The AVM1 virtual machine.
Definition: VM.h:72
gnash::SWF::ABC_ACTION_PUSHSCOPE
@ ABC_ACTION_PUSHSCOPE
Definition: SWF.h:659
gnash::abc::Machine::initMachine
void initMachine(AbcBlock *pool_block)
Definition: Machine.cpp:3154
gnash::SWF::ABC_ACTION_IFLE
@ ABC_ACTION_IFLE
Definition: SWF.h:494
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::SWF::ABC_ACTION_NOP
@ ABC_ACTION_NOP
Do: Nothing.
Definition: SWF.h:346
ABSTRACT_TYPELATE
#define ABSTRACT_TYPELATE(st, checkval, matchval)
Definition: Machine.cpp:270
gnash::SWF::ABC_ACTION_DEBUG
@ ABC_ACTION_DEBUG
Definition: SWF.h:1461
gnash::abc::Machine::findSuper
Class * findSuper(as_value &obj, bool find_primitive)
Definition: Machine.cpp:3012
gnash::abc::MultiName
An MultiName represents a single ABC multiname.
Definition: MultiName.h:52
gnash::SWF::ABC_ACTION_ABC_TYPEOF
@ ABC_ACTION_ABC_TYPEOF
Definition: SWF.h:1164
gnash::SWF::ABC_ACTION_IFNLE
@ ABC_ACTION_IFNLE
Definition: SWF.h:418
gnash::SWF::ABC_ACTION_CONVERT_I
@ ABC_ACTION_CONVERT_I
Definition: SWF.h:1021
MultiName.h
gnash::key::g
@ g
Definition: GnashKey.h:153
ENSURE_STRING
#define ENSURE_STRING(vte)
Definition: Machine.cpp:206
gnash::SWF::ABC_ACTION_NEWFUNCTION
@ ABC_ACTION_NEWFUNCTION
Definition: SWF.h:694
gnash::SWF::ABC_ACTION_TIMESTAMP
@ ABC_ACTION_TIMESTAMP
Do: Nothing.
Definition: SWF.h:1476
gnash::SWF::ABC_ACTION_SETLOCAL0
@ ABC_ACTION_SETLOCAL0
Definition: SWF.h:1410
gnash::SWF::ABC_ACTION_IFNGT
@ ABC_ACTION_IFNGT
Definition: SWF.h:427
gnash::key::m
@ m
Definition: GnashKey.h:159
gnash::SWF::ABC_ACTION_PUSHFALSE
@ ABC_ACTION_PUSHFALSE
Definition: SWF.h:607
gnash::key::s
@ s
Definition: GnashKey.h:165
gnash::SWF::ABC_ACTION_SWAP
@ ABC_ACTION_SWAP
Definition: SWF.h:632
ENSURE_OBJECT
#define ENSURE_OBJECT(vte)
Definition: Machine.cpp:199
as_value.h
gnash::key::n
@ n
Definition: GnashKey.h:160
gnash::SWF::ABC_ACTION_CALLPROPERTY
@ ABC_ACTION_CALLPROPERTY
Definition: SWF.h:747
gnash::SWF::ABC_ACTION_GETLEX
@ ABC_ACTION_GETLEX
Definition: SWF.h:893
Global_as.h
gnash::SWF::ABC_ACTION_ESC_XELEM
@ ABC_ACTION_ESC_XELEM
Definition: SWF.h:1009
gnash::SafeStack::pop
T & pop()
Pop the top of the stack.
Definition: SafeStack.h:147
gnash::abc::Machine::pushCall
void pushCall(as_function *func, as_object *pThis, as_value &return_slot, unsigned char stack_in, short stack_out)
Definition: Machine.cpp:3084
ENSURE_NUMBER
#define ENSURE_NUMBER(vte)
Definition: Machine.cpp:175
gnash::abc::AbcBlock
The ActionScript bytecode of a single ABC tag in a SWF.
Definition: AbcBlock.h:209
gnash::SWF::ABC_ACTION_COERCE_B
@ ABC_ACTION_COERCE_B
Definition: SWF.h:1072
gnash::NSV::PROP_CONSTRUCTOR
@ PROP_CONSTRUCTOR
Definition: namedStrings.h:68
gnash::getVM
VM & getVM(const as_environment &env)
Definition: as_environment.h:222
gnash::abc::Machine::markReachableResources
void markReachableResources() const
Definition: Machine.cpp:3218
gnash::SWF::abc_action_type
abc_action_type
Definition: SWF.h:338
UNUSED
#define UNUSED(x)
Definition: utility.h:113
gnash::SWF::ABC_ACTION_PUSHNAN
@ ABC_ACTION_PUSHNAN
Definition: SWF.h:611
gnash::SWF::ABC_ACTION_GETSCOPEOBJECT
@ ABC_ACTION_GETSCOPEOBJECT
Definition: SWF.h:928
gnash::log_error
void log_error(StringType msg, Args... args)
Definition: log.h:283
gnash::SWF::ABC_ACTION_ASTYPELATE
@ ABC_ACTION_ASTYPELATE
Definition: SWF.h:1109
gnash::abc::Machine::pushGet
void pushGet(as_object *this_obj, as_value &return_slot, Property *prop)
Definition: Machine.cpp:3057
gnash::abc::Method::getMaxRegisters
std::uint32_t getMaxRegisters()
Definition: Method.h:71
gnash::SWF::ABC_ACTION_RSHIFT
@ ABC_ACTION_RSHIFT
Definition: SWF.h:1239
gnash::SWF::ABC_ACTION_MULTIPLY_I
@ ABC_ACTION_MULTIPLY_I
See: 0xA2 (ABC_ACTION_MULTIPLY), but forces type to int.
Definition: SWF.h:1374
gnash::SWF::ABC_ACTION_PUSHUINT
@ ABC_ACTION_PUSHUINT
Definition: SWF.h:647
gnash::SWF::ABC_ACTION_BITOR
@ ABC_ACTION_BITOR
Definition: SWF.h:1259
gnash::NSV::PROP_PUSH
@ PROP_PUSH
Definition: namedStrings.h:88
gnash::SWF::ABC_ACTION_GETLOCAL2
@ ABC_ACTION_GETLOCAL2
Definition: SWF.h:1398
gnash::SWF::ABC_ACTION_DECREMENT
@ ABC_ACTION_DECREMENT
Definition: SWF.h:1153
gnash::SWF::ABC_ACTION_CALLMETHOD
@ ABC_ACTION_CALLMETHOD
Definition: SWF.h:719
gnash::SWF::ABC_ACTION_PUSHSTRING
@ ABC_ACTION_PUSHSTRING
Definition: SWF.h:637
gnash::abc::Method::maxStack
std::uint32_t maxStack() const
Definition: Method.h:85
gnash::SWF::ABC_ACTION_RETURNVALUE
@ ABC_ACTION_RETURNVALUE
Definition: SWF.h:757
gnash::fn_call
Parameters/environment for builtin or user-defined functions callable from ActionScript.
Definition: fn_call.h:118
gnash::SWF::ABC_ACTION_COERCE_A
@ ABC_ACTION_COERCE_A
Definition: SWF.h:1079
gnash::callMethod
as_value callMethod(fn_call::Args &args, as_object *obj, const ObjectURI &uri)
Call a member function of this object in an AS-compatible way.
Definition: Global_as.h:219
gnash::Property::isGetterSetter
bool isGetterSetter() const
Is this a getter/setter property?
Definition: Property.h:377
gnash::StackException
Definition: SafeStack.h:29
gnash::SafeStack::size
StackSize size() const
Alias for getDownstop()
Definition: SafeStack.h:175
gnash::fn_call::Args
FunctionArgs< as_value > Args
Definition: fn_call.h:121
gnash::SWF::ABC_ACTION_MODULO
@ ABC_ACTION_MODULO
Definition: SWF.h:1225
gnash::key::a
@ a
Definition: GnashKey.h:147
gnash::abc::Machine::executeFunction
as_value executeFunction(Method *function, const fn_call &fn)
Definition: Machine.cpp:3172
gnash::SWF::ABC_ACTION_INITPROPERTY
@ ABC_ACTION_INITPROPERTY
Definition: SWF.h:952
gnash::as_value::to_number
double to_number(int version) const
Get a number representation for this value.
Definition: as_value.cpp:318
gnash::abc::Class::getPrototype
as_object * getPrototype()
Necessary for the current bogus implementation.
Definition: Class.h:256
gnash::SWF::ABC_ACTION_INCREMENT
@ ABC_ACTION_INCREMENT
Definition: SWF.h:1140
gnash::SWF::ABC_ACTION_SETLOCAL3
@ ABC_ACTION_SETLOCAL3
Definition: SWF.h:1431
gnash::invoke
DSOEXPORT as_value invoke(const as_value &method, const as_environment &env, as_object *this_ptr, fn_call::Args &args, as_object *super=nullptr, const movie_definition *callerDef=nullptr)
Call an as_value on an as_object.
Definition: Global_as.h:166
gnash::SWF::ABC_ACTION_NEXTNAME
@ ABC_ACTION_NEXTNAME
Definition: SWF.h:564
gnash::SWF::ABC_ACTION_NEWARRAY
@ ABC_ACTION_NEWARRAY
Definition: SWF.h:833
gnash::SWF::ABC_ACTION_CALLPROPLEX
@ ABC_ACTION_CALLPROPLEX
Definition: SWF.h:789
gnash::SWF::ABC_ACTION_IFGE
@ ABC_ACTION_IFGE
Definition: SWF.h:512
gnash::key::type
type
Definition: GnashKey.h:330
gnash::SWF::ABC_ACTION_IFFALSE
@ ABC_ACTION_IFFALSE
Definition: SWF.h:458
gnash::as_value::to_string
DSOTEXPORT std::string to_string(int version=7) const
Get a std::string representation for this value.
Definition: as_value.cpp:205
gnash::FunctionArgs
A class to contain transferable arguments for a fn_call.
Definition: fn_call.h:57
gnash::SWF::ABC_ACTION_POPSCOPE
@ ABC_ACTION_POPSCOPE
Definition: SWF.h:552
gnash::SWF::ABC_ACTION_GETLOCAL
@ ABC_ACTION_GETLOCAL
Definition: SWF.h:911
gnash::SWF::ABC_ACTION_CALL
@ ABC_ACTION_CALL
Definition: SWF.h:703
gnash::SWF::ABC_ACTION_NEGATE_I
@ ABC_ACTION_NEGATE_I
See: 0x90 (ABC_ACTION_NEGATE), but forces type to int, not double.
Definition: SWF.h:1365
IF_VERBOSE_ASCODING_ERRORS
#define IF_VERBOSE_ASCODING_ERRORS(x)
Definition: log.h:397
gnash::log_abc
void log_abc(StringType msg, Args... args)
Definition: log.h:337
gnash::SWF::ABC_ACTION_PUSHNULL
@ ABC_ACTION_PUSHNULL
Definition: SWF.h:577
gnash::SWF::ABC_ACTION_GREATERTHAN
@ ABC_ACTION_GREATERTHAN
Definition: SWF.h:1302
gnash::CodeStream
Definition: CodeStream.h:41
gnash::SWF::ABC_ACTION_SETSUPER
@ ABC_ACTION_SETSUPER
Definition: SWF.h:376
gnash::abc::Machine::getTarget
DisplayObject * getTarget()
The DisplayObject which initiated these actions.
gnash::constructInstance
as_object * constructInstance(as_function &ctor, const as_environment &env, fn_call::Args &args)
Definition: as_function.cpp:47
gnash::SWF::ABC_ACTION_STRICTEQUALS
@ ABC_ACTION_STRICTEQUALS
Definition: SWF.h:1281
gnash::SWF::ABC_ACTION_MULTIPLY
@ ABC_ACTION_MULTIPLY
Definition: SWF.h:1211
gnash::Property
An abstract property.
Definition: Property.h:277
gnash::abc::Machine::setTarget
void setTarget(DisplayObject *target)
gnash::SWF::ABC_ACTION_COERCE_O
@ ABC_ACTION_COERCE_O
Definition: SWF.h:1119
gnash::CodeStream::read_S24
std::int32_t read_S24()
Read a signed 24 bit interger.
Definition: CodeStream.cpp:82
gnash::SWF::ABC_ACTION_POP
@ ABC_ACTION_POP
Definition: SWF.h:617
gnash::abc::Machine::immediateProcedure
void immediateProcedure(const as_function *to_call, as_object *pthis, unsigned char stack_in, short stack_out)
Definition: Machine.h:237
gnash::as_object::get_member
virtual bool get_member(const ObjectURI &uri, as_value *val)
Get a property by name if it exists.
Definition: as_object.cpp:378
gnash::SWF::ABC_ACTION_PUSHNAMESPACE
@ ABC_ACTION_PUSHNAMESPACE
Definition: SWF.h:664
gnash::CodeStream::read_V32
std::uint32_t read_V32()
Read a variable length encoded 32 bit unsigned integer.
Definition: CodeStream.cpp:27
gnash::Property::getValue
DSOTEXPORT as_value getValue(const as_object &this_ptr) const
Get value of this property.
Definition: Property.cpp:98
gnash::SWF::ABC_ACTION_GETSLOT
@ ABC_ACTION_GETSLOT
Definition: SWF.h:971
gnash::abc::Machine
The virtual machine for executing ABC (ActionScript Bytecode).
Definition: Machine.h:74
gnash::SWF::ABC_ACTION_CONVERT_D
@ ABC_ACTION_CONVERT_D
Definition: SWF.h:1033
gnash::subtract
void subtract(as_value &op1, const as_value &op2, const VM &vm)
Carry out ActionSubtract.
Definition: VM.cpp:392
gnash::fn_call::nargs
Args::size_type nargs
Number of arguments to this ActionScript function call.
Definition: fn_call.h:178
gnash::abc::Class
A class to represent AS3 Classes.
Definition: Class.h:76
gnash::abc::AbcBlock::scripts
const std::vector< abc::Class * > & scripts() const
Scripts can contain several classes.
Definition: AbcBlock.h:271
gnash::SWF::ABC_ACTION_IFGT
@ ABC_ACTION_IFGT
Definition: SWF.h:503
gnash::as_value::to_object
as_object * to_object(VM &vm) const
Return value as an object, converting primitive values as needed.
Definition: as_value.cpp:453
Machine.h
gnash::abc::Machine::execute
void execute()
Definition: Machine.cpp:381
gnash::SWF::ABC_ACTION_IFTRUE
@ ABC_ACTION_IFTRUE
Definition: SWF.h:450
gnash::SWF::ABC_ACTION_ESC_XATTR
@ ABC_ACTION_ESC_XATTR
Definition: SWF.h:1015
gnash::SWF::ABC_ACTION_SETGLOBALSLOT
@ ABC_ACTION_SETGLOBALSLOT
Definition: SWF.h:997
gnash::SWF::ABC_ACTION_PUSHUNDEFINED
@ ABC_ACTION_PUSHUNDEFINED
n – an Undefined object.
Definition: SWF.h:580
gnash::SWF::ABC_ACTION_ADD
@ ABC_ACTION_ADD
Definition: SWF.h:1197
gnash::abc::abc_function::needsActivation
bool needsActivation() const
Definition: abc_function.h:56
gnash::as_value
ActionScript value type.
Definition: as_value.h:95
gnash::SWF::ABC_ACTION_IFNGE
@ ABC_ACTION_IFNGE
Definition: SWF.h:436
gnash::CodeStream::read_u8
std::uint8_t read_u8()
Read an unsigned 8-bit character.
Definition: CodeStream.cpp:107
gnash::SWF::ABC_ACTION_GETGLOBALSCOPE
@ ABC_ACTION_GETGLOBALSCOPE
Definition: SWF.h:923
gnash::Global_as::createArray
as_object * createArray()
Construct an Array.
Definition: Global_as.cpp:207
gnash::SWF::ABC_ACTION_DXNSLATE
@ ABC_ACTION_DXNSLATE
Definition: SWF.h:388
VM.h
gnash::SWF::ABC_ACTION_CHECKFILTER
@ ABC_ACTION_CHECKFILTER
Definition: SWF.h:1053
gnash::as_object::findProperty
Property * findProperty(const ObjectURI &uri, as_object **owner=nullptr)
Find a property, scanning the inheritance chain.
Definition: as_object.cpp:477
gnash::SWF::ABC_ACTION_LABEL
@ ABC_ACTION_LABEL
Do: Unknown purpose, Tamarin does nothing.
Definition: SWF.h:397
gnash::SWF::ABC_ACTION_LOOKUPSWITCH
@ ABC_ACTION_LOOKUPSWITCH
Definition: SWF.h:540
gnash::SWF::ABC_ACTION_END
@ ABC_ACTION_END
AS3 Actions go below here.
Definition: SWF.h:340
gnash::SWF::ABC_ACTION_BITAND
@ ABC_ACTION_BITAND
Definition: SWF.h:1252
gnash::CodeStream::seekTo
void seekTo(unsigned int set)
Set the current position to an absolute value (relative to the start)
Definition: CodeStream.cpp:75
gnash::fn_call::arg
const Args::value_type & arg(unsigned int n) const
Access a particular argument.
Definition: fn_call.h:194
gnash::as_function::isBuiltin
virtual bool isBuiltin()
Return true if this is a built-in class.
Definition: as_function.h:107
gnash::string_table::find
key find(const std::string &to_find, bool insert_unfound=true)
Find a key for a string.
Definition: string_table.cpp:40
gnash::SWF::ABC_ACTION_ISTYPELATE
@ ABC_ACTION_ISTYPELATE
Definition: SWF.h:1330
gnash::SWF::ABC_ACTION_CALLSTATIC
@ ABC_ACTION_CALLSTATIC
Definition: SWF.h:727
gnash::log_aserror
void log_aserror(StringType msg, Args... args)
Definition: log.h:331
gnash::SWF::ABC_ACTION_PUSHSHORT
@ ABC_ACTION_PUSHSHORT
Definition: SWF.h:599
gnash::abc::Class::getBinding
Property * getBinding(string_table::key name)
Definition: Class.h:228
log.h
gnash::SWF::ABC_ACTION_BITNOT
@ ABC_ACTION_BITNOT
Definition: SWF.h:1176
gnash::abc::Machine::init
void init()
Initialize the AS resources.
Definition: Machine.cpp:351
IF_VERBOSE_ACTION
#define IF_VERBOSE_ACTION(x)
Definition: log.h:384
gnash::SWF::ABC_ACTION_BKPT
@ ABC_ACTION_BKPT
Do: Enter the debugger if one has been invoked.
Definition: SWF.h:343
gnash::SWF::ABC_ACTION_DUP
@ ABC_ACTION_DUP
Definition: SWF.h:624
ClassHierarchy.h
gnash::SWF::ABC_ACTION_DECREMENT_I
@ ABC_ACTION_DECREMENT_I
See: 0x93 (ABC_ACTION_DECREMENT), but forces types to int, not double.
Definition: SWF.h:1356
fn_call.h
gnash::SWF::ABC_ACTION_INCLOCAL_I
@ ABC_ACTION_INCLOCAL_I
See: 0x92 (ABC_ACTION_INCLOCAL), but forces types to int, not double.
Definition: SWF.h:1359
gnash::as_object::delProperty
DSOTEXPORT std::pair< bool, bool > delProperty(const ObjectURI &uri)
Delete a property of this object, unless protected from deletion.
Definition: as_object.cpp:313
gnash::as_object::get_prototype
as_object * get_prototype() const
Return this object's proto member.
Definition: as_object.cpp:932
gnash::SWF::ABC_ACTION_SETLOCAL
@ ABC_ACTION_SETLOCAL
Definition: SWF.h:919
gnash::abc::Method::scopeDepth
std::uint32_t scopeDepth() const
Definition: Method.h:101
gnash::SWF::ABC_ACTION_INCLOCAL
@ ABC_ACTION_INCLOCAL
Definition: SWF.h:1145
gnash::abc::abstractEquality
bool abstractEquality(const as_value &a, const as_value &b, bool strictness_on)
Definition: Machine.cpp:255
gnash::abc::MultiName::KIND_MultinameL
@ KIND_MultinameL
Definition: MultiName.h:65
gnash::SWF::ABC_ACTION_DEBUGFILE
@ ABC_ACTION_DEBUGFILE
Definition: SWF.h:1469
gnash::key::f
@ f
Definition: GnashKey.h:152
gnash::abc::abc_function
ABC-defined Function.
Definition: abc_function.h:41
gnash::abc::AbcBlock::locateClass
abc::Class * locateClass(MultiName &m)
Definition: AbcBlock.cpp:437
SWF.h
namedStrings.h
gnash::Global_as
The Global object ultimately contains all objects in an ActionScript run.
Definition: Global_as.h:50
AbcBlock.h
gnash::SWF::ABC_ACTION_LESSTHAN
@ ABC_ACTION_LESSTHAN
Definition: SWF.h:1288
test.uri
uri
Definition: test.py:12
gnash::SafeStack::top
const T & top(StackSize i) const
From the top of the stack, get the i'th value down.
Definition: SafeStack.h:54
gnash::SWF::ABC_ACTION_DELETEPROPERTY
@ ABC_ACTION_DELETEPROPERTY
Definition: SWF.h:962
gnash::key::c
@ c
Definition: GnashKey.h:149
gnash::SWF::ABC_ACTION_CALLSUPERVOID
@ ABC_ACTION_CALLSUPERVOID
Definition: SWF.h:797
gnash::SWF::ABC_ACTION_COERCE_D
@ ABC_ACTION_COERCE_D
Definition: SWF.h:1089
gnash::getStringTable
string_table & getStringTable(const as_environment &env)
Definition: as_environment.cpp:639
gnash::SWF::ABC_ACTION_NEXTVALUE
@ ABC_ACTION_NEXTVALUE
Definition: SWF.h:589
gnash::SWF::ABC_ACTION_DEBUGLINE
@ ABC_ACTION_DEBUGLINE
Definition: SWF.h:1465
gnash::SWF::ABC_ACTION_GETDESCENDANTS
@ ABC_ACTION_GETDESCENDANTS
Definition: SWF.h:857
gnash::SWF::ABC_ACTION_FINDPROPERTY
@ ABC_ACTION_FINDPROPERTY
Definition: SWF.h:882
gnash::SWF::ABC_ACTION_NEWCATCH
@ ABC_ACTION_NEWCATCH
Definition: SWF.h:863
gnash::SWF::ABC_ACTION_RETURNVOID
@ ABC_ACTION_RETURNVOID
Do: Return an Undefined object up the callstack.
Definition: SWF.h:750
gnash::SWF::ABC_ACTION_COERCE
@ ABC_ACTION_COERCE
Definition: SWF.h:1068
gnash::SWF::ABC_ACTION_ADD_I
@ ABC_ACTION_ADD_I
See: 0xA0 (ABC_ACTION_ADD), but forces type to int.
Definition: SWF.h:1368
gnash::abc::Machine::Machine
Machine(VM &vm)
Create an AS3 interpreter.
Definition: Machine.cpp:327
gnash::SWF::ABC_ACTION_PUSHWITH
@ ABC_ACTION_PUSHWITH
Definition: SWF.h:548
gnash::abc::Machine::pushSet
void pushSet(as_object *this_obj, as_value &value, Property *prop)
Definition: Machine.cpp:3070
JUMPIF
#define JUMPIF(jtruth)
Definition: Machine.cpp:292
gnash::SWF::ABC_ACTION_SETPROPERTY
@ ABC_ACTION_SETPROPERTY
Definition: SWF.h:905
gnash::SWF::ABC_ACTION_CONVERT_U
@ ABC_ACTION_CONVERT_U
Definition: SWF.h:1027
gnash::SWF::ABC_ACTION_ASTYPE
@ ABC_ACTION_ASTYPE
Definition: SWF.h:1102
gnash::DisplayObject
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:169
abc_function.h
gnash::SWF::ABC_ACTION_CONSTRUCT
@ ABC_ACTION_CONSTRUCT
Definition: SWF.h:711
gnash::SWF::ABC_ACTION_CONVERT_B
@ ABC_ACTION_CONVERT_B
Definition: SWF.h:1039
source
@ source
Definition: klash_part.cpp:329
gnash::string_table::key
std::size_t key
Definition: string_table.h:83
gnash::SWF::ABC_ACTION_GREATEREQUALS
@ ABC_ACTION_GREATEREQUALS
Definition: SWF.h:1309
gnash::SWF::ABC_ACTION_INCREMENT_I
@ ABC_ACTION_INCREMENT_I
See: 0x91 (ABC_ACTION_INCREMENT), but forces types to int, not double.
Definition: SWF.h:1353
gnash::abc::Method::maxScope
std::uint32_t maxScope() const
Definition: Method.h:93
gnash::SWF::ABC_ACTION_KILL
@ ABC_ACTION_KILL
Definition: SWF.h:394
gnash::newLessThan
as_value newLessThan(const as_value &op1, const as_value &op2, const VM &vm)
Carry out ActionSubtract.
Definition: VM.cpp:400
gnash::SWF::ABC_ACTION_CONVERT_S
@ ABC_ACTION_CONVERT_S
Definition: SWF.h:1003
gnash::SWF::ABC_ACTION_GETGLOBALSLOT
@ ABC_ACTION_GETGLOBALSLOT
Definition: SWF.h:988
gnash::CodeStream::skip_V32
void skip_V32()
Definition: CodeStream.cpp:117
gnash::abc::Machine::instantiateClass
void instantiateClass(std::string className, as_object *global)
Definition: Machine.cpp:3224
gnash::ClassHierarchy
Register all of the ActionScript classes, with their dependencies.
Definition: ClassHierarchy.h:41
gnash::as_value::set_null
void set_null()
Set this value to the NULL value.
Definition: as_value.cpp:526
gnash::SWF::ABC_ACTION_GETLOCAL3
@ ABC_ACTION_GETLOCAL3
Definition: SWF.h:1403
gnash::fn_call::this_ptr
as_object * this_ptr
Definition: fn_call.h:170
gnash::key::o
@ o
Definition: GnashKey.h:161
ABSTRACT_COMPARE
#define ABSTRACT_COMPARE(store, rv1, rv2, truth_of_undefined)
Definition: Machine.cpp:225
gnash::SWF::ABC_ACTION_PUSHINT
@ ABC_ACTION_PUSHINT
Definition: SWF.h:642
gnash::SWF::ABC_ACTION_SETSLOT
@ ABC_ACTION_SETSLOT
Definition: SWF.h:980
gnash::log_unimpl
void log_unimpl(StringType msg, Args... args)
Definition: log.h:289
gnash::CodeStream::read_s8
int8_t read_s8()
Read a signed 8-bit character.
Definition: CodeStream.cpp:98
gnash::SWF::ABC_ACTION_GETSUPER
@ ABC_ACTION_GETSUPER
Definition: SWF.h:365
gnash::SWF::ABC_ACTION_CONSTRUCTPROP
@ ABC_ACTION_CONSTRUCTPROP
Definition: SWF.h:775
gnash::as_value::is_object
bool is_object() const
Return true if this value is an object.
Definition: as_value.h:219
gnash::ObjectURI
A URI for describing as_objects.
Definition: ObjectURI.h:45
gnash::SafeStack::grow
void grow(StackSize i)
Definition: SafeStack.h:155
SafeStack.h
gnash::SWF::ABC_ACTION_INSTANCEOF
@ ABC_ACTION_INSTANCEOF
Definition: SWF.h:1316
gnash::SWF::ABC_ACTION_DECLOCAL
@ ABC_ACTION_DECLOCAL
Definition: SWF.h:1158
gnash::key::b
@ b
Definition: GnashKey.h:148
test.v
v
Definition: test.py:11
gnash::abc::Method::getBody
CodeStream * getBody()
Definition: Method.h:136
gnash::abc::MultiName::getNamespace
Namespace * getNamespace() const
Definition: MultiName.h:96
gnash::key::e
@ e
Definition: GnashKey.h:151
gnash::SWF::ABC_ACTION_SETLOCAL2
@ ABC_ACTION_SETLOCAL2
Definition: SWF.h:1424
gnash::SWF::ABC_ACTION_GETLOCAL0
@ ABC_ACTION_GETLOCAL0
Definition: SWF.h:1388
gnash::abc::Method::getPrototype
abc_function * getPrototype()
Definition: Method.h:105
gnash::SWF::ABC_ACTION_DXNS
@ ABC_ACTION_DXNS
Definition: SWF.h:381
gnash::SWF::ABC_ACTION_COERCE_U
@ ABC_ACTION_COERCE_U
Definition: SWF.h:1113
gnash::SWF::ABC_ACTION_HASNEXT
@ ABC_ACTION_HASNEXT
Definition: SWF.h:573
gnash::abc::MultiName::getGlobalName
string_table::key getGlobalName() const
Definition: MultiName.h:101
gnash::Property::setValue
bool setValue(as_object &this_ptr, const as_value &value) const
Set value of this property.
Definition: Property.cpp:133
gnash::SWF::ABC_ACTION_GETLOCAL1
@ ABC_ACTION_GETLOCAL1
Definition: SWF.h:1393
gnash::SWF::ABC_ACTION_PUSHTRUE
@ ABC_ACTION_PUSHTRUE
Definition: SWF.h:603
gnash::as_function
ActionScript Function, either builtin or SWF-defined.
Definition: as_function.h:63
gnash::GcResource::setReachable
void setReachable() const
Mark this resource as being reachable.
Definition: GC.h:92
gnash::SWF::ABC_ACTION_SUBTRACT_I
@ ABC_ACTION_SUBTRACT_I
See: 0xA1 (ABC_ACTION_SUBTRACT), but forces type to int.
Definition: SWF.h:1371
gnash::newAdd
void newAdd(as_value &op1, const as_value &op2, const VM &vm)
Carry out ActionNewAdd.
Definition: VM.cpp:356
gnash::SWF::ABC_ACTION_EQUALS
@ ABC_ACTION_EQUALS
Definition: SWF.h:1273