Commit 96f3dbd3 authored by David Bühler's avatar David Bühler
Browse files

[stdlib] Removes FCMap, und uses stdlib Map instead.

parent 9336917e
......@@ -149,8 +149,6 @@ ML_LINT_KO+=src/libraries/project/state_topological.mli
ML_LINT_KO+=src/libraries/stdlib/FCBuffer.ml
ML_LINT_KO+=src/libraries/stdlib/FCBuffer.mli
ML_LINT_KO+=src/libraries/stdlib/FCHashtbl.mli
ML_LINT_KO+=src/libraries/stdlib/FCMap.ml
ML_LINT_KO+=src/libraries/stdlib/FCMap.mli
ML_LINT_KO+=src/libraries/stdlib/FCSet.ml
ML_LINT_KO+=src/libraries/stdlib/FCSet.mli
ML_LINT_KO+=src/libraries/stdlib/extlib.ml
......
......@@ -441,7 +441,6 @@ CMO += $(VERY_FIRST_CMO)
LIB_CMO =\
src/libraries/stdlib/transitioning \
src/libraries/stdlib/FCSet \
src/libraries/stdlib/FCMap \
src/libraries/stdlib/FCBuffer \
src/libraries/stdlib/FCHashtbl \
src/libraries/stdlib/extlib \
......
......@@ -171,7 +171,7 @@ struct
(* Find the representative for a node and compress the paths in the process *)
module Heq = Hashtbl.Make (Elts)
module Iter_sorted = FCMap.Make(Elts)
module Iter_sorted = Map.Make(Elts)
module Hsyn = Hashtbl.Make(H)
......
......@@ -280,7 +280,7 @@ let merge_funspec s1 s2 =
(** {2 Getting annotations} *)
(**************************************************************************)
module StmtContractMap = FCMap.Make(Datatype.String.Set)
module StmtContractMap = Transitioning.Stdlib.Map.Make(Datatype.String.Set)
let is_same_behavior_set l1 l2 =
Datatype.String.Set.(equal (of_list l1) (of_list l2))
......
......@@ -310,7 +310,7 @@ let binop_of_rel = function
module Lenv = struct
(* locals: logic variables (e.g. quantified variables in \forall, \exists) *)
module Smap = FCMap.Make(String)
module Smap = Map.Make(String)
type t = {
local_vars: Cil_types.logic_var Smap.t;
......
......@@ -294,7 +294,7 @@ module type Set = sig
end
module type Map = sig
include FCMap.S
include Map.S
module Key: S with type t = key
module Make(Data: S) : S with type t = Data.t t
end
......@@ -1433,7 +1433,7 @@ end
(* ****************************************************************************)
module Map
(M: FCMap.S)(Key: S with type t = M.key)(Info: Functor_info) =
(M: Map.S)(Key: S with type t = M.key)(Info: Functor_info) =
struct
let () = check Key.equal "equal" Key.name Info.module_name
......@@ -1677,7 +1677,7 @@ module With_collections(X: S)(Info: Functor_info) = struct
module Map =
Map
(FCMap.Make(D))
(Transitioning.Stdlib.Map.Make(D))
(D)
(struct let module_name = Info.module_name ^ ".Map" end)
......
......@@ -240,7 +240,7 @@ end
(** A standard OCaml map signature extended with datatype operations. *)
module type Map = sig
include FCMap.S
include Map.S
module Key: S with type t = key
(** Datatype for the keys of the map. *)
......@@ -638,7 +638,7 @@ module Set
Set with type t = S.t and type elt = E.t
module Map
(M: FCMap.S)(Key: S with type t = M.key)(Info: Functor_info) :
(M: Map.S)(Key: S with type t = M.key)(Info: Functor_info) :
Map with type 'a t = 'a M.t and type key = M.key and module Key = Key
module Hashtbl
......
......@@ -52,7 +52,7 @@ module Make(H: Hashtbl.HashedType) : S with type key = H.t = struct
let fold_sorted ?(cmp=Transitioning.Stdlib.compare) f h acc =
let module Aux = struct type t = key let compare = cmp end in
let module M = FCMap.Make(Aux) in
let module M = Map.Make(Aux) in
let add k v m =
try
let l = v :: M.find k m in
......
(*****************************************************************************)
(* *)
(* This file was originally part of Objective Caml *)
(* *)
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
(* *)
(* Copyright (C) 1996 INRIA *)
(* INRIA (Institut National de Recherche en Informatique et en *)
(* Automatique) *)
(* *)
(* All rights reserved. *)
(* *)
(* This file is distributed under the terms of the GNU Library General *)
(* Public License version 2, with the special exception on linking *)
(* described below. See the GNU Library General Public License version *)
(* 2 for more details (enclosed in the file licenses/LGPLv2). *)
(* *)
(* As a special exception to the GNU Library General Public License, *)
(* you may link, statically or dynamically, a "work that uses the Library" *)
(* with a publicly distributed version of the Library to *)
(* produce an executable file containing portions of the Library, and *)
(* distribute that executable file under terms of your choice, without *)
(* any of the additional requirements listed in clause 6 of the GNU *)
(* Library General Public License. *)
(* By "a publicly distributed version of the Library", *)
(* we mean either the unmodified Library as *)
(* distributed by INRIA, or a modified version of the Library that is *)
(* distributed under the conditions defined in clause 2 of the GNU *)
(* Library General Public License. This exception does not however *)
(* invalidate any other reasons why the executable file might be *)
(* covered by the GNU Library General Public License. *)
(* *)
(* File modified by CEA (Commissariat à l'énergie atomique et aux *)
(* énergies alternatives). *)
(* *)
(*****************************************************************************)
module type S =
sig
type key
type +'a t
val empty: 'a t
val is_empty: 'a t -> bool
val mem: key -> 'a t -> bool
val add: key -> 'a -> 'a t -> 'a t
val singleton: key -> 'a -> 'a t
val remove: key -> 'a t -> 'a t
val merge: (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
val compare: ('a -> 'a -> int) -> 'a t -> 'a t -> int
val equal: ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val iter: (key -> 'a -> unit) -> 'a t -> unit
val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
val for_all: (key -> 'a -> bool) -> 'a t -> bool
val exists: (key -> 'a -> bool) -> 'a t -> bool
val filter: (key -> 'a -> bool) -> 'a t -> 'a t
val partition: (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val cardinal: 'a t -> int
val bindings: 'a t -> (key * 'a) list
val min_binding: 'a t -> (key * 'a)
val max_binding: 'a t -> (key * 'a)
val choose: 'a t -> (key * 'a)
val split: key -> 'a t -> 'a t * 'a option * 'a t
val find: key -> 'a t -> 'a
val find_opt: key -> 'a t -> 'a option
val map: ('a -> 'b) -> 'a t -> 'b t
val mapi: (key -> 'a -> 'b) -> 'a t -> 'b t
end
module Make(X: Map.OrderedType) = struct
include Map.Make(X)
let find_opt k m =
match find k m with
| exception Not_found -> None
| v -> Some v
end
(*****************************************************************************)
(* *)
(* This file was originally part of Objective Caml *)
(* *)
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
(* *)
(* Copyright (C) 1996 INRIA *)
(* INRIA (Institut National de Recherche en Informatique et en *)
(* Automatique) *)
(* *)
(* All rights reserved. *)
(* *)
(* This file is distributed under the terms of the GNU Library General *)
(* Public License version 2, with the special exception on linking *)
(* described below. See the GNU Library General Public License version *)
(* 2 for more details (enclosed in the file licenses/LGPLv2). *)
(* *)
(* As a special exception to the GNU Library General Public License, *)
(* you may link, statically or dynamically, a "work that uses the Library" *)
(* with a publicly distributed version of the Library to *)
(* produce an executable file containing portions of the Library, and *)
(* distribute that executable file under terms of your choice, without *)
(* any of the additional requirements listed in clause 6 of the GNU *)
(* Library General Public License. *)
(* By "a publicly distributed version of the Library", *)
(* we mean either the unmodified Library as *)
(* distributed by INRIA, or a modified version of the Library that is *)
(* distributed under the conditions defined in clause 2 of the GNU *)
(* Library General Public License. This exception does not however *)
(* invalidate any other reasons why the executable file might be *)
(* covered by the GNU Library General Public License. *)
(* *)
(* File modified by CEA (Commissariat à l'énergie atomique et aux *)
(* énergies alternatives). *)
(* *)
(*****************************************************************************)
(** Association tables over ordered types.
This signatures is a partial copy of the signature of [Map.S] of
OCaml's standard library, which we extend with some new functions.
*)
module type S =
sig
type key
(** The type of the map keys. *)
type (+'a) t
(** The type of maps from type [key] to type ['a]. *)
val empty: 'a t
(** The empty map. *)
val is_empty: 'a t -> bool
(** Test whether a map is empty or not. *)
val mem: key -> 'a t -> bool
(** [mem x m] returns [true] if [m] contains a binding for [x],
and [false] otherwise. *)
val add: key -> 'a -> 'a t -> 'a t
(** [add x y m] returns a map containing the same bindings as
[m], plus a binding of [x] to [y]. If [x] was already bound
in [m], its previous binding disappears. *)
val singleton: key -> 'a -> 'a t
(** [singleton x y] returns the one-element map that contains a binding [y]
for [x].
@since 3.12.0
*)
val remove: key -> 'a t -> 'a t
(** [remove x m] returns a map containing the same bindings as
[m], except for [x] which is unbound in the returned map. *)
val merge:
(key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t
(** [merge f m1 m2] computes a map whose keys is a subset of keys of [m1]
and of [m2]. The presence of each such binding, and the corresponding
value, is determined with the function [f].
@since 3.12.0
*)
val compare: ('a -> 'a -> int) -> 'a t -> 'a t -> int
(** Total ordering between maps. The first argument is a total ordering
used to compare data associated with equal keys in the two maps. *)
val equal: ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
(** [equal cmp m1 m2] tests whether the maps [m1] and [m2] are
equal, that is, contain equal keys and associate them with
equal data. [cmp] is the equality predicate used to compare
the data associated with the keys. *)
val iter: (key -> 'a -> unit) -> 'a t -> unit
(** [iter f m] applies [f] to all bindings in map [m].
[f] receives the key as first argument, and the associated value
as second argument. The bindings are passed to [f] in increasing
order with respect to the ordering over the type of the keys. *)
val fold: (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
(** [fold f m a] computes [(f kN dN ... (f k1 d1 a)...)],
where [k1 ... kN] are the keys of all bindings in [m]
(in increasing order), and [d1 ... dN] are the associated data. *)
val for_all: (key -> 'a -> bool) -> 'a t -> bool
(** [for_all p m] checks if all the bindings of the map
satisfy the predicate [p].
@since 3.12.0
*)
val exists: (key -> 'a -> bool) -> 'a t -> bool
(** [exists p m] checks if at least one binding of the map
satisfy the predicate [p].
@since 3.12.0
*)
val filter: (key -> 'a -> bool) -> 'a t -> 'a t
(** [filter p m] returns the map with all the bindings in [m]
that satisfy predicate [p].
@since 3.12.0
*)
val partition: (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
(** [partition p m] returns a pair of maps [(m1, m2)], where
[m1] contains all the bindings of [s] that satisfy the
predicate [p], and [m2] is the map with all the bindings of
[s] that do not satisfy [p].
@since 3.12.0
*)
val cardinal: 'a t -> int
(** Return the number of bindings of a map.
@since 3.12.0
*)
val bindings: 'a t -> (key * 'a) list
(** Return the list of all bindings of the given map.
The returned list is sorted in increasing order with respect
to the ordering [Ord.compare], where [Ord] is the argument
given to {!Map.Make}.
@since 3.12.0
*)
val min_binding: 'a t -> (key * 'a)
(** Return the smallest binding of the given map
(with respect to the [Ord.compare] ordering), or raise
[Not_found] if the map is empty.
@since 3.12.0
*)
val max_binding: 'a t -> (key * 'a)
(** Same as {!min_binding}, but returns the largest binding
of the given map.
@since 3.12.0
*)
val choose: 'a t -> (key * 'a)
(** Return one binding of the given map, or raise [Not_found] if
the map is empty. Which binding is chosen is unspecified,
but equal bindings will be chosen for equal maps.
@since 3.12.0
*)
val split: key -> 'a t -> 'a t * 'a option * 'a t
(** [split x m] returns a triple [(l, data, r)], where
[l] is the map with all the bindings of [m] whose key
is strictly less than [x];
[r] is the map with all the bindings of [m] whose key
is strictly greater than [x];
[data] is [None] if [m] contains no binding for [x],
or [Some v] if [m] binds [v] to [x].
@since 3.12.0
*)
val find: key -> 'a t -> 'a
(** [find x m] returns the current binding of [x] in [m],
or raises [Not_found] if no such binding exists. *)
val find_opt: key -> 'a t -> 'a option
(** [find x m] returns the current binding of [x] in [m],
or return [None] if no such binding exists. *)
val map: ('a -> 'b) -> 'a t -> 'b t
(** [map f m] returns a map with same domain as [m], where the
associated value [a] of all bindings of [m] has been
replaced by the result of the application of [f] to [a].
The bindings are passed to [f] in increasing order
with respect to the ordering over the type of the keys. *)
val mapi: (key -> 'a -> 'b) -> 'a t -> 'b t
(** Same as {!map}, but the function receives as arguments both the
key and the associated value for each binding of the map. *)
end
module Make (Ord : Map.OrderedType) : S with type key = Ord.t
(** Functor building an implementation of the map structure
given a totally ordered type. *)
......@@ -30,6 +30,7 @@ module Stdlib = struct
let min_int = min_int
let max_int = max_int
let flush = flush
module Map = Map
end
[@@@ warning "-3"]
......
......@@ -43,6 +43,7 @@ module Stdlib: sig
val min_int: int
val max_int: int
val flush: out_channel -> unit
module Map: module type of Map
end
(** 4.08 *)
......
......@@ -58,7 +58,7 @@ module SortCalls = struct
good criterion is left *)
else r
end
module MapStmtCalls = FCMap.Make(SortCalls)
module MapStmtCalls = Map.Make(SortCalls)
let iter_callwise_calls_sorted f =
let hkf = Kernel_function.Hashtbl.create 17 in
......
......@@ -269,7 +269,7 @@ module VarinfoByName = struct
end
(** Map and sets of varinfos sorted by name (and not by ids) *)
module VInfoMap = FCMap.Make (VarinfoByName)
module VInfoMap = Map.Make (VarinfoByName)
module VInfoSet = FCSet.Make (VarinfoByName)
......
......@@ -96,7 +96,7 @@ end
(** Local varinfo map and set where the comparison function is the
lexicographic one on their respective names. *)
module VInfoMap: FCMap.S with type key = Cil_types.varinfo
module VInfoMap: Map.S with type key = Cil_types.varinfo
module VInfoSet: FCSet.S with type elt = Cil_types.varinfo
;;
......
......@@ -291,7 +291,7 @@ module Component = struct
(* not optimal implementation: no memoization (bts#006) *)
module M = FCMap.Make(NodeKf)
module M = Map.Make(NodeKf)
type fwd_kind = Impact | Security
......
......@@ -46,7 +46,7 @@ let compare_gui_callstack cs1 cs2 = match cs1, cs2 with
| _, GC_Single _ -> 1
| GC_Single _, _ -> -1
module GCallstackMap = FCMap.Make(struct
module GCallstackMap = Map.Make(struct
type t = gui_callstack
let compare = compare_gui_callstack
end)
......
......@@ -29,7 +29,7 @@ type gui_callstack =
val hash_gui_callstack : gui_callstack -> int
val compare_gui_callstack : gui_callstack -> gui_callstack -> int
module GCallstackMap : FCMap.S with type key = gui_callstack
module GCallstackMap : Map.S with type key = gui_callstack
type gui_selection =
......
......@@ -28,7 +28,7 @@ open Qed
open Qed.Logic
open Lang
open Lang.F
module FunMap = FCMap.Make(Lang.Fun)
module FunMap = Map.Make(Lang.Fun)
(* -------------------------------------------------------------------------- *)
(* --- Kernel Interface --- *)
......
......@@ -300,7 +300,7 @@ let configure_driver setup driver () =
(* --- Access --- *)
(* -------------------------------------------------------------------------- *)
module COMPILERS = FCMap.Make
module COMPILERS = Map.Make
(struct
type t = setup * driver
let compare (s,d) (s',d') =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment