Project

General

Profile

« Previous | Next » 

Revision ca7ff3f7

Added by LĂ©lio Brun 8 months ago

reformatting

View differences:

src/tools/stateflow/common/activeStates.ml
1
open Basetypes 
1
open Basetypes
2 2

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

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

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

  
12
    let compare = compare
13
  end)
12 14

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

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

  
26
    let compare = compare
27
  end)
28

  
29
  let from_set s default = Vars.fold (fun e m -> add e default m) s empty
23 30

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

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

  
37 39
  let pp_env fmt rho =
38 40
    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
      (Utils.fprintf_list ~sep:"@ " (fun fmt (p, b) ->
42
           Format.fprintf fmt "%a -> %b" pp_path p b))
41 43
      (bindings rho)
42 44
end
43

  
44

  

Also available in: Unified diff