Structure run + Print run
[tatoo.git] / src / run.ml
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                  Lucca Hirschi, ?   *)
4 (*                  ?   *)
5 (*                                                                     *)
6 (*  Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
7 (*  Recherche Scientifique. All rights reserved.  This file is         *)
8 (*  distributed under the terms of the GNU Lesser General Public       *)
9 (*  License, with the special exception on linking described in file   *)
10 (*  ../LICENSE.                                                        *)
11 (*                                                                     *)
12 (***********************************************************************)
13
14 INCLUDE "utils.ml"
15
16 module Node  =
17 struct
18   type t = int
19   let hash n = n
20   let compare n1 n2 = n1 - n2
21   let equal n1 n2 = n1 = n2
22 end
23   
24 module NodeHash = Hashtbl.Make (Node)
25   
26 type t = (StateSet.t*StateSet.t) NodeHash.t
27 (** Map from node to query and recognizing states *)
28     
29 let compute tree asta =
30   let size_tree = 10000 in              (* todo *)
31   let map = NodeHash.create size_tree in
32   
33   
34   map
35     
36 let print fmt run =
37   let print_d_set fmt (s_1,s_2) = 
38     Format.fprintf fmt "@[<hov 0>(%a,@ %a)@]"
39       StateSet.print s_1 StateSet.print s_2 in
40   let print_map fmt run = 
41     let pp = Format.fprintf fmt in
42     if NodeHash.length run = 0
43     then Format.fprintf fmt "ø"
44     else
45       NodeHash.iter (fun cle set -> pp "|  %i-->%a@ " cle print_d_set set)
46         run in
47   let print_box fmt run =
48     let pp = Format.fprintf fmt in
49     pp "@[<v 0># Mapping: %a@ @]"
50       print_map run
51   in
52   Format.fprintf fmt "@[<v 1>##### RUN #####@, %a@ @]@." print_box run
53