Example #1
0
def generate_actuals_base_h(decoder, decoder_name, filename, out, cl_args):
    """Generates actual decoder C++ declarations in the given file.

    Args:
        decoder: The decoder tables.
        decoder_name: The name of the decoder state to build.
        filename: The (localized) name for the .h file.
        out: a COutput object to write to.
        cl_args: A dictionary of additional command line arguments.
        """

    num_blocks = dgen_output.GetNumberCodeBlocks(cl_args['auto-actual-sep'])

    assert filename.endswith('actuals.h')

    values = {
        'FILE_HEADER': dgen_output.HEADER_BOILERPLATE,
        'IFDEF_NAME': dgen_output.ifdef_name(filename),
        'FILEBASE': filename[:-len('.h')],
        'decoder_name': decoder_name,
    }
    out.write(ACTUAL_BASE_H_HEADER % values)
    for block in range(1, num_blocks + 1):
        values['filename_index'] = block
        out.write(ACTUAL_BASE_INCLUDE % values)
    out.write(ACTUAL_BASE_H_FOOTER % values)
Example #2
0
def generate_actuals_cc(decoder, decoder_name, filename, out, cl_args):
    """Generates the actual decoder C++ definitions in the given file.

    Args:
        decoder: The decoder tables.
        decoder_name: The name of the decoder state to build.
        filename: The (localized) name for the .h file.
        out: a COutput object to write to.
        cl_args: A dictionary of additional command line arguments.
        """

    separators = cl_args['auto-actual-sep']
    num_blocks = dgen_output.GetNumberCodeBlocks(separators)

    # Find block to print
    block = dgen_output.FindBlockIndex(filename, 'actuals_%s.cc', num_blocks)

    values = {
        'FILE_HEADER': dgen_output.HEADER_BOILERPLATE,
        'decoder_name': decoder_name,
    }

    out.write(ACTUAL_CC_HEADER % values)
    _print_actual_classes(GetActualDecodersBlock(decoder, block, separators),
                          out)
    out.write(ACTUAL_CC_FOOTER % values)
Example #3
0
def generate_baselines_h(decoder, decoder_name, filename, out, cl_args):
    """Generates baseline decoder C++ declarations in the given file.

    Args:
        decoder: The decoder tables.
        decoder_name: The name of the decoder state to build.
        filename: The (localized) name for the .h file.
        out: a COutput object to write to.
        cl_args: A dictionary of additional command line arguments.
        """
    separators = cl_args['auto-baseline-sep']
    num_blocks = dgen_output.GetNumberCodeBlocks(separators)

    # Find block to print
    block = dgen_output.FindBlockIndex(filename, 'baselines_%s.h', num_blocks)

    values = {
        'FILE_HEADER': dgen_output.HEADER_BOILERPLATE,
        'IFDEF_NAME': dgen_output.ifdef_name(filename),
        'decoder_name': decoder_name,
    }
    out.write(BASELINE_H_HEADER % values)
    _print_baseline_headers(
        GetBaselineDecodersBlock(decoder, block, separators), out)
    out.write(BASELINE_H_FOOTER % values)