Consistency
[llpp.git] / utils.ml
blob4aaad3677ff82bcb3bd2154c8dd7cad217af3577
1 let tempfailureretry f a =
2 let rec g () =
3 try f a with Unix.Unix_error (Unix.EINTR, _, _) -> g ()
4 in g ()
5 ;;
7 external cloexec : Unix.file_descr -> unit = "ml_cloexec";;
8 external hasdata : Unix.file_descr -> bool = "ml_hasdata";;
9 external toutf8 : int -> string = "ml_keysymtoutf8";;
10 external mbtoutf8 : string -> string = "ml_mbtoutf8";;
12 let dolog fmt = Format.kprintf prerr_endline fmt;;
14 let exntos = function
15 | Unix.Unix_error (e, s, a) -> Printf.sprintf "%s(%s) : %s (%d)"
16 s a (Unix.error_message e) (Obj.magic e)
17 | exn -> Printexc.to_string exn;
20 let error fmt = Printf.kprintf failwith fmt;;
22 module IntSet = Set.Make (struct type t = int let compare = (-) end);;