2017-11-27 09:13:12 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2018-02-06 00:17:03 +04:00
|
|
|
(* Copyright (c) 2014 - 2018. *)
|
2017-11-27 09:13:12 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
module Infix = struct
|
|
|
|
|
|
|
|
let (<<) g f = fun a -> g (f a)
|
|
|
|
|
|
|
|
let (--) i j =
|
|
|
|
let rec loop acc j =
|
|
|
|
if j < i then acc else loop (j :: acc) (pred j) in
|
|
|
|
loop [] j
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
let display_paragraph ppf description =
|
|
|
|
Format.fprintf ppf "@[%a@]"
|
|
|
|
(Format.pp_print_list ~pp_sep:Format.pp_print_newline
|
|
|
|
(fun ppf line ->
|
|
|
|
Format.pp_print_list ~pp_sep:Format.pp_print_space
|
|
|
|
(fun ppf w ->
|
|
|
|
(* replace by real spaces... *)
|
|
|
|
Format.fprintf ppf "%s@ "
|
|
|
|
(Stringext.replace_all ~pattern:"\xC2\xA0" ~with_:" " w))
|
|
|
|
ppf
|
|
|
|
(TzString.split ' ' line)))
|
|
|
|
(TzString.split ~dup:false '\n' description)
|
|
|
|
|
|
|
|
let finalize f g = try let res = f () in g (); res with exn -> g (); raise exn
|