X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=utils.mli;h=0df3a437f223a6037b43424d8302f5a509892d94;hb=refs%2Ftags%2F0.0.1;hp=f2a00db131b14ade88a43a5eee470f49ae5a3afa;hpb=bbfe03c47f1d7f03c3e6c0cab9e4f500f588c80a;p=guestfs-browser.git diff --git a/utils.mli b/utils.mli index f2a00db..0df3a43 100644 --- a/utils.mli +++ b/utils.mli @@ -18,18 +18,37 @@ (** General-purpose utility code used everywhere. *) +val (+^) : int64 -> int64 -> int64 +val (-^) : int64 -> int64 -> int64 +val ( *^ ) : int64 -> int64 -> int64 +val (/^) : int64 -> int64 -> int64 + (** Int64 arithmetic operators. *) + type ('a, 'b) either = Left of 'a | Right of 'b (** A value which is either an ['a] or a ['b], just like Haskell's "Either" type. *) -val verbose : bool ref +val verbose : unit -> bool +val set_verbose_flag : unit -> unit (** If this contains [true] then {!debug} will send debugging - messages to stderr, else debugging messages are dropped. *) + messages to stderr, else debugging messages are dropped. + + This is set through the --verbose command line option. *) + +val write_flag : unit -> bool +val set_write_flag : unit -> unit + (** Writes are prevented unless the user sets this to [true] + through the command line option --write. *) -val debug : ('a, out_channel, unit) format -> 'a +val debug : ('a, unit, string, unit) format4 -> 'a (** A printf-like function for writing debugging messages. *) -val failwith : ('a, out_channel, unit) format -> 'a +val failwith : ('a, unit, string, 'b) format4 -> 'a (** Replacement for standard OCaml [failwith] function. This can take a printf-like argument list, and also logs errors on stderr when verbose is enabled. *) + +val utf8_rarrow : string (** UTF-8 RIGHTWARDS ARROW *) + +val human_size_1k : int64 -> string + (** Convert a number (of 1K blocks) into a human readable string. *)