Public Member Functions | Friends

gnash::action_buffer Class Reference

A code segment. More...

#include <action_buffer.h>

Collaboration diagram for gnash::action_buffer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 action_buffer (const movie_definition &md)
void read (SWFStream &in, unsigned long endPos)
 Read action bytes from input stream up to but not including endPos.
size_t size () const
boost::uint8_t operator[] (size_t off) const
std::string disasm (size_t pc) const
 Disassemble instruction at given offset and return as a string.
const char * read_string (size_t pc) const
 Get a null-terminated string from given offset.
const unsigned char * getFramePointer (size_t pc) const
 Get a pointer to the current instruction within the code.
boost::int16_t read_int16 (size_t pc) const
 Get a signed integer value from given offset.
boost::uint16_t read_uint16 (size_t pc) const
 read_int16 should check buffer boundaries.
boost::int32_t read_int32 (size_t pc) const
 Read a 32-bit integer starting at given offset.
float read_float_little (size_t pc) const
 Read a little-endian 32-bit float starting at given offset.
double read_double_wacky (size_t pc) const
 Read a 64-bit double starting at given offset.
size_t dictionary_size () const
 Return number of entries in the constant pool.
const char * dictionary_get (size_t n) const
 Return a value from the constant pool.
void process_decl_dict (size_t start_pc, size_t stop_pc) const
 Interpret the SWF::ACTION_CONSTANTPOOL opcode.
const std::string & getDefinitionURL () const
 Return url of the SWF this action block was found in.
int getDefinitionVersion () const
 Return version of the SWF this action block was found in.
const movie_definitiongetMovieDefinition () const

Friends

class ActionExec

Detailed Description

A code segment.

This currently holds the actions in a memory buffer, but I'm workin toward making this unneeded so to eventually use a gnash::stream directly and avoid full loads. (not before profiling!). Good, would make jumping to other tags possible.


Constructor & Destructor Documentation

gnash::action_buffer::action_buffer ( const movie_definition md  ) 

Member Function Documentation

const char* gnash::action_buffer::dictionary_get ( size_t  n  )  const [inline]

Return a value from the constant pool.

size_t gnash::action_buffer::dictionary_size (  )  const [inline]

Return number of entries in the constant pool.

std::string gnash::action_buffer::disasm ( size_t  pc  )  const

Disassemble instruction at given offset and return as a string.

Referenced by gnash::ActionExec::operator()().

const std::string & gnash::action_buffer::getDefinitionURL (  )  const

Return url of the SWF this action block was found in.

References gnash::movie_definition::get_url().

int gnash::action_buffer::getDefinitionVersion (  )  const

Return version of the SWF this action block was found in.

References gnash::movie_definition::get_version().

Referenced by gnash::ActionExec::ActionExec(), and gnash::ActionExec::operator()().

const unsigned char* gnash::action_buffer::getFramePointer ( size_t  pc  )  const [inline]

Get a pointer to the current instruction within the code.

References m_buffer.

Referenced by gnash::ActionExec::operator()().

const movie_definition& gnash::action_buffer::getMovieDefinition (  )  const [inline]
boost::uint8_t gnash::action_buffer::operator[] ( size_t  off  )  const [inline]

References _, and m_buffer.

void gnash::action_buffer::process_decl_dict ( size_t  start_pc,
size_t  stop_pc 
) const

Interpret the SWF::ACTION_CONSTANTPOOL opcode.

Don't read stop_pc or later.

A dictionary is a table of indexed strings to be used in action blocks to reduce their size.

NOTE: Normally the dictionary is declared as the first action in an action buffer, but I've seen what looks like some form of copy protection that amounts to:

|start of action buffer| push true branch_if_true label decl_dict [0] // this is never executed, but has lots of orphan data declared in the opcode label: // (embedded inside the previous opcode; looks like an invalid jump) ... "protected" code here, including the real decl_dict opcode ... <end of the dummy decl_dict [0] opcode>

Note also that the dictionary may be overridden multiple times. See testsuite/misc-swfmill.all/dict_override.xml

TODO: is it possible to continue?

References _, gnash::key::i, length, and read_int16().

void gnash::action_buffer::read ( SWFStream in,
unsigned long  endPos 
)

Read action bytes from input stream up to but not including endPos.

Parameters:
endPos One past last valid-to-read byte position. Make sure it's > then in.tell() and <= in.get_tag_end_position() or an assertion will fail.

References _, gnash::SWFStream::get_tag_end_position(), IF_VERBOSE_MALFORMED_SWF, gnash::SWFStream::read(), size(), startPos, and gnash::SWFStream::tell().

Referenced by gnash::SWF::ButtonAction::ButtonAction(), and gnash::SWF::DoActionTag::read().

double gnash::action_buffer::read_double_wacky ( size_t  pc  )  const

Read a 64-bit double starting at given offset.

wacky format: 45670123 Useful to hide complexity of underlying buffer access.

References gnash::convert_double_wacky().

float gnash::action_buffer::read_float_little ( size_t  pc  )  const

Read a little-endian 32-bit float starting at given offset.

Useful to hide complexity of underlying buffer access.

boost::int16_t gnash::action_buffer::read_int16 ( size_t  pc  )  const [inline]

Get a signed integer value from given offset.

Useful to hide complexity of underlying buffer access.

References _, and m_buffer.

Referenced by gnash::ActionExec::operator()(), process_decl_dict(), read_uint16(), and gnash::ActionExec::skip_actions().

boost::int32_t gnash::action_buffer::read_int32 ( size_t  pc  )  const [inline]

Read a 32-bit integer starting at given offset.

Useful to hide complexity of underlying buffer access.

References _, and m_buffer.

const char* gnash::action_buffer::read_string ( size_t  pc  )  const [inline]

Get a null-terminated string from given offset.

Useful to hide complexity of underlying buffer access.

References _, and m_buffer.

boost::uint16_t gnash::action_buffer::read_uint16 ( size_t  pc  )  const [inline]

read_int16 should check buffer boundaries.

Get an unsigned short integer value from given offset

References read_int16().

size_t gnash::action_buffer::size (  )  const [inline]

Friends And Related Function Documentation

friend class ActionExec [friend]

The documentation for this class was generated from the following files: