src: Include <libxml/parser.h>
[virt-top.git] / src / utils.mli
1 (* 'top'-like tool for libvirt domains.
2    (C) Copyright 2007-2009 Richard W.M. Jones, Red Hat Inc.
3    http://libvirt.org/
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19    This file contains utility functions.
20 *)
21
22 (* Filename concatenation. *)
23 val (//) : string -> string -> string
24
25 (* failwithf is a printf-like version of failwith. *)
26 val failwithf : ('a, unit, string, 'b) format4 -> 'a
27
28 (* Return the list of integers [a..b] (inclusive). *)
29 val range : int -> int -> int list
30
31 (* Read a configuration file as a list of (lineno, key, value) pairs.
32  * If the config file is missing this returns an empty list.
33  *)
34 val read_config_file : string -> (int * string * string) list
35
36 (* Pad or truncate a string to a fixed width. *)
37 val pad : int -> string -> string
38
39 (* Int64 operators for convenience. *)
40 val (+^) : int64 -> int64 -> int64
41 val (-^) : int64 -> int64 -> int64
42 val ( *^ ) : int64 -> int64 -> int64
43 val (/^) : int64 -> int64 -> int64
44
45 (* Utility functions for formating numbers as short strings. *)
46 module Show : sig
47   val percent : float -> string
48   val int64_option : int64 option -> string
49   val int64 : int64 -> string
50   val time : int64 -> string
51 end