Gnash  0.8.11dev
Public Member Functions | List of all members
gnash::action_buffer Class Reference

A code segment. More...

#include <action_buffer.h>

Inheritance diagram for gnash::action_buffer:

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. More...
 
size_t size () const
 
std::uint8_t operator[] (size_t off) const
 
std::string disasm (size_t pc) const
 Disassemble instruction at given offset and return as a string. More...
 
const char * read_string (size_t pc) const
 Get a null-terminated string from given offset. More...
 
const unsigned char * getFramePointer (size_t pc) const
 Get a pointer to the current instruction within the code. More...
 
std::int16_t read_int16 (size_t pc) const
 Get a signed integer value from given offset. More...
 
std::uint16_t read_uint16 (size_t pc) const
 read_int16 should check buffer boundaries. More...
 
std::int32_t read_int32 (size_t pc) const
 Read a 32-bit integer starting at given offset. More...
 
float read_float_little (size_t pc) const
 Read a little-endian 32-bit float starting at given offset. More...
 
double read_double_wacky (size_t pc) const
 Read a 64-bit double starting at given offset. More...
 
const char * dictionary_get (size_t n) const
 Return a value from the constant pool. More...
 
const ConstantPoolreadConstantPool (size_t start_pc, size_t stop_pc) const
 Read an SWF::ACTION_CONSTANTPOOL opcode and return as a dictionary. More...
 
const std::string & getDefinitionURL () const
 Return url of the SWF this action block was found in. More...
 
int getDefinitionVersion () const
 Return version of the SWF this action block was found in. More...
 
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

§ action_buffer()

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

Member Function Documentation

§ dictionary_get()

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

Return a value from the constant pool.

References getDefinitionURL(), getDefinitionVersion(), and readConstantPool().

§ disasm()

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

Disassemble instruction at given offset and return as a string.

Referenced by gnash::ActionExec::adjustNextPC(), gnash::ActionExec::operator()(), and operator[]().

§ getDefinitionURL()

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

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

Referenced by dictionary_get().

§ getDefinitionVersion()

int gnash::action_buffer::getDefinitionVersion ( ) const

§ getFramePointer()

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

Get a pointer to the current instruction within the code.

§ getMovieDefinition()

const movie_definition& gnash::action_buffer::getMovieDefinition ( ) const
inline

§ operator[]()

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

References _, and disasm().

§ read()

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.

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

§ read_double_wacky()

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.

Referenced by read_int32().

§ read_float_little()

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.

Referenced by read_int32().

§ read_int16()

std::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 gnash::ActionExec::adjustNextPC(), gnash::SWF::SWFHandlers::execute(), gnash::ActionExec::operator()(), read_uint16(), and gnash::ActionExec::skip_actions().

§ read_int32()

std::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 _, read_double_wacky(), and read_float_little().

§ read_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.

References _.

Referenced by gnash::SWF::SWFHandlers::execute().

§ read_uint16()

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

§ 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 _, gnash::SWF::ARG_DECL_DICT, gnash::SWF::ARG_FUNCTION2, gnash::SWF::ARG_HEX, gnash::SWF::ARG_NONE, gnash::SWF::ARG_PUSH_DATA, gnash::SWF::ARG_S16, gnash::SWF::ARG_STR, gnash::SWF::ARG_U16, gnash::SWF::ARG_U8, gnash::key::d, gnash::key::f, gnash::hexify(), gnash::key::i, gnash::SWF::SWFHandlers::instance(), gnash::SWF::SWFHandlers::lastType(), length, gnash::log_error(), read_uint16(), and gnash::key::SWF.

Referenced by dictionary_get().

§ size()

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

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