Opcodes

From Gnash Project Wiki

Jump to: navigation, search

All of these opcodes are unimplemented in Gnash, and are used by our initial test case:

(from http://sephiroth.it/reference.php)

Contents

Unimplemented

0x2C Implements

Keyword; specifies that a class must define all the methods declared in the interface (or interfaces) being implemented. For more information, see "Interfaces as data types" in Using ActionScript in Flash.

See also: http://sswf.sourceforge.net/SWFalexref.html#action_implements

Implemented

0x2A Throw

Statement; generates, or throws, an error that can be handled, or caught, by a catch{} code block. If an exception is not caught by a catch block, the string representation of the thrown value is sent to the Output panel. Typically, you throw instances of the Error class or its subclasses (see the Example section).

See also: http://sswf.sourceforge.net/SWFalexref.html#action_throw

0x31 md length - PARTIALLY_IMPLEMENTED (Needs automated testcase)

Pops one multi-byte string, push its length in actual character on the stack.

Done. -- Chad 20 Aug 2007

0x35 md substring - PARTIALLY_IMPLEMENTED (Needs automated testcase)

Pops a multi-byte string, get i1 characters from the position i2 (1 based) and push the result back on the stack. Deprecated.

Done. -- Chad 20 Aug 2007

0x37 md chr - PARTIALLY_IMPLEMENTED (Needs automated testcase)

Pops one integer, use it as a multi-byte string character and push the newly created string on the stack.

Done. -- Chad 20 Aug 2007

0x43 declare_obj

Pops an object, if it is a valid sprite, push its path on the stack. A sprite path can be used by different other actions such as the Goto Expression. Pops the number of members in the object. Pop one value and one name per member and set the corresponding member in the object. The resulting object is pushed on the stack. It can later be sent to a function or set in a variable. Note: the member names are converted to strings; they certainly should be strings though anything is supported.

See also: http://sswf.sourceforge.net/SWFalexref.html#action_declare_object

Done! --strk 2006-02-04


0x45 get target

Pops an object, if it is a valid sprite, push its path on the stack. A sprite path can be used by different other actions such as the Goto Expression.

See also: http://sswf.sourceforge.net/SWFalexref.html#action_get_target

Implemented, called TargetPath in Gnash.

0x54 instance_of - PARTIALLY IMPLEMENTED

SWF6

Pops a reference to a constructor function then a reference to an object. Checks whether the object is an instance of the constructor and push true or false on the stack.

Since SWF version 7, it is possible to cast an object to another using the Cast Object action. This action returns a copy of the object or Null, which in many cases can be much more practical.

See also: http://sswf.sourceforge.net/SWFalexref.html#action_instance_of

Done! Doesn't work then 'constructor' is a C_FUNCTION, maybe it should.
--strk 05:34, 14 February 2006 (MST)

0x2B cast

The Cast Object action makes sure that the object o1 is an instance of the class s2. If it is the case, then o1 is pushed back onto the stack. Otherwise Null is pushed back onto the stack. The comparison is identical to the one applied by the Instance Of action.

See also: http://sswf.sourceforge.net/SWFalexref.html#action_cast_object

Done! Not tested as Ming does not output 0x2B blocks
--strk 06:57, 14 February 2006 (MST)

0x3B delete2 - SWF::ACTION_DELETE

Pops the name of a variable from the stack. Unset that variable. Push true or false depending on wheter deletion was successful. If the variable is undefined false is returned.

See also: http://sswf.sourceforge.net/SWFalexref.html#action_delete_all

Done! --strk 04:24, 15 February 2006 (MST)

0x53 new_method

Pops the name of a method (can be the empty string), pop an object (created with the Declare Object,) pop the number of arguments, pop each argument, create a new object, then call the specified method (function) as the constructor function of the object, push the returned value on the stack. This allows for overloaded constructors as in C++.

See also: http://sswf.sourceforge.net/SWFalexref.html#action_new_method

Done! Need testcase (Ming does not output this) - tested against googleplayer.swf
--strk 18:21, 7 July 2006 (MDT);


0x55 enum_object

Pops an object from the stack, push a null, then push the name of each member on the stack.

Keyword; defines a class that is a subclass of another class; the latter is the superclass. The subclass inherits all the methods, properties, functions, and so on that are defined in the superclass.

See also: http://sswf.sourceforge.net/SWFalexref.html#action_enumerate_object

Done! --strk 18:21, 7 July 2006 (MDT);


0x3A delete - SWF::ACTION_DELETEVAR

Pops one string which is the name of the property to be deleted. Then pop the object from which the property is to be deleted. It is necessary to Push Data type undefined (0x03) before the string to delete a global variable. According to some movies I have looked at, the delete instruction returns some undefined value.

See also: http://sswf.sourceforge.net/SWFalexref.html#action_delete

It returns a boolean value (to be pushed on the stack) indicating whether or not the delete was successful. We should send this info to Alexi's... --strk 2006-02-03

Done! --strk 18:21, 7 July 2006 (MDT);

0x69 Extends - SWF::ACTION_EXTENDS

Keyword; defines a class that is a subclass of another class; the latter is the superclass. The subclass inherits all the methods, properties, functions, and so on that are defined in the superclass.

See also: http://sswf.sourceforge.net/SWFalexref.html#action_extends

Done, needs probably more testing --80.67.113.193 11:58, 2 January 2007 (EST);

0x8F Try

Keywords; enclose a block of code in which an error can occur, and then respond to the error. If any code within the try code block throws an error (using the throw statement), control passes to the catch block, if one exists, and then to the finally code block, if one exists. The finally block always executes, regardless of whether an error was thrown. If code within the try block doesn't throw an error (that is, if the try block completes normally), then the code in the finally block is still executed. The finally block executes even if the try block exits using a return statement.

See also: http://sswf.sourceforge.net/SWFalexref.html#action_try