srecord: srecord::output_file_mem Class Reference

srecord 1.65.0

Loading...
Searching...
No Matches
srecord::output_file_mem Class Reference

The srecord::output_file_mem class is used to represent the output state of a file in Memory Initialization File Format (.mem Lattice). More...

`#include <mem.h>`

Inheritance diagram for srecord::output_file_mem:
[legend]
Collaboration diagram for srecord::output_file_mem:
[legend]

## Public Member Functions
virtual | ~output_file_mem ()
| The destructor.
Public Member Functions inherited from srecord::output_file
virtual | ~output_file ()
| The destructor.
| output_file ()
| The default constructor.
| output_file (const std::string &file_name)
| The constructor.
virtual const std::string | filename (void) const
| The filename method is used to determine the name of the output file.
Public Member Functions inherited from srecord::output
virtual | ~output ()
| The destructor.
virtual void | write_header (const record *=0)
| The write_header method is used to write a header record to the output.
virtual void | write_data (unsigned long, const void *, size_t)
| The write_data method is used to write data to the output.
virtual void | write_execution_start_address (const record *=0)
| The write_execution_start_address method is used to write an execution start address record to the output.
virtual void | fatal_error (const char *fmt,...) const FORMAT_PRINTF(2
| The fatal_error method is used to report fatal errors.
virtual void virtual void | fatal_error_v (const char *fmt, va_list ap) const
| The fatal_error_v method is used to report fatal errors.
virtual void | fatal_error_errno (const char *fmt,...) const FORMAT_PRINTF(2
| The fatal_error_errno method is used to report fatal errors, and append the string equivalent of errno.
virtual void virtual void | fatal_error_errno_v (const char *fmt, va_list ap) const
| The fatal_error_errno_v method is used to report fatal errors.
virtual void | warning (const char *fmt,...) const FORMAT_PRINTF(2
| The warning method is used to likely but non-fatal errors.
virtual void virtual void | warning_v (const char *fmt, va_list ap) const
| The warning_v method is used to report likely but non-fatal errors.

## Static Public Member Functions
static pointer | create (const std::string &file_name)
| The create class method is used to create new dynamically allocated instances of this class.
Static Public Member Functions inherited from srecord::output_file
static void | enable_header (bool yesno)
| The enable_header class method is used to enable or disable the writing of header records into output file, if the format supports optional header records.
static void | enable_data_count (bool yesno)
| The enable_data_count class method is used to enable or disable the writing of data record count records into output file, if the format supports optional data record count records.
static void | enable_goto_addr (bool yesno)
| The enable_goto_addr class method is used to enable or disable the writing of execution start address records into output file, if the format supports optional execution start address records.
static void | enable_footer (bool yesno)
| The enable_footer class method is used to enable or disable the writing of footer records into output file, if the format supports optional footer records.
static bool | enable_by_name (const std::string &name, bool yesno)
| The enable_by_name class method is used to enable or disable the writing of various records into output file.
static bool | line_termination_by_name (const std::string &name)
| The line_termination_by_name method is used to force line termination to a particular style, rather than the current operating system's native text format.

## Protected Member Functions
void | write (const record &)
| The write method is used to write a recordonto an output.
void | line_length_set (int)
| The set_line_length method is used to set the maximum length of an output line, for those formats for which this is a meaningful concept, and the line length is at all controllable.
void | address_length_set (int)
| The address_length_set method is used to set the minimum number of bytes to be written for addresses in the output, for those formats for which this is a meaningful concept, and the address length is at all controllable.
int | preferred_block_size_get (void) const
| The preferred_block_size_get method is used to get the proferred block size of the output fformat.
bool | preferred_block_size_set (int nbytes)
| The preferred_block_size_set method is is to set a precific number of bytes for the preferred block size.
void | command_line (arglex_tool *cmdln)
| The command_line method is used by arglex_srec::get_output when parsing the command line, to give the format an opportunity to grab extra arguments off the command line.
const char * | format_name (void) const
| The format_name method is used to obtain the name of this output format.
void | notify_upper_bound (unsigned long addr)
| The notify_upper_bound method is used to notify the output class of the upper bound (highest address plus one) of the output to come.
Protected Member Functions inherited from srecord::output_file
virtual void | put_char (int c)
| The put_char method is used to send a character to the output.
void | put_nibble (int value)
| The put_nibble method is used to send a hexadecimal digit (0..9, A..F) to the output.
virtual void | put_byte (unsigned char value)
| The put_byte method is used to send a byte value to the output.
virtual void | put_word_be (int value)
| The put_word_be method is used to send a 16-bit value to the output.
virtual void | put_word_le (int value)
| The put_word_le method is used to send a 16-bit value to the output.
virtual void | put_3bytes_be (unsigned long value)
| The put_3bytes_be method is used to send a 24-bit value to the output.
virtual void | put_3bytes_le (unsigned long value)
| The put_3bytes_le method is used to send a 24-bit value to the output.
virtual void | put_4bytes_be (unsigned long value)
| The put_4bytes_be method is used to send a 32-bit value to the output.
virtual void | put_4bytes_le (unsigned long value)
| The put_4bytes_le method is used to send a 32-bit value to the output.
void | checksum_reset (void)
| The checksum_reset method is used to set the running checksum to zero.
virtual void | checksum_add (unsigned char n)
| The checksum_add method is used to add another 8-bit value to the running checksum.
int | checksum_get (void)
| The checksum_get method is used to get the current value of the running checksum (added to by the checksum_add method, usually called by the put_byte method).
int | checksum_get16 (void)
| The checksum_get16 method is used to get the current value of the running checksum (added to by the checksum_add method, usually called by the put_byte method).
void | seek_to (unsigned long)
| The seek_to method is used to move the output position to the specified location in the output file.
void | put_string (const char *text)
| The put_string method is used to send a nul-terminated C string to the output.
void | put_string (const std::string &text)
| The put_string method is used to send C++ string to the output.
void | put_stringf (const char *,...) FORMAT_PRINTF(2
| The put_stringf method is used to send a formatted string to the output.
void | fatal_alignment_error (int alignment)
| The fatal_alignment_error method is used to report problems with unaligned data in formats that require aligned data.
void | fatal_hole_error (unsigned long lo, unsigned long hi)
| The fatal_hole_error method is used to report problems with holes in the data, for formats that cannot cope with them.
void | data_address_too_large (const record &record, unsigned nbits) const
| The data_address_too_large method is used to report fatal problems with data records, in the case where some or all of the address span of a record falls outside the format's ability to represent addresses.
Protected Member Functions inherited from srecord::output
| output ()
| The default constructor.

## Additional Inherited Members
Public Types inherited from srecord::output
typedef std::shared_ptr< output > | pointer
Protected Types inherited from srecord::output_file
enum | line_termination_t { line_termination_native , line_termination_crlf , line_termination_nl , line_termination_binary = line_termination_nl , line_termination_cr , line_termination_primos }
Static Protected Member Functions inherited from srecord::output_file
static void | enable_optional_address (bool yesno)
| The enable_footer class method is used to enable or disable emitting optional address records.
static line_termination_t | line_termination_guess (void)
| The line_termination_guess class method is used to figure out the line termination style of the host environment.
Protected Attributes inherited from srecord::output_file
int | checksum
| The checksum instance variable is used record the running checksum.
Static Protected Attributes inherited from srecord::output_file
void static bool | enable_header_flag
| The enable_header_flag class variable is set by the enable_header method, to remember whether or not header records are to be emitted (if the format supports optional header records).
static bool | enable_data_count_flag
| The enable_data_count_flag class variable is set by the enable_data_count method, to remember whether or not data record count records are to be emitted (if the format supports optional data record count records).
static bool | enable_goto_addr_flag
| The enable_goto_addr_flag class variable is set by the enable_goto_addr method, to remember whether or not execution start address records are to be emitted (if the format supports optional execution start address records).
static bool | enable_footer_flag
| The enable_footer_flag class variable is set by the enable_footer method, to remember whether or not footer records (end-of-file record) are to be emitted (if the format supports optional footer records).
static bool | enable_optional_address_flag
| The enable_optional_address_records class variable is used to remember whether or not to emit optional address records.
static line_termination_t | line_termination
| The line_termination class variable is used to remember the desired line termination style.

## Detailed Description

The srecord::output_file_mem class is used to represent the output state of a file in Memory Initialization File Format (.mem Lattice).

Definition at line 31 of file mem.h.

## Constructor & Destructor Documentation

## ◆ ~output_file_mem()

virtual srecord::output_file_mem::~output_file_mem | ( |  | ) |
| virtual

The destructor.

## Member Function Documentation

## ◆ create()

pointer srecord::output_file_mem::create | ( | const std::string & | file_name | ) |
| static

The create class method is used to create new dynamically allocated instances of this class.

Parameters

  file_name | The name of the file to be written.

## ◆ write()

void srecord::output_file_mem::write | ( | const record & | rec | ) |
| protectedvirtual

The write method is used to write a recordonto an output.

Derived classes must implement this method.

Parameters

  rec | The record to be written.

Implements srecord::output.

## ◆ line_length_set()

void srecord::output_file_mem::line_length_set | ( | int | cols | ) |
| protectedvirtual

The set_line_length method is used to set the maximum length of an output line, for those formats for which this is a meaningful concept, and the line length is at all controllable.

Derived classes must implement this method.

Parameters

  cols | The page width in fixed width text columns.

Implements srecord::output.

## ◆ address_length_set()

void srecord::output_file_mem::address_length_set | ( | int | nbytes | ) |
| protectedvirtual

The address_length_set method is used to set the minimum number of bytes to be written for addresses in the output, for those formats for which this is a meaningful concept, and the address length is at all controllable.

Derived classes must implement this method.

Parameters

  nbytes | The number of byte to use for the address (2..4).

Implements srecord::output.

## ◆ preferred_block_size_get()

int srecord::output_file_mem::preferred_block_size_get | ( | void |  | ) | const
| protectedvirtual

The preferred_block_size_get method is used to get the proferred block size of the output fformat.

Often, but not always, influenced by the line_lebgth_set method. Derived classes must implement this method.

Implements srecord::output.

## ◆ preferred_block_size_set()

bool srecord::output_file_mem::preferred_block_size_set | ( | int | nbytes | ) |
| protectedvirtual

The preferred_block_size_set method is is to set a precific number of bytes for the preferred block size.

Parameters

  nbytes | The exact number of bytes to be returned by the preferred_block_size_get method.

Returns
  There are format-specific limitations on block sizes, this method will return true if the setting was acceptable, false if the format is incapable of using the specified block size.

Implements srecord::output.

## ◆ command_line()

void srecord::output_file_mem::command_line | ( | arglex_tool * | cmdln | ) |
| protectedvirtual

The command_line method is used by arglex_srec::get_output when parsing the command line, to give the format an opportunity to grab extra arguments off the command line.

The default implementation does nothing.

Parameters

  cmdln | Where to obtain information about the curreent parse stat of the command line.

Reimplemented from srecord::output.

## ◆ format_name()

const char * srecord::output_file_mem::format_name | ( | void |  | ) | const
| protectedvirtual

The format_name method is used to obtain the name of this output format.

Implements srecord::output.

## ◆ notify_upper_bound()

void srecord::output_file_mem::notify_upper_bound | ( | unsigned long | addr | ) |
| protectedvirtual

The notify_upper_bound method is used to notify the output class of the upper bound (highest address plus one) of the output to come.

Shall be called before the head or any data records are written.

Parameters

  addr | One past the highest used memory byte.

Reimplemented from srecord::output.

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

- output/file/mem.h