Frama-C API - Rich_text
Text enriched with semantic tags
This module provides a rich text type that represents a string of characters enriched by semantic tags. It is intended to provide a way to store texts that can be output in several format, for instance in html or using ANSI sequences in terminals. When the text is pretty printed, the semantic tags are output in the usual way on the formatter (which can translate the semantic tags to html markup for instance). See Format for more details about semantic tags.
val empty : tempty is the empty text, containing neither plain text nor tags.
val is_empty : t -> boolis_empty text returns true if text is empty. A rich text containing only semantic tags is not considered empty.
val of_string : string -> tof_string s returns a plain text equal to s with no semantic tags.
val size : t -> intlength text returns the number of characters in the text.
val plain : t -> stringplain text returns the plain string in the text (without any tag).
val contains : t -> char -> boolcontains text c returns whether text contains the character c.
val index : t -> char -> intindex text c finds the first index of character c.
truncate ~start_pos ~end_pos text truncate the text text to the range from start_pos (included, default to 0) to end_pos (excluded, default to the text size). All tags outside this range are removed.
Indicates the total available space and the position of the truncation
val pretty : ?truncate:truncation -> ?ellipsis:string -> Stdlib.Format.formatter -> t -> unitpretty fmt text pretty-prints the text onto the given formatter fmt, with the semantic tags. The original text has been already laid out with respect to horizontal and vertical boxes, and this layout will be output as-it-is into the formatter.
val to_string : ?prefix:(Stdlib.Format.formatter -> unit) -> ?suffix:(Stdlib.Format.formatter -> unit) -> ?truncate:truncation -> ?ellipsis:string -> t -> stringPretty prints the text into a string
val need_truncation : ?truncate:truncation -> t -> boolBuffers for building rich text
Buffer for creating rich text.
The buffer grows on demand, but is protected against huge messages. Maximal size is around 2 billions ASCII characters, which should be enough to store more than 25kloc source text.
module Buffer : sig ... endDirect formatting
val sprintf : ?indent:int -> ?margin:int -> ?trim:bool -> ?truncate:truncation -> ?ellipsis:string -> ('a, Stdlib.Format.formatter, unit, string) Stdlib.format4 -> 'aPretty prints to a string.
val mprintf : ?indent:int -> ?margin:int -> ?trim:bool -> ('a, Stdlib.Format.formatter, unit, t) Stdlib.format4 -> 'aPretty prints to a rich text.
