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 (stream &in, unsigned long endPos)
 Read action bytes from input stream up to but not including endPos.
bool is_null () const
size_t get_length () const
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.
boost::uint32_t read_V32 (size_t pc, boost::uint8_t &length) const
const unsigned char * getFramePointer (size_t pc) const
 Get a pointer to the current instruction within the code.
const unsigned char * getCodeStart ()
 Get the base pointer of the code buffer.
const unsigned char * get_buffer (size_t pc) const
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
 Get an unsigned short integer value from given offset.
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

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


Constructor & Destructor Documentation

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


Member Function Documentation

void gnash::action_buffer::read ( stream 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.get_position() and <= in.get_tag_end_position() or an assertion will fail.

bool gnash::action_buffer::is_null (  )  const [inline]

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

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

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

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

Disassemble instruction at given offset and return as a string.

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.

boost::uint32_t gnash::action_buffer::read_V32 ( size_t  pc,
boost::uint8_t &  length 
) const [inline]

Get a variable length 32-bit integer from the stream. Store its length in the passed boost::uint8_t.

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

Get a pointer to the current instruction within the code.

const unsigned char* gnash::action_buffer::getCodeStart (  )  [inline]

Get the base pointer of the code buffer.

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

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.

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

Get an unsigned short integer value from given offset.

Useful to hide complexity of underlying buffer access.

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.

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.

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.

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

Return number of entries in the constant pool.

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

Return a value from the constant pool.

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

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


Friends And Related Function Documentation

friend class ActionExec [friend]


The documentation for this class was generated from the following files:
Generated on Thu Mar 6 18:25:11 2008 for Gnash by  doxygen 1.5.4