1(**************************************************************************)
2(*                                                                        *)
3(*                                 OCaml                                  *)
4(*                                                                        *)
5(*             Xavier Leroy, projet Cristal, INRIA Rocquencourt           *)
6(*                                                                        *)
7(*   Copyright 2002 Institut National de Recherche en Informatique et     *)
8(*     en Automatique.                                                    *)
9(*                                                                        *)
10(*   All rights reserved.  This file is distributed under the terms of    *)
11(*   the GNU Lesser General Public License version 2.1, with the          *)
12(*   special exception on linking described in the file LICENSE.          *)
13(*                                                                        *)
14(**************************************************************************)
15
16(* Consistency tables: for checking consistency of module CRCs *)
17
18type t
19
20val create: unit -> t
21
22val clear: t -> unit
23
24val check: t -> string -> Digest.t -> string -> unit
25      (* [check tbl name crc source]
26           checks consistency of ([name], [crc]) with infos previously
27           stored in [tbl].  If no CRC was previously associated with
28           [name], record ([name], [crc]) in [tbl].
29           [source] is the name of the file from which the information
30           comes from.  This is used for error reporting. *)
31
32val check_noadd: t -> string -> Digest.t -> string -> unit
33      (* Same as [check], but raise [Not_available] if no CRC was previously
34           associated with [name]. *)
35
36val set: t -> string -> Digest.t -> string -> unit
37      (* [set tbl name crc source] forcefully associates [name] with
38         [crc] in [tbl], even if [name] already had a different CRC
39         associated with [name] in [tbl]. *)
40
41val source: t -> string -> string
42      (* [source tbl name] returns the file name associated with [name]
43         if the latter has an associated CRC in [tbl].
44         Raise [Not_found] otherwise. *)
45
46val extract: string list -> t -> (string * Digest.t option) list
47      (* [extract tbl names] returns an associative list mapping each string
48         in [names] to the CRC associated with it in [tbl]. If no CRC is
49         associated with a name then it is mapped to [None]. *)
50
51val filter: (string -> bool) -> t -> unit
52      (* [filter pred tbl] removes from [tbl] table all (name, CRC) pairs
53         such that [pred name] is [false]. *)
54
55exception Inconsistency of string * string * string
56      (* Raised by [check] when a CRC mismatch is detected.
57         First string is the name of the compilation unit.
58         Second string is the source that caused the inconsistency.
59         Third string is the source that set the CRC. *)
60
61exception Not_available of string
62      (* Raised by [check_noadd] when a name doesn't have an associated CRC. *)
63