add CCFormat.{newline,substring}

This commit is contained in:
Simon Cruanes 2017-04-18 21:19:37 +02:00
parent f294ce1634
commit fc6682b1c1
2 changed files with 16 additions and 0 deletions

View file

@ -39,6 +39,11 @@ let nativeint fmt n = Format.fprintf fmt "%nd" n
let string_quoted fmt s = Format.fprintf fmt "\"%s\"" s
let flush = Format.pp_print_flush
let newline = Format.pp_force_newline
let substring out (s,i,len): unit =
string out (String.sub s i len)
let list ?(sep=return ",@ ") pp fmt l =
let rec pp_list l = match l with
| x::((_::_) as l) ->

View file

@ -23,6 +23,17 @@ val bool : bool printer
val float3 : float printer (* 3 digits after . *)
val float : float printer
val newline : unit printer
(** Force newline (see {!Format.pp_force_newline})
@since NEXT_RELEASE *)
val substring : (string * int * int) printer
(** Print the substring [(s,i,len)], where [i] is the offset
in [s] and [len] the number of bytes in the substring.
@raise Invalid_argument if the triple [(s,i,len)] does not
describe a proper substring.
@since NEXT_RELEASE *)
val char : char printer (** @since 0.14 *)
val int32 : int32 printer (** @since 0.14 *)
val int64 : int64 printer (** @since 0.14 *)