source: Deliverables/D2.2/8051/src/utilities/misc.mli @ 486

Last change on this file since 486 was 486, checked in by ayache, 9 years ago

Deliverable D2.2

File size: 2.1 KB
RevLine 
[486]1(** This module extends the standard library of Objective Caml. *)
2
3module LexingExt : sig
4
5  (** [new_line lexbuf] update lexbuf to increment its line
6      counter. *)
7  val new_line : Lexing.lexbuf -> unit
8
9end
10
11module 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
45end
46
47module 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
53end
54
55module 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
66end
67
68
Note: See TracBrowser for help on using the repository browser.