summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2014-05-07 00:34:20 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2014-05-07 00:34:20 +0000
commit1ce29d9bfca4e5f8a6f76c8f1d04521abc2dafc6 (patch)
treebc9cf016ae76d9191fa4b02ac83cf4239e2f93d6 /utils
parent3dd57a94e308eb8222b09da3b939667b9773ccf4 (diff)
downloadocaml-1ce29d9bfca4e5f8a6f76c8f1d04521abc2dafc6.tar.gz
re-commit Leo's weak-dependencies pull request
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14755 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'utils')
-rw-r--r--utils/config.mlp14
-rw-r--r--utils/consistbl.ml15
-rw-r--r--utils/consistbl.mli7
3 files changed, 24 insertions, 12 deletions
diff --git a/utils/config.mlp b/utils/config.mlp
index e4c0d322a8..db6fd20ed0 100644
--- a/utils/config.mlp
+++ b/utils/config.mlp
@@ -49,15 +49,15 @@ let mkexe = "%%MKEXE%%"
let mkmaindll = "%%MKMAINDLL%%"
let exec_magic_number = "Caml1999X011"
-and cmi_magic_number = "Caml1999I016"
-and cmo_magic_number = "Caml1999O009"
-and cma_magic_number = "Caml1999A010"
-and cmx_magic_number = "Caml1999Y013"
-and cmxa_magic_number = "Caml1999Z012"
+and cmi_magic_number = "Caml1999I017"
+and cmo_magic_number = "Caml1999O010"
+and cma_magic_number = "Caml1999A011"
+and cmx_magic_number = "Caml1999Y014"
+and cmxa_magic_number = "Caml1999Z013"
and ast_impl_magic_number = "Caml1999M016"
and ast_intf_magic_number = "Caml1999N015"
-and cmxs_magic_number = "Caml2007D001"
-and cmt_magic_number = "Caml2012T003"
+and cmxs_magic_number = "Caml2007D002"
+and cmt_magic_number = "Caml2012T004"
let load_path = ref ([] : string list)
diff --git a/utils/consistbl.ml b/utils/consistbl.ml
index 4bc42dc5b0..6adaf41122 100644
--- a/utils/consistbl.ml
+++ b/utils/consistbl.ml
@@ -40,8 +40,19 @@ let set tbl name crc source = Hashtbl.add tbl name (crc, source)
let source tbl name = snd (Hashtbl.find tbl name)
-let extract tbl =
- Hashtbl.fold (fun name (crc, auth) accu -> (name, crc) :: accu) tbl []
+let extract l tbl =
+ List.fold_left
+ (fun assc name ->
+ try
+ ignore (List.assoc name assc);
+ assc
+ with Not_found ->
+ try
+ let (crc, _) = Hashtbl.find tbl name in
+ (name, Some crc) :: assc
+ with Not_found ->
+ (name, None) :: assc)
+ [] l
let filter p tbl =
let to_remove = ref [] in
diff --git a/utils/consistbl.mli b/utils/consistbl.mli
index d3f2afcec9..012bd734fa 100644
--- a/utils/consistbl.mli
+++ b/utils/consistbl.mli
@@ -40,9 +40,10 @@ val source: t -> string -> string
if the latter has an associated CRC in [tbl].
Raise [Not_found] otherwise. *)
-val extract: t -> (string * Digest.t) list
- (* Return all bindings ([name], [crc]) contained in the given
- table. *)
+val extract: string list -> t -> (string * Digest.t option) list
+ (* [extract tbl names] returns an associative list mapping each string
+ in [names] to the CRC associated with it in [tbl]. If no CRC is
+ associated with a name then it is mapped to [None]. *)
val filter: (string -> bool) -> t -> unit
(* [filter pred tbl] removes from [tbl] table all (name, CRC) pairs