(* Guestfs Browser. * Copyright (C) 2010 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *) (** 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 : 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. 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, unit, string, unit) format4 -> 'a (** A printf-like function for writing debugging messages. *) 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. *)