#include <ProgramMetaData.hpp>
Public Member Functions | |
void * | operator new (size_t size, RexxBuffer *buff) |
void | operator delete (void *p, RexxBuffer *buff) |
ProgramMetaData () | |
ProgramMetaData (RexxBuffer *) | |
ProgramMetaData (size_t size) | |
size_t | getDataSize () |
size_t | getHeaderSize () |
RexxBuffer * | extractBufferData () |
char * | getImageData () |
size_t | getImageSize () |
bool | validate (bool &) |
void | write (FILE *handle, RexxBuffer *program) |
RexxBuffer * | read (RexxString *name, FILE *handle) |
Protected Types | |
enum | { MAGICNUMBER = 11111 , METAVERSION = 40 } |
Protected Attributes | |
char | fileTag [16] |
unsigned short | magicNumber |
unsigned short | imageVersion |
unsigned short | wordSize |
unsigned short | bigEndian |
char | rexxVersion [40] |
size_t | imageSize |
char | imageData [4] |
Definition at line 45 of file ProgramMetaData.hpp.
|
protected |
Enumerator | |
---|---|
MAGICNUMBER | |
METAVERSION |
Definition at line 65 of file ProgramMetaData.hpp.
ProgramMetaData::ProgramMetaData | ( | ) |
Initialized a default metadata descriptor.
Definition at line 119 of file ProgramMetaData.cpp.
References bigEndian, imageSize, imageVersion, magicNumber, and wordSize.
ProgramMetaData::ProgramMetaData | ( | RexxBuffer * | image | ) |
Initialize the meta data directly from a buffer.
image | The image buffer. |
Definition at line 72 of file ProgramMetaData.cpp.
References bigEndian, compiledHeader, fileTag, RexxBuffer::getData(), RexxBufferBase::getDataLength(), RexxString::getStringData(), Interpreter::getVersionNumber(), Interpreter::getWordSize(), imageData, imageSize, imageVersion, Interpreter::isBigEndian(), MAGICNUMBER, magicNumber, METAVERSION, rexxVersion, and wordSize.
ProgramMetaData::ProgramMetaData | ( | size_t | size | ) |
Initialize program metadata for a specific size image.
size | The size of the program data. |
Definition at line 97 of file ProgramMetaData.cpp.
References bigEndian, compiledHeader, fileTag, RexxString::getStringData(), Interpreter::getVersionNumber(), Interpreter::getWordSize(), imageSize, imageVersion, Interpreter::isBigEndian(), MAGICNUMBER, magicNumber, METAVERSION, rexxVersion, and wordSize.
RexxBuffer * ProgramMetaData::extractBufferData | ( | ) |
Extract the following data as a RexxBuffer object.
Definition at line 158 of file ProgramMetaData.cpp.
References imageData, imageSize, and new_buffer().
Referenced by RoutineClass::restore().
size_t ProgramMetaData::getDataSize | ( | ) |
Get the final size of a copied buffer
Definition at line 136 of file ProgramMetaData.cpp.
References imageData, and imageSize.
Referenced by RoutineClass::save().
size_t ProgramMetaData::getHeaderSize | ( | ) |
Get the final size of a copied buffer
Definition at line 147 of file ProgramMetaData.cpp.
References imageData.
char * ProgramMetaData::getImageData | ( | ) |
Return a pointer to the inline image data.
Definition at line 169 of file ProgramMetaData.cpp.
References imageData.
Referenced by RoutineClass::restore().
|
inline |
Definition at line 59 of file ProgramMetaData.hpp.
References imageSize.
Referenced by RoutineClass::restore().
|
inline |
Definition at line 49 of file ProgramMetaData.hpp.
References SystemInterpreter::releaseResultMemory().
void * ProgramMetaData::operator new | ( | size_t | size, |
RexxBuffer * | buff | ||
) |
Allocate a combined metadata object with the flattened program data after it.
size | The size of the object |
buff | The appended buffer. |
Definition at line 60 of file ProgramMetaData.cpp.
References SystemInterpreter::allocateResultMemory().
RexxBuffer * ProgramMetaData::read | ( | RexxString * | fileName, |
FILE * | handle | ||
) |
Read the program meta data and the image data from a file, with image validation.
handle | The input file handle. |
Definition at line 228 of file ProgramMetaData.cpp.
References Error_Program_unreadable_version, fileTag, RexxBuffer::getData(), getHeaderSize(), imageSize, new_buffer(), OREF_NULL, reportException(), and validate().
bool ProgramMetaData::validate | ( | bool & | badVersion | ) |
Validate that this saved program image is valid for this interpreter.
badVersion | Indicates whether this is a version failure. |
Definition at line 184 of file ProgramMetaData.cpp.
References bigEndian, compiledHeader, fileTag, Interpreter::getWordSize(), imageVersion, Interpreter::isBigEndian(), MAGICNUMBER, magicNumber, METAVERSION, and wordSize.
Referenced by read(), and RoutineClass::restore().
void ProgramMetaData::write | ( | FILE * | handle, |
RexxBuffer * | program | ||
) |
Write the metadata to a file.
handle | The handle of the output file. |
program | The program buffer data (also written out). |
Definition at line 211 of file ProgramMetaData.cpp.
References RexxBuffer::getData(), RexxBufferBase::getDataLength(), and getHeaderSize().
Referenced by RoutineClass::save().
|
protected |
Definition at line 76 of file ProgramMetaData.hpp.
Referenced by ProgramMetaData(), and validate().
|
protected |
Definition at line 72 of file ProgramMetaData.hpp.
Referenced by ProgramMetaData(), read(), and validate().
|
protected |
Definition at line 79 of file ProgramMetaData.hpp.
Referenced by extractBufferData(), getDataSize(), getHeaderSize(), getImageData(), and ProgramMetaData().
|
protected |
Definition at line 78 of file ProgramMetaData.hpp.
Referenced by extractBufferData(), getDataSize(), getImageSize(), ProgramMetaData(), and read().
|
protected |
Definition at line 74 of file ProgramMetaData.hpp.
Referenced by ProgramMetaData(), and validate().
|
protected |
Definition at line 73 of file ProgramMetaData.hpp.
Referenced by ProgramMetaData(), and validate().
|
protected |
Definition at line 77 of file ProgramMetaData.hpp.
Referenced by ProgramMetaData().
|
protected |
Definition at line 75 of file ProgramMetaData.hpp.
Referenced by ProgramMetaData(), and validate().