wreport::bulletin::Printer Class Reference

Interpreter that pretty-prints the opcodes using indentation to show structure. More...

`#include <interpreter.h>`

Inheritance diagram for wreport::bulletin::Printer:

## Public Member Functions

| Printer (const Tables &tables, const Opcodes &opcodes)
void | b_variable (Varcode code) override
| Notify of a B variable entry.
void | c_modifier (Varcode code, Opcodes &next) override
| Notify of a C modifier.
void | r_replication (Varcode code, Varcode delayed_code, const Opcodes &ops) override
| Handle a replicated section.
void | run_d_expansion (Varcode code) override
| Executes the expansion of code, which has been put on top of the opcode stack.
void | define_variable (Varinfo info) override
| Request processing, according to info, of a data variable.
void | define_variable_with_associated_field (Varinfo info) override
| Request processing, according to info, of a data variable.
void | define_bitmap (unsigned bitmap_size) override
| Request processing of a data present bitmap.
unsigned | define_bitmap_delayed_replication_factor (Varinfo info) override
| Request processing of a delayed replication factor variable used to encode the size of a bitmap.
unsigned | define_associated_field_significance (Varinfo info) override
| Request processing of an associated field significance variable (B31021).
Public Member Functions inherited from wreport::bulletin::Interpreter
| Interpreter (const Tables &tables, const Opcodes &opcodes)
| Interpreter (const Interpreter &)=delete
Interpreter & | operator= (const Interpreter &)=delete
void | run ()
| Run the interpreter.
virtual void | r_bitmap (Varcode code, Varcode delayed_code, const Opcodes &ops)
| Handle a replicated section which defines a bitmap.
virtual void | run_r_repetition (unsigned cur, unsigned total)
| Executes a repetition of the opcodes on top of the stack.
virtual unsigned | define_delayed_replication_factor (Varinfo info)
| Request processing, according to info, of a data variabile that is significant for controlling the encoding process.
virtual void | define_substituted_value (unsigned pos)
| Request processing of a substituted value corresponding to position pos in the list or previous variables.
virtual void | define_attribute (Varinfo info, unsigned pos)
| Request processing of an attribute encoded with info, related to the variable as position pos in the list of previous variables.
virtual void | define_raw_character_data (Varcode code)
| Request processing of C05yyy raw character data.
virtual void | define_c03_refval_override (Varcode code)
| Request processing of a new value for the reference value of the given B code.

## Data Fields

FILE * | out
| Output stream.
unsigned | indent
| Current indent level.
unsigned | indent_step
| How many spaces in an indentation level.
Data Fields inherited from wreport::bulletin::Interpreter
const Tables & | tables
std::stack< Opcodes > | opcode_stack
Bitmaps | bitmaps
| Bitmap iteration.
AssociatedField | associated_field
| Current associated field state.
int | c_scale_change = 0
| Current value of scale change from C modifier.
int | c_width_change = 0
| Current value of width change from C modifier.
int | c_scale_ref_width_increase = 0
| Increase of scale, reference value and data width.
int | c_string_len_override = 0
| Current value of string length override from C08 modifiers (0 for no override).
std::map< wreport::Varcode, uint32_t > | c03_refval_overrides
| Current reference value overrides.
unsigned | c03_refval_override_bits = 0
| Set to the number of reference value override bits while reading the override values.

## Protected Member Functions

void | print_lead (Varcode code)
| Print line lead (indentation and formatted code).
Protected Member Functions inherited from wreport::bulletin::Interpreter
Varinfo | get_varinfo (Varcode code)
| Return a Varinfo for the given Varcode, applying all relevant C modifications that are currently active.

## Additional Inherited Members

Static Public Member Functions inherited from wreport::bulletin::Interpreter
static void | print_c_modifier (FILE *out, Varcode code, Opcodes &nex)
| Print a description of this C modifier.

## Detailed Description

Interpreter that pretty-prints the opcodes using indentation to show structure.

## Member Function Documentation

## b_variable()

void wreport::bulletin::Printer::b_variable | ( | Varcode | code | ) |

override virtual

Notify of a B variable entry.

Parameters

  code | The B variable code

Reimplemented from wreport::bulletin::Interpreter.

## c_modifier()

void wreport::bulletin::Printer::c_modifier | ( | Varcode | code,
|  | Opcodes & | next )

override virtual

Notify of a C modifier.

Whenever the modifier is a supported one, this is followed by an invocation of one of the specific c_* methods.

Parameters

  code | The C modifier code

Reimplemented from wreport::bulletin::Interpreter.

## define_associated_field_significance()

unsigned wreport::bulletin::Printer::define_associated_field_significance | ( | Varinfo | info | ) |

override virtual

Request processing of an associated field significance variable (B31021).

Returns
  the associated field significance value

Reimplemented from wreport::bulletin::Interpreter.

## define_bitmap()

void wreport::bulletin::Printer::define_bitmap | ( | unsigned | bitmap_size | ) |

override virtual

Request processing of a data present bitmap.

Parameters

  code | The C modifier code that defines the bitmap
  rep_code | The R replicator that defines the bitmap
  delayed_code | The B delayed replicator that defines the bitmap length (it is 0 if the length is encoded in the YYY part of rep_code
  ops | The replicated opcodes that define the bitmap

Returns
  The bitmap that has been processed.

Reimplemented from wreport::bulletin::Interpreter.

## define_bitmap_delayed_replication_factor()

unsigned wreport::bulletin::Printer::define_bitmap_delayed_replication_factor | ( | Varinfo | info | ) |

override virtual

Request processing of a delayed replication factor variable used to encode the size of a bitmap.

Returns
  the repetition count

Reimplemented from wreport::bulletin::Interpreter.

## define_variable()

void wreport::bulletin::Printer::define_variable | ( | Varinfo | info | ) |

override virtual

Request processing, according to info, of a data variable.

Reimplemented from wreport::bulletin::Interpreter.

## define_variable_with_associated_field()

void wreport::bulletin::Printer::define_variable_with_associated_field | ( | Varinfo | info | ) |

override virtual

Request processing, according to info, of a data variable.

Reimplemented from wreport::bulletin::Interpreter.

## print_lead()

void wreport::bulletin::Printer::print_lead | ( | Varcode | code | ) |

protected

Print line lead (indentation and formatted code).

Parameters

  code | Code to format in the line lead

## r_replication()

void wreport::bulletin::Printer::r_replication | ( | Varcode | code,
|  | Varcode | delayed_code,
|  | const Opcodes & | ops )

override virtual

Handle a replicated section.

Parameters

  code | The R replication code
  delayed_code | The delayed replication B code, or 0 if delayed replication is not used
  ops | The replicated operators

Reimplemented from wreport::bulletin::Interpreter.

## run_d_expansion()

void wreport::bulletin::Printer::run_d_expansion | ( | Varcode | code | ) |

override virtual

Executes the expansion of code, which has been put on top of the opcode stack.

By default it just calls run(), but it can be overridden to execute operations before and after.

Parameters

  code | The D code that is being run

Reimplemented from wreport::bulletin::Interpreter.

## Field Documentation

## indent

unsigned wreport::bulletin::Printer::indent

Current indent level.

It defaults to 0 in a newly created Printer. You can set it to some other value to indent all the output by the given amount of spaces

## out

FILE* wreport::bulletin::Printer::out

Output stream.

It defaults to stdout, but it can be set to any FILE* stream

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

- interpreter.h