uutil.mli (2125B)
1 (* Unison file synchronizer: src/uutil.mli *) 2 (* Copyright 1999-2020, Benjamin C. Pierce (see COPYING for details) *) 3 4 (* This module collects a number of low-level, Unison-specific utility 5 functions. It is kept separate from the Util module so that that module 6 can be re-used by other programs. *) 7 8 (* Identification *) 9 val myMajorVersion : string 10 val myVersion : string 11 val myName : string 12 val myNameAndVersion : string 13 14 (* Hashing *) 15 val hash2 : int -> int -> int 16 (* Hash function (OCaml 3.x version) *) 17 val hash : 'a -> int 18 19 module type FILESIZE = sig 20 type t 21 val m : t Umarshal.t 22 val zero : t 23 val dummy : t 24 val add : t -> t -> t 25 val sub : t -> t -> t 26 val ofFloat : float -> t 27 val toFloat : t -> float 28 val toString : t -> string 29 val ofInt : int -> t 30 val ofInt64 : int64 -> t 31 val toInt : t -> int 32 val toInt64 : t -> int64 33 val fromStats : Unix.LargeFile.stats -> t 34 val hash : t -> int 35 val percentageOfTotalSize : t -> t -> float 36 end 37 38 module Filesize : FILESIZE 39 40 (* The UI may (if it likes) supply a function to be used to show progress of 41 file transfers. *) 42 module File : 43 sig 44 type t 45 val m : t Umarshal.t 46 val ofLine : int -> t 47 val toLine : t -> int 48 val toString : t -> string 49 val dummy : t 50 end 51 val setProgressPrinter : 52 (File.t -> Filesize.t -> string -> unit) -> unit 53 val showProgress : File.t -> Filesize.t -> string -> unit 54 val setUpdateStatusPrinter : (string -> unit) option -> unit 55 val showUpdateStatus : string -> unit 56 57 (* Utility function to transfer bytes from one file descriptor to another 58 until EOF *) 59 val readWrite : 60 in_channel (* source *) 61 -> out_channel (* target *) 62 -> (int -> unit) (* progress notification *) 63 -> unit 64 65 (* Utility function to transfer a given number of bytes from one file 66 descriptor to another *) 67 val readWriteBounded : 68 in_channel (* source *) 69 -> out_channel (* target *) 70 -> Filesize.t 71 -> (int -> unit) (* progress notification *) 72 -> unit 73 74 (* Escape shell parameters *) 75 val quotes : string -> string