Frama-C API - Rich_text
Text with Tags
val size : message -> intval char_at : message -> int -> charval string : message -> stringval substring : message -> int -> int -> stringval tags_at : message -> int -> (Stdlib.Format.stag * int * int) listReturns the list of tags at the given position. Inner tags come first, outer tags last.
val visit : ?output:(string -> int -> int -> unit) -> ?open_tag:(Stdlib.Format.stag -> int -> int -> unit) -> ?close_tag:(Stdlib.Format.stag -> int -> int -> unit) -> message -> unitVisit the message, with depth-first recursion on tags. All methods are called with text or tag, position and length.
val pretty : ?vbox:int -> Stdlib.Format.formatter -> message -> unitPretty-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
Buffer for creating messages.
The buffer grows on demand, but is protected against huge messages. 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 -> bufferCreate 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 add_char : buffer -> char -> unitBuffer-like
val add_string : buffer -> string -> unitBuffer-like
val add_substring : buffer -> string -> int -> int -> unitBuffer-like
val formatter : buffer -> Stdlib.Format.formatterval bprintf : buffer -> ('a, Stdlib.Format.formatter, unit) Stdlib.format -> 'aval kprintf : (Stdlib.Format.formatter -> 'a) -> buffer -> ('b, Stdlib.Format.formatter, unit, 'a) Stdlib.format4 -> 'bval contents : buffer -> stringSimilar to Buffer.contents
val sub : buffer -> int -> int -> stringSimilar to Buffer.sub
val range : buffer -> int -> int -> stringSub-string with range. range b p q is sub b p (q+1-p)
val trim : buffer -> int * intRange of non-blank leading and trailing characters.
val shrink : buffer -> unitResize the buffer to roughly fit its actual content.
val truncate : buffer -> int -> booltruncate buffer size truncates the content of buffer if longer than size characters. Returns true if the buffer has been truncated.
Printer
