Go to the documentation of this file.
19 #ifndef GNASH_ASHANDLERS_H
20 #define GNASH_ASHANDLERS_H
51 typedef void (*ActionCallback)(
ActionExec& thread);
68 ActionCallback _callback;
83 size_t size()
const {
return _handlers.size(); }
102 typedef std::vector<ActionHandler> container_type;
104 container_type _handlers;
static const SWFHandlers & instance()
Return the singleton instance of SWFHandlers class.
Definition: ASHandlers.cpp:421
bool isLevelTarget(int version, const std::string &name, unsigned int &levelno)
Return true if the given string can be interpreted as a _level name.
Definition: movie_root.cpp:2387
VGPath path
Definition: testr_gtk.cpp:84
void setConstantPool(const ConstantPool *pool)
Definition: VM.h:247
void setNaN(as_value &v)
Set a value to NaN.
Definition: as_value.h:524
@ ACTION_DEFINEFUNCTION
Definition: SWF.h:330
@ ACTION_INT
Definition: SWF.h:151
@ ACTION_SETMEMBER
Definition: SWF.h:262
const ConstantPool * getConstantPool() const
Definition: VM.h:249
double toNumber(const as_value &v, const VM &vm)
Convert an as_value to a double.
Definition: VM.cpp:451
@ ACTION_GOTOLABEL
Definition: SWF.h:137
@ ACTION_STRINGLENGTH
Definition: SWF.h:148
@ ACTION_CALLMETHOD
Definition: SWF.h:270
@ ACTION_STRINGCONCAT
Definition: SWF.h:155
std::string name
Definition: LocalConnection_as.cpp:149
bool isNaN(const T &num)
Definition: GnashNumeric.h:62
bool toBool(const as_value &v, const VM &vm)
Convert an as_value to boolean type.
Definition: VM.cpp:445
A singleton containing the supported SWF Action handlers.
Definition: ASHandlers.h:74
std::int32_t toInt(const as_value &v, const VM &vm)
AS2-compatible conversion to 32bit integer.
Definition: VM.cpp:463
void log_swferror(StringType msg, Args... args)
Definition: log.h:325
@ d
Definition: GnashKey.h:150
static const int upperAccessibleBound
Definition: DisplayObject.h:200
@ ACTION_DECREMENT
Definition: SWF.h:264
@ ACTION_VAR
Definition: SWF.h:231
@ ACTION_NEWEQUALS
ECMA-262 "Abstract Equality Comparison".
Definition: SWF.h:256
@ ACTION_SETVARIABLE
Definition: SWF.h:153
@ ACTION_CALLFRAME
Definition: SWF.h:210
EncodingGuess guessEncoding(const std::string &str, int &length, std::vector< int > &offsets)
Common code for guessing at the encoding of random text, between.
Definition: utf8.cpp:281
PlayState
Definition: MovieClip.h:98
as_value getOwnProperty(as_object &o, const ObjectURI &uri)
Get an own member of an object.
Definition: as_object.h:777
as_object * toObject(const as_value &v, VM &vm)
Convert an as_value to an object.
Definition: VM.cpp:457
void log_action(StringType msg, Args... args)
Definition: log.h:307
@ ACTION_INITARRAY
Definition: SWF.h:232
@ ACTION_DELETE
Definition: SWF.h:214
static const int staticDepthOffset
Definition: DisplayObject.h:205
Definition: GnashException.h:182
@ ACTION_WAITFORFRAMEEXPRESSION
Definition: SWF.h:205
@ CLASS_OBJECT
Definition: namedStrings.h:233
@ ACTION_PLAY
Definition: SWF.h:129
void log_debug(StringType msg, Args... args)
Definition: log.h:301
@ ACTION_NEWLESSTHAN
Definition: SWF.h:251
std::int32_t y
Definition: BitmapData_as.cpp:435
@ ACTION_STOPSOUNDS
Definition: SWF.h:132
@ i
Definition: GnashKey.h:155
@ ACTION_PREVFRAME
Definition: SWF.h:128
#define LOG_ONCE(x)
Definition: log.h:49
@ ACTION_SETPROPERTY
Definition: SWF.h:157
@ ACTION_STOPDRAGMOVIE
Definition: SWF.h:162
std::string encodeUnicodeCharacter(std::uint32_t ucs_character)
Encodes the given wide character into a canonical string, theoretically up to 6 chars in length.
Definition: utf8.cpp:165
size_t size() const
Definition: ASHandlers.h:83
std::int32_t pixelsToTwips(double a)
Definition: GnashNumeric.h:144
@ CLASS_FUNCTION
Definition: namedStrings.h:216
#define _(String)
Definition: log.h:44
@ ACTION_MBLENGTH
Definition: SWF.h:197
@ ACTION_DUPLICATECLIP
Definition: SWF.h:158
std::uint32_t decodeNextUnicodeCharacter(std::string::const_iterator &it, const std::string::const_iterator &e)
Return the next Unicode character in the UTF-8 encoded string.
Definition: utf8.cpp:93
ActionType
SWF action ids. Symbolic names copied from Ming.
Definition: SWF.h:125
@ ACTION_STRICTMODE
Definition: SWF.h:204
bool parsePath(const std::string &var_path_in, std::string &path, std::string &var)
Definition: as_environment.cpp:397
@ ACTION_TARGETPATH
Definition: SWF.h:248
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
@ ACTION_SUBTRACT
Definition: SWF.h:139
@ ACTION_NEW
Definition: SWF.h:230
const as_environment & _env
Definition: Array_as.cpp:682
@ dontEnum
Protect from enumeration.
Definition: PropFlags.h:36
@ m
Definition: GnashKey.h:159
@ s
Definition: GnashKey.h:165
@ ARG_STR
Definition: ASHandlers.h:37
@ ACTION_GOTOEXPRESSION
aka GOTOFRAME2
Definition: SWF.h:213
@ PLAYSTATE_STOP
Definition: MovieClip.h:100
@ n
Definition: GnashKey.h:160
@ ARG_PUSH_DATA
Definition: ASHandlers.h:43
@ start
Definition: klash_part.cpp:330
@ ACTION_TRY
Definition: SWF.h:328
Executor of an action_buffer.
Definition: ActionExec.h:119
#define __FUNCTION__
Definition: log.h:437
Global_as & getGlobal(const as_environment &env)
Definition: as_environment.cpp:651
@ ACTION_SWAP
Definition: SWF.h:260
@ PROP_CONSTRUCTOR
Definition: namedStrings.h:68
VM & getVM(const as_environment &env)
Definition: as_environment.h:222
@ ACTION_END
Definition: SWF.h:126
@ ACTION_BRANCHALWAYS
Definition: SWF.h:207
@ ACTION_DELETE2
Definition: SWF.h:215
void log_error(StringType msg, Args... args)
Definition: log.h:283
as_value getMember(as_object &o, const ObjectURI &uri)
Get a member of an object using AS lookup rules.
Definition: as_object.h:756
@ ACTION_SETTARGET
Definition: SWF.h:136
void log_trace(StringType msg, Args... args)
Definition: log.h:295
const ActionHandler & operator[](ActionType x) const
Definition: ASHandlers.h:89
boost::mt11213b RNG
Definition: VM.h:152
as_object * createObject(const Global_as &gl)
Definition: Global_as.cpp:303
@ k
Definition: GnashKey.h:157
@ ACTION_FSCOMMAND2
SWF7.
Definition: SWF.h:195
@ ACTION_MODULO
Definition: SWF.h:219
#define IF_VERBOSE_MALFORMED_SWF(x)
Definition: log.h:404
@ ACTION_STRINGEQ
Definition: SWF.h:147
void setIndexedProperty(size_t index, DisplayObject &o, const as_value &val)
Set a property by its numeric index.
Definition: DisplayObject.cpp:853
@ ACTION_WITH
Definition: SWF.h:329
static const int DefaultFlags
The most common flags for built-in properties.
Definition: as_object.h:192
@ ACTION_SETTARGETEXPRESSION
Definition: SWF.h:154
@ ACTION_LOGICALNOT
Definition: SWF.h:146
@ ACTION_MULTIPLY
Definition: SWF.h:140
void getIndexedProperty(size_t index, DisplayObject &o, as_value &val)
Get a property by its numeric index.
Definition: DisplayObject.cpp:870
@ ACTION_SHIFTRIGHT2
Definition: SWF.h:299
@ ACTION_POP
Definition: SWF.h:150
@ ACTION_STRICTEQ
Definition: SWF.h:300
@ ACTION_GETPROPERTY
Definition: SWF.h:156
void execute(ActionExec &thread) const
Execute the action.
Definition: ASHandlers.cpp:236
@ PROP_uuCONSTRUCTORuu
Definition: namedStrings.h:117
@ ACTION_STRINGGREATER
Definition: SWF.h:310
FunctionArgs< as_value > Args
Definition: fn_call.h:121
EncodingGuess
Definition: utf8.h:157
@ ARG_U16
Definition: ASHandlers.h:41
@ ACTION_BITWISEOR
Definition: SWF.h:295
@ ACTION_INCREMENT
Definition: SWF.h:263
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
@ ACTION_ORD
Definition: SWF.h:198
as_function * to_function() const
Return the value as a function only if it is a function.
Definition: as_value.cpp:499
@ ARG_S16
Definition: ASHandlers.h:42
type
Definition: GnashKey.h:330
@ ACTION_CHR
Definition: SWF.h:199
#define IF_VERBOSE_ASCODING_ERRORS(x)
Definition: log.h:397
code
Definition: GnashKey.h:44
@ ACTION_CASTOP
Definition: SWF.h:173
ActionHandler()
Definition: ASHandlers.cpp:218
@ length
Definition: klash_part.cpp:329
@ ACTION_GREATER
Definition: SWF.h:305
as_object * constructInstance(as_function &ctor, const as_environment &env, fn_call::Args &args)
Definition: as_function.cpp:47
void setRegister(size_t index, const as_value &val)
Set value of a register (local or global).
Definition: VM.cpp:206
ArgumentType getArgFormat() const
Definition: ASHandlers.h:63
const as_value * getRegister(size_t index)
Get value of a register (local or global).
Definition: VM.cpp:191
@ ARG_DECL_DICT
Definition: ASHandlers.h:44
@ ACTION_NEWMETHOD
Definition: SWF.h:279
@ ACTION_ADD
Definition: SWF.h:138
std::vector< const char * > ConstantPool
An indexed list of strings (must match the definition in action_buffer.h)
Definition: ConstantPool.h:27
@ ACTION_LESSTHAN
Definition: SWF.h:143
@ ACTION_GETURL
Definition: SWF.h:134
@ p
Definition: GnashKey.h:162
@ ARG_U8
Definition: ASHandlers.h:40
@ ACTION_CALLFUNCTION
Definition: SWF.h:217
void subtract(as_value &op1, const as_value &op2, const VM &vm)
Carry out ActionSubtract.
Definition: VM.cpp:392
@ ACTION_ENUM2
Definition: SWF.h:293
@ ACTION_CONSTANTPOOL
Definition: SWF.h:326
@ ACTION_ENUMERATE
Definition: SWF.h:249
@ ACTION_IMPLEMENTSOP
Definition: SWF.h:182
bool atActionTag(SWF::ActionType t)
Definition: ActionExec.h:226
@ ACTION_DEFINEFUNCTION2
Definition: SWF.h:327
@ ACTION_GETURL2
Definition: SWF.h:208
@ ACTION_NEXTFRAME
Definition: SWF.h:127
@ ACTION_RANDOM
Definition: SWF.h:196
@ ACTION_NEWADD
Definition: SWF.h:250
@ ACTION_PUSHDATA
Definition: SWF.h:206
@ METHOD_NONE
Definition: MovieClip.h:420
@ ACTION_TYPEOF
Definition: SWF.h:244
void skipRemainingBuffer()
Definition: ActionExec.h:230
as_value & convertToNumber(as_value &v, const VM &vm)
Force type to number.
Definition: VM.cpp:485
#define __PRETTY_FUNCTION__
Definition: log.h:444
ActionType lastType() const
Definition: ASHandlers.h:85
VariablesMethod
The various methods for sending data in requests.
Definition: MovieClip.h:419
@ ACTION_LOGICALAND
Definition: SWF.h:144
RNG & randomNumberGenerator()
Definition: VM.cpp:80
@ ACTION_WAITFORFRAME
Definition: SWF.h:135
@ ACTION_SUBSTRING
Definition: SWF.h:149
void log_aserror(StringType msg, Args... args)
Definition: log.h:331
@ QUALITY_HIGH
Definition: GnashEnums.h:38
movie_root & getRoot(const as_environment &env)
Definition: as_environment.cpp:645
#define IF_VERBOSE_ACTION(x)
Definition: log.h:384
@ ACTION_SETREGISTER
Definition: SWF.h:331
static const int lowerAccessibleBound
See also http://www.kirupa.com/developer/actionscript/depths2.htm.
Definition: DisplayObject.h:195
@ PLAYSTATE_PLAY
Definition: MovieClip.h:99
@ ACTION_EQUAL
Definition: SWF.h:142
@ ACTION_STRINGCOMPARE
Definition: SWF.h:163
ArgumentType
Definition: ASHandlers.h:35
@ onlySWF6Up
Only visible by VM initialized for version 6 or higher.
Definition: PropFlags.h:45
@ ACTION_BITWISEAND
Definition: SWF.h:294
@ ACTION_GETMEMBER
Definition: SWF.h:261
as_value & convertToString(as_value &v, const VM &vm)
Force type to string.
Definition: VM.cpp:493
std::string url
Definition: gnash.cpp:59
@ ACTION_TOGGLEQUALITY
Definition: SWF.h:131
@ ACTION_BRANCHIFTRUE
Definition: SWF.h:209
@ ACTION_MBCHR
Definition: SWF.h:203
@ ACTION_SHIFTLEFT
Definition: SWF.h:297
as_object * getObject(const DisplayObject *d)
Return the as_object associated with a DisplayObject if it exists.
Definition: DisplayObject.h:1160
@ f
Definition: GnashKey.h:152
std::string encodeCanonicalString(const std::wstring &wstr, int version)
Converts a std::wstring into canonical std::string.
Definition: utf8.cpp:67
DisplayObject * findTarget(const as_environment &env, const std::string &path)
Find the DisplayObject referenced by the given path.
Definition: as_environment.cpp:632
@ ARG_NONE
Definition: ASHandlers.h:36
int getSWFVersion(const as_environment &env)
Definition: as_environment.cpp:657
@ ACTION_DIVIDE
Definition: SWF.h:141
uri
Definition: test.py:12
@ ACTION_VAREQUALS
Definition: SWF.h:216
@ c
Definition: GnashKey.h:149
@ ARG_FUNCTION2
Definition: ASHandlers.h:45
string_table & getStringTable(const as_environment &env)
Definition: as_environment.cpp:639
@ QUALITY_LOW
Definition: GnashEnums.h:36
void stop_drag()
Definition: movie_root.h:307
std::wstring decodeCanonicalString(const std::string &str, int version)
Converts a std::string with multibyte characters into a std::wstring.
Definition: utf8.cpp:39
@ ACTION_TRACE
Definition: SWF.h:160
@ ENCGUESS_OTHER
Definition: utf8.h:160
@ ACTION_EXTENDS
Definition: SWF.h:325
@ ACTION_INSTANCEOF
Definition: SWF.h:289
@ PROP_uuPROTOuu
Definition: namedStrings.h:118
ObjectURI getURI(const VM &vm, const std::string &str, bool lowerCaseHint=false)
Definition: VM.h:290
ActionType getType() const
Definition: ASHandlers.h:62
@ ACTION_STARTDRAGMOVIE
Definition: SWF.h:161
bool hasOwnProperty(as_object &o, const ObjectURI &uri)
Return true if this object has the named property.
Definition: as_object.h:854
@ ACTION_THROW
Definition: SWF.h:164
@ ACTION_TONUMBER
Definition: SWF.h:257
@ ACTION_SHIFTRIGHT
Definition: SWF.h:298
@ ACTION_GETVARIABLE
Definition: SWF.h:152
@ METHOD_GET
Definition: MovieClip.h:421
void declareLocal(CallFrame &c, const ObjectURI &name)
Declare a local variable in this CallFrame.
Definition: CallStack.cpp:71
@ ACTION_LOGICALOR
Definition: SWF.h:145
@ ARG_HEX
Definition: ASHandlers.h:39
@ ACTION_INITOBJECT
Definition: SWF.h:243
@ ACTION_TOSTRING
Definition: SWF.h:258
as_value newLessThan(const as_value &op1, const as_value &op2, const VM &vm)
Carry out ActionSubtract.
Definition: VM.cpp:400
@ ACTION_MBORD
Definition: SWF.h:202
@ SWF
Definition: GnashKey.h:331
void log_unimpl(StringType msg, Args... args)
Definition: log.h:289
@ ACTION_RETURN
Definition: SWF.h:218
void execute(ActionType type, ActionExec &thread) const
Execute the action identified by 'type' action type.
Definition: ASHandlers.cpp:428
@ PROP_PROTOTYPE
Definition: namedStrings.h:87
@ u
Definition: GnashKey.h:167
@ ACTION_STOP
Definition: SWF.h:130
std::int32_t x
Definition: BitmapData_as.cpp:434
@ ACTION_GETTIMER
Definition: SWF.h:200
@ e
Definition: GnashKey.h:151
bool equals(const as_value &a, const as_value &b, const VM &vm)
Check if two values are equal.
Definition: VM.cpp:439
@ ACTION_REMOVECLIP
Definition: SWF.h:159
std::string getURLEncodedVars(as_object &o)
Get url-encoded variables.
Definition: as_object.cpp:946
as_value & convertToPrimitive(as_value &v, const VM &vm)
Convert to the appropriate primitive type.
Definition: VM.cpp:508
Definition: ASHandlers.h:50
@ ACTION_GOTOFRAME
Definition: SWF.h:133
@ ACTION_BITWISEXOR
Definition: SWF.h:296
void newAdd(as_value &op1, const as_value &op2, const VM &vm)
Carry out ActionNewAdd.
Definition: VM.cpp:356
@ ACTION_MBSUBSTRING
Definition: SWF.h:201
@ ACTION_DUP
Definition: SWF.h:259