package frama-c

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Text with Tags

type message

Message with tags

val size : message -> int
val char_at : message -> int -> char
val string : message -> string
val substring : message -> int -> int -> string
val tags_at : message -> int -> (Format.stag * int * int) list

Returns the list of tags at the given position. Inner tags come first, outer tags last.

val visit : ?output:(string -> int -> int -> unit) -> ?open_tag:(Format.stag -> int -> int -> unit) -> ?close_tag:(Format.stag -> int -> int -> unit) -> message -> unit

Visit the message, with depth-first recursion on tags. All methods are called with text or tag, position and length.

val pretty : ?vbox:int -> Format.formatter -> message -> unit

Pretty-print the message onto the given formatter, with the tags. The original message has been already laidout with respect to horizontal and vertical boxes, and this layout will be output as-it-is into the formatter.

Here, you have two different strategies to render the message properly. If ~vbox is specified, a vertical box is opened around the message, and newlines are emitted with a "@\n" and the given indentation. Otherwise, no box is used and newlines are emitted as "\n", which only makes sense if there is no current indentation in the output formatter.

Message Buffer

type buffer

Buffer for creating messages.

The buffer grows on demand, but is protected against huge mesages. Maximal size is around 2 billions ASCII characters, which sould be enough to store more than 25kloc source text.

val create : ?indent:int -> ?margin:int -> unit -> buffer

Create a buffer.

The right-margin is set to ~margin and maximum indentation to ~indent. Default values are those of Format.make_formatter, which are ~indent:68 and ~margin:78 in OCaml 4.05.

val message : buffer -> message

Buffer contents, with its formatting tags.

val add_char : buffer -> char -> unit

Buffer-like

val add_string : buffer -> string -> unit

Buffer-like

val add_substring : buffer -> string -> int -> int -> unit

Buffer-like

val formatter : buffer -> Format.formatter
val bprintf : buffer -> ('a, Format.formatter, unit) format -> 'a
val kprintf : (Format.formatter -> 'a) -> buffer -> ('b, Format.formatter, unit, 'a) format4 -> 'b
val contents : buffer -> string

Similar to Buffer.contents

val sub : buffer -> int -> int -> string

Similar to Buffer.sub

val range : buffer -> int -> int -> string

Sub-string with range. range b p q is sub b p (q+1-p)

val trim : buffer -> int * int

Range of non-blank leading and trailing characters.

val shrink : buffer -> unit

Resize the buffer to roughly fit its actual content.

Printer

val to_string : ?indent:int -> ?margin:int -> ?trim:bool -> (Format.formatter -> 'a -> unit) -> 'a -> string

Dump the formatter into a string. Defaults are ~indent:20, ~margin:40 and ~trim:true.

OCaml

Innovation. Community. Security.