Sync with upstream and fix some issue
[llpp/slowscroll.git] / utils.ml
blobddf66de71f11b35bbf6c80b59ec3be457115e685
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;;