2 * Copyright (C) 2012 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 (** Types and utility functions. *)
21 module StringMap : sig
25 val is_empty : 'a t -> bool
26 val mem : key -> 'a t -> bool
27 val add : key -> 'a -> 'a t -> 'a t
28 (*val singleton : key -> 'a -> 'a t*)
29 val remove : key -> 'a t -> 'a t
31 (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t*)
32 val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
33 val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
34 val iter : (key -> 'a -> unit) -> 'a t -> unit
35 val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
36 (*val for_all : (key -> 'a -> bool) -> 'a t -> bool
37 val exists : (key -> 'a -> bool) -> 'a t -> bool
38 val filter : (key -> 'a -> bool) -> 'a t -> 'a t
39 val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
40 val cardinal : 'a t -> int
41 val bindings : 'a t -> (key * 'a) list
42 val min_binding : 'a t -> key * 'a
43 val max_binding : 'a t -> key * 'a
44 val choose : 'a t -> key * 'a
45 val split : key -> 'a t -> 'a t * 'a option * 'a t*)
46 val find : key -> 'a t -> 'a
47 val map : ('a -> 'b) -> 'a t -> 'b t
48 val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
49 val keys : 'a t -> key list
50 val values : 'a t -> 'a list
52 (** A map from string to any type. *)
58 val is_empty : 'a t -> bool
59 val mem : key -> 'a t -> bool
60 val add : key -> 'a -> 'a t -> 'a t
61 (*val singleton : key -> 'a -> 'a t*)
62 val remove : key -> 'a t -> 'a t
64 (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t*)
65 val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
66 val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
67 val iter : (key -> 'a -> unit) -> 'a t -> unit
68 val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
69 (*val for_all : (key -> 'a -> bool) -> 'a t -> bool
70 val exists : (key -> 'a -> bool) -> 'a t -> bool
71 val filter : (key -> 'a -> bool) -> 'a t -> 'a t
72 val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
73 val cardinal : 'a t -> int
74 val bindings : 'a t -> (key * 'a) list
75 val min_binding : 'a t -> key * 'a
76 val max_binding : 'a t -> key * 'a
77 val choose : 'a t -> key * 'a
78 val split : key -> 'a t -> 'a t * 'a option * 'a t*)
79 val find : key -> 'a t -> 'a
80 val map : ('a -> 'b) -> 'a t -> 'b t
81 val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
82 val keys : 'a t -> key list
83 val values : 'a t -> 'a list
85 (** A map from int to any type. *)
87 module BigIntMap : sig
88 type key = Big_int.big_int
91 val is_empty : 'a t -> bool
92 val mem : key -> 'a t -> bool
93 val add : key -> 'a -> 'a t -> 'a t
94 (*val singleton : key -> 'a -> 'a t*)
95 val remove : key -> 'a t -> 'a t
97 (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t*)
98 val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
99 val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
100 val iter : (key -> 'a -> unit) -> 'a t -> unit
101 val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
102 (*val for_all : (key -> 'a -> bool) -> 'a t -> bool
103 val exists : (key -> 'a -> bool) -> 'a t -> bool
104 val filter : (key -> 'a -> bool) -> 'a t -> 'a t
105 val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
106 val cardinal : 'a t -> int
107 val bindings : 'a t -> (key * 'a) list
108 val min_binding : 'a t -> key * 'a
109 val max_binding : 'a t -> key * 'a
110 val choose : 'a t -> key * 'a
111 val split : key -> 'a t -> 'a t * 'a option * 'a t*)
112 val find : key -> 'a t -> 'a
113 val map : ('a -> 'b) -> 'a t -> 'b t
114 val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
115 val keys : 'a t -> key list
116 val values : 'a t -> 'a list
118 (** A map from big_int to any type. *)
120 module StringSet : sig
122 type t = Set.Make(String).t
124 val is_empty : t -> bool
125 val mem : elt -> t -> bool
126 val add : elt -> t -> t
127 val singleton : elt -> t
128 val remove : elt -> t -> t
129 val union : t -> t -> t
130 val inter : t -> t -> t
131 val diff : t -> t -> t
132 val compare : t -> t -> int
133 val equal : t -> t -> bool
134 val subset : t -> t -> bool
135 val iter : (elt -> unit) -> t -> unit
136 val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
137 val for_all : (elt -> bool) -> t -> bool
138 val exists : (elt -> bool) -> t -> bool
139 val filter : (elt -> bool) -> t -> t
140 val partition : (elt -> bool) -> t -> t * t
141 val cardinal : t -> int
142 val elements : t -> elt list
143 val min_elt : t -> elt
144 val max_elt : t -> elt
145 val choose : t -> elt
146 val split : elt -> t -> t * bool * t
148 (** A set of strings. *)
150 val (//) : string -> string -> string
151 (** [dir // file] concatenates directory and file. *)
153 val isalpha : char -> bool
154 val isalnum : char -> bool
155 (** Character tests. *)
157 val filter_map : ('a -> 'b option) -> 'a list -> 'b list
160 val string_of_time_t : ?localtime:bool -> float -> string
161 (** Convert string to time in ISO format. If [~localtime] is true
162 then it uses localtime, else UTC. *)