Gnash  0.8.10
Public Member Functions
gnash::action_buffer Class Reference

A code segment. More...

#include <action_buffer.h>

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.
const char * dictionary_get (size_t n) const
 Return a value from the constant pool.
const ConstantPoolreadConstantPool (size_t start_pc, size_t stop_pc) const
 Read an SWF::ACTION_CONSTANTPOOL opcode and return as a dictionary.
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

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.

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 assert.

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

References _.

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

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

Parameters:
endPosOne 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 startPos, gnash::SWFStream::tell(), assert, gnash::SWFStream::get_tag_end_position(), size(), IF_VERBOSE_MALFORMED_SWF, _, gnash::SWFStream::read(), gnash::key::SWF, and gnash::SWF::ACTION_END.

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.

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 _.

Referenced by read_uint16(), gnash::ActionExec::operator()(), 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 _.

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 assert, and _.

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().

Referenced by readConstantPool().

const ConstantPool & gnash::action_buffer::readConstantPool ( size_t  start_pc,
size_t  stop_pc 
) const

Read an SWF::ACTION_CONSTANTPOOL opcode and return as a dictionary.

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. This parser caches dictionaries to avoid reindexing them when encountered multiple times.

Note that there can be multiple constant pools in the same action buffer. See testsuite/misc-swfmill.all/*dict*

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

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

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