Project

General

Profile

Download (928 Bytes) Statistics
| Branch: | Tag: | Revision:
1
open Utils
2
open Basetypes
3

    
4
(* Module to manipulate set of active states.
5

    
6
   It relies on sets of path to represent active ones. *)
7

    
8
(*******************************)
9
module Vars = struct
10
  include Set.Make (struct
11
    type t = path_t
12

    
13
    let compare = compare
14
  end)
15

    
16
  let pp_set fmt rho =
17
    Format.(fprintf fmt "@[<v 0>%a@ @]" (pp_print_list pp_path) (elements rho))
18
end
19

    
20
module Env = struct
21
  include Map.Make (struct
22
    type t = path_t
23

    
24
    let compare = compare
25
  end)
26

    
27
  let from_set s default = Vars.fold (fun e m -> add e default m) s empty
28

    
29
  let find a b =
30
    try find a b
31
    with Not_found ->
32
      Format.printf "Looking for %a@." pp_path a;
33
      raise Not_found
34

    
35
  let keys a = fold (fun key _ -> Vars.add key) a Vars.empty
36

    
37
  let pp_env fmt rho =
38
    Format.(fprintf fmt "@[<v 0>%a@ @]"
39
              (pp_print_list (fun fmt (p, b) -> fprintf fmt "%a -> %b" pp_path p b))
40
              (bindings rho))
41
end
(1-1/6)