Project

General

Profile

Download (1014 Bytes) Statistics
| Branch: | Tag: | Revision:
1
open Lustrec
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
(*******************************)
10
module Vars =
11
struct
12
  include Set.Make (struct type t = path_t let compare = compare end)
13

    
14
  let pp_set fmt rho =
15
    Format.fprintf fmt "@[<v 0>%a@ @]"
16
      (Utils.fprintf_list ~sep:"@ "
17
	 (fun fmt p -> Format.fprintf fmt "%a" pp_path p))
18
      (elements rho)
19
end
20

    
21
module Env =
22
struct
23
  include Map.Make (struct type t = path_t let compare = compare end)
24

    
25
  let from_set s default =
26
    Vars.fold (fun e m -> add e default m ) s empty
27
      
28
  let find a b =
29
    try 
30
      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 =
36
    fold (fun key _ -> Vars.add key) a Vars.empty
37

    
38
  let pp_env fmt rho =
39
    Format.fprintf fmt "@[<v 0>%a@ @]"
40
      (Utils.fprintf_list ~sep:"@ "
41
	 (fun fmt (p,b) -> Format.fprintf fmt "%a -> %b" pp_path p b))
42
      (bindings rho)
43
end
44

    
45

    
(2-2/4)