littlefoot::Program Struct Reference
juce_blocks_basics » littlefoot

A reference to a block of memory which contains a complete program. More...

## Public Member Functions

| Program (const void *data, uint32 totalMemorySize) noexcept
uint16 | getStoredChecksum () const noexcept
uint16 | calculateChecksum () const noexcept
bool | checksumMatches () const noexcept
uint32 | getNumFunctions () const noexcept
FunctionID | getFunctionID (uint32 functionIndex) const noexcept
const uint8 * | getFunctionStartAddress (uint32 functionIndex) const noexcept
const uint8 * | getFunctionEndAddress (uint32 functionIndex) const noexcept
uint32 | getProgramSize () const noexcept
uint16 | getHeapSizeBytes () const noexcept
| Returns the number of bytes of heap space the program needs. More...
uint16 | getNumGlobals () const noexcept
| Returns the number of global variables the program uses. More...
uint32 | getTotalSpaceNeeded () const noexcept

## Static Public Member Functions

static uint8 | getNumExtraBytesForOpcode (OpCode op) noexcept
| For a given op code, this returns the number of program bytes that follow it. More...
static float | intToFloat (int32 value) noexcept
static int32 | floatToInt (float value) noexcept
static int16 | readInt16 (const uint8 *d) noexcept
static int32 | readInt32 (const uint8 *d) noexcept
static void | writeInt16 (uint8 *d, int16 v) noexcept
static void | writeInt32 (uint8 *d, int32 v) noexcept

## Public Attributes

const uint8 * | programStart = nullptr
const uint32 | maxProgramSize

## Static Public Attributes

static constexpr uint32 | programHeaderSize = 10

## Detailed Description

A reference to a block of memory which contains a complete program.

Data format: 2 bytes - program checksum 2 bytes - program size 2 bytes - num functions 2 bytes - num globals 2 bytes - amount of heap space needed (bytes) 2 bytes - ID of function 1 2 bytes - byte offset of function 1 code 2 bytes - ID of function 2 2 bytes - byte offset of function 2 code etc.. ...function code...

## Constructor & Destructor Documentation

## Program()

littlefoot::Program::Program | ( | const void * | data,
|  | uint32 | totalMemorySize
| ) |  |

noexcept

References jassert.

## Member Function Documentation

## getStoredChecksum()

uint16 littlefoot::Program::getStoredChecksum | ( |  | ) | const

noexcept

References programStart, and readInt16().

Referenced by checksumMatches().

## calculateChecksum()

uint16 littlefoot::Program::calculateChecksum | ( |  | ) | const

noexcept

References getProgramSize(), and programStart.

Referenced by checksumMatches().

## checksumMatches()

bool littlefoot::Program::checksumMatches | ( |  | ) | const

noexcept

References calculateChecksum(), and getStoredChecksum().

Referenced by littlefoot::LittleFootRemoteHeap< ImplementationClass >::isProgramLoaded().

## getNumFunctions()

uint32 littlefoot::Program::getNumFunctions | ( |  | ) | const

noexcept

References programStart, and readInt16().

Referenced by getFunctionEndAddress().

## getFunctionID()

FunctionID littlefoot::Program::getFunctionID | ( | uint32 | functionIndex | ) | const

noexcept

References readInt16().

## getFunctionStartAddress()

const uint8* littlefoot::Program::getFunctionStartAddress | ( | uint32 | functionIndex | ) | const

noexcept

References getProgramSize(), programStart, and readInt16().

Referenced by getFunctionEndAddress().

## getFunctionEndAddress()

const uint8* littlefoot::Program::getFunctionEndAddress | ( | uint32 | functionIndex | ) | const

noexcept

References getFunctionStartAddress(), getNumFunctions(), getProgramSize(), and programStart.

## getProgramSize()

uint32 littlefoot::Program::getProgramSize | ( |  | ) | const

noexcept

References maxProgramSize, programHeaderSize, programStart, and readInt16().

Referenced by calculateChecksum(), littlefoot::Runner< programAndHeapSpace, stackAndGlobalsSpace >::clearHeapAndGlobals(), getFunctionEndAddress(), getFunctionStartAddress(), getTotalSpaceNeeded(), littlefoot::LittleFootRemoteHeap< ImplementationClass >::isProgramLoaded(), and littlefoot::Runner< programAndHeapSpace, stackAndGlobalsSpace >::setDataByte().

## getHeapSizeBytes()

uint16 littlefoot::Program::getHeapSizeBytes | ( |  | ) | const

noexcept

Returns the number of bytes of heap space the program needs.

References programStart, and readInt16().

Referenced by getTotalSpaceNeeded().

## getNumGlobals()

uint16 littlefoot::Program::getNumGlobals | ( |  | ) | const

noexcept

Returns the number of global variables the program uses.

References programStart, and readInt16().

## getTotalSpaceNeeded()

uint32 littlefoot::Program::getTotalSpaceNeeded | ( |  | ) | const

noexcept

References getHeapSizeBytes(), and getProgramSize().

## getNumExtraBytesForOpcode()

static uint8 littlefoot::Program::getNumExtraBytesForOpcode | ( | OpCode | op | ) |

static noexcept

For a given op code, this returns the number of program bytes that follow it.

References jassertfalse, littlefoot::LITTLEFOOT_OP, LITTLEFOOT_OP_INT16, LITTLEFOOT_OP_INT32, LITTLEFOOT_OP_INT8, and LITTLEFOOT_OPCODES.

## intToFloat()

static float littlefoot::Program::intToFloat | ( | int32 | value | ) |

static noexcept

## floatToInt()

static int32 littlefoot::Program::floatToInt | ( | float | value | ) |

static noexcept

## readInt16()

static int16 littlefoot::Program::readInt16 | ( | const uint8 * | d | ) |

static noexcept

Referenced by getFunctionID(), getFunctionStartAddress(), getHeapSizeBytes(), getNumFunctions(), getNumGlobals(), getProgramSize(), and getStoredChecksum().

## readInt32()

static int32 littlefoot::Program::readInt32 | ( | const uint8 * | d | ) |

static noexcept

Referenced by littlefoot::Runner< programAndHeapSpace, stackAndGlobalsSpace >::getHeapInt().

## writeInt16()

static void littlefoot::Program::writeInt16 | ( | uint8 * | d,
|  | int16 | v
| ) |  |

static noexcept

## writeInt32()

static void littlefoot::Program::writeInt32 | ( | uint8 * | d,
|  | int32 | v
| ) |  |

static noexcept

Referenced by littlefoot::Runner< programAndHeapSpace, stackAndGlobalsSpace >::setHeapInt().

## Member Data Documentation

## programHeaderSize

constexpr uint32 littlefoot::Program::programHeaderSize = 10

static constexpr

Referenced by getProgramSize().

## programStart

const uint8* littlefoot::Program::programStart = nullptr

Referenced by calculateChecksum(), getFunctionEndAddress(), getFunctionStartAddress(), getHeapSizeBytes(), getNumFunctions(), getNumGlobals(), getProgramSize(), and getStoredChecksum().

## maxProgramSize

const uint32 littlefoot::Program::maxProgramSize

Referenced by getProgramSize().

The documentation for this struct was generated from the following file:

- juce_LittleFootRunner.h