Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / src / tools / stateflow / common / activeStates.ml @ 93119c3f

History | View | Annotate | Download (1001 Bytes)

1
open Basetypes 
2

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

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

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

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

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

    
24
  let from_set s default =
25
    Vars.fold (fun e m -> add e default m ) s empty
26
      
27
  let find a b =
28
    try 
29
      find a b
30
    with Not_found -> (
31
      Format.printf "Looking for %a@." pp_path a ;
32
      raise Not_found
33
    )
34
  let keys a =
35
    fold (fun key _ -> Vars.add key) a Vars.empty
36

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

    
44