Version 0.0.1
[guestfs-browser.git] / utils.mli
index f2a00db..0df3a43 100644 (file)
--- a/utils.mli
+++ b/utils.mli
 
 (** 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. *)