]> matita.cs.unibo.it Git - pkg-cerco/frama-c-cost-plugin.git/blob - wrapper/misc.mli
Imported Upstream version 0.1
[pkg-cerco/frama-c-cost-plugin.git] / wrapper / misc.mli
1 (** This module extends the standard library of Objective Caml. *)
2
3 module LexingExt : sig
4
5   (** [new_line lexbuf] update lexbuf to increment its line 
6       counter. *)
7   val new_line : Lexing.lexbuf -> unit
8
9 end
10
11 module ListExt : sig
12
13   (** [inv_assoc l] inverses a bijective associative list [l]. *)
14   val inv_assoc : ('a * 'b) list -> ('b * 'a) list
15
16   exception EmptyList
17
18   (** [last l] returns the last element of a list. 
19       Raise [EmptyList] if there is no such thing in [l]. *)
20   val last : 'a list -> 'a
21
22   (** [cut_last l] returns the last element of a list [l] and the
23       elements that come before it in [l].
24       Raise [EmptyList] if there is no such thing in [l]. *)
25   val cut_last : 'a list -> 'a * 'a list
26
27   (** [multi_set_of_list l] returns an associative list that 
28       relates every element of [l] to its frequency in [l]. *)
29   val multi_set_of_list : 'a list -> ('a * int) list
30
31   (** [hashtbl_of_assoc l] converts an associative list into 
32       an hash table. *)
33   val hashtbl_of_assoc : ('a * 'b) list -> ('a, 'b) Hashtbl.t
34
35   (** [assoc_diff l1 l2] returns the difference between two
36       associative lists. *)
37   val assoc_diff : ('a * 'b) list -> ('a * 'b) list 
38     -> ('a * ('b option * 'b option)) list
39
40   (** [transitive_forall2 p l] checks that the binary predicate [p] is 
41       true between each successive elements of [l]. If this is false,
42       the function returns the first pair of elements that falsify [p]. *)
43   val transitive_forall2 : ('a -> 'a -> bool) -> 'a list -> ('a * 'a) option
44
45 end
46
47 module ArgExt : sig
48
49   (** [extra_doc s] adds an extra line of documentation for an
50       Arg.spec row. *)
51   val extra_doc : string -> (Arg.key * Arg.spec * Arg.doc)
52
53 end
54
55 module SysExt : sig
56
57   (** [safe_remove filename] deletes a file named [filename], 
58       but do not crash if a system error happens. (For instance,
59       if the file does not exist.) *)
60   val safe_remove : string -> unit
61
62   (** [alternative filename] finds an alternative name different
63       from [filename] that is not already used. *)
64   val alternative : string -> string
65
66 end
67
68
69 val fresh_file : string -> string -> string
70
71 val fresh_base : string -> string list -> string
72
73 val repeat : int -> ('a -> 'a) -> 'a -> 'a