Frama-C:
Plug-ins:
Libraries:

Frama-C API - Printer_api

Type of AST's extensible printers.

  • since Fluorine-20130401
type block_ctxt =
  1. | Stmt_block of Cil_types.stmt
    (*

    stmt is Block b.

    *)
  2. | Body
    (*

    body of a function.

    *)
  3. | Then_with_else
    (*

    block is the then branch of a conditional that has an else branch.

    *)
  4. | Other
    (*

    block is any other toplevel block of the cfg (then without else, else branch, switch, while, ...

    *)

context in which a block will be printed. useful to decide whether braces are required or not.

Class type for extensible printer

class type extensible_printer_type = object ... end

The class type that a printer must implement.

Types for customizing pretty printers

type line_directive_style =
  1. | Line_comment
    (*

    Before every element, print the line number in comments. This is ignored by processing tools (thus errors are reported on the lines of the CIL output), but useful for visual inspection

    *)
  2. | Line_comment_sparse
    (*

    Like LineComment but only print a line directive for a new source line

    *)
  3. | Line_preprocessor_input
    (*

    Use #line directives

    *)
  4. | Line_preprocessor_output
    (*

    Use # nnn directives (in gcc mode)

    *)

Styles of printing line directives

type state = {
  1. mutable line_directive_style : line_directive_style option;
    (*

    How to print line directives

    *)
  2. mutable print_cil_input : bool;
    (*

    Whether we print something that will only be used as input to Cil's parser. In that case we are a bit more liberal in what we print.

    *)
  3. mutable print_cil_as_is : bool;
    (*

    Whether to print the CIL as they are, without trying to be smart and print nicer code. Normally this is false, in which case the pretty printer will turn the while(1) loops of CIL into nicer loops, will not print empty "else" blocks, etc. There is one case however in which if you turn this on you will get code that does not compile: if you use varargs the __builtin_va_arg function will be printed in its internal form.

    *)
  4. mutable line_length : int;
    (*

    The length used when wrapping output lines. Setting this variable to a large integer will prevent wrapping and make #line directives more accurate.

    *)
  5. mutable warn_truncate : bool;
    (*

    Emit warnings when truncating integer constants (default true)

    *)
}

Functions for pretty printing

module type S_pp = sig ... end
module type S = sig ... end