Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

env_state.ml 2.72 KB
Newer Older
1
2
3
4
5
(*-----------------------------------------------------------------------
** Copyright (C) 2001 - Verimag.
** This file may only be copied under the terms of the GNU Library General
** Public License 
**-----------------------------------------------------------------------
6
**
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
** File: env_state.ml
** Main author: jahier@imag.fr
*)

open Graph
open Formula
open Wtree

(****************************************************************************)


(* 
** The environment is a list of graphs whose arcs are labelled by weighted 
** formula. 
*)

type env_stateT = {
  (* var names and types given file by file *)
25
  mutable var_names: (string, (vnt list * vnt list * vnt list)) Hashtbl.t;
26
  mutable output_var_names: vnt list;
27
  mutable node_to_file_name: (int, string) Hashtbl.t;
28
29
30
  mutable atomic_formula_to_index: ((formula, int) Hashtbl.t);
  mutable index_to_atomic_formula: ((int, formula) Hashtbl.t);
  mutable index_cpt: int;
31
  mutable bdd_tbl: (formula, Bdd.t) Hashtbl.t;
32
  mutable snt: (Bdd.t, Util.sol_nb * Util.sol_nb) Hashtbl.t;
33
34
35
36
37
38
  mutable pre_expr: vne list;
  mutable pre_form: vnf list;
  mutable current_nodes: node list list;
  mutable graph: (node, arc_info) Graph.t ;
  mutable formula_table: Wtree.formula_table ;
  mutable wtree_table: Wtree.wtree_table ;
39
40
41
42
43
  mutable input : env_in ;
  mutable output: env_out ;
  mutable local : env_loc 
}

44

45
46

let (env_state:env_stateT) = {
47
  var_names = Hashtbl.create 0 ;
48
  output_var_names = [];
49
  node_to_file_name = Hashtbl.create 0 ;
50
51
52
  atomic_formula_to_index = Hashtbl.create 0 ;
  index_to_atomic_formula = Hashtbl.create 0 ;
  index_cpt = 0 ;
53
  bdd_tbl = Hashtbl.create 0;
54
  snt = Hashtbl.create 3; 
55
56
  pre_expr = [] ;
  pre_form = [] ;
57
58
59
60
  current_nodes = [];
  graph = Graph.create () ;
  formula_table = Hashtbl.create 0 ;
  wtree_table = Hashtbl.create 0 ;
61
  input = Hashtbl.create 0 ;
62
  output = [] ;
63
64
65
  local = [] 
}

66
67
68
69
70
71
72
let atomic_formula_to_index f = 
  try Hashtbl.find env_state.atomic_formula_to_index f
  with Not_found -> 
    env_state.index_cpt <- (env_state.index_cpt + 1);
    Hashtbl.add env_state.atomic_formula_to_index f env_state.index_cpt;
    Hashtbl.add env_state.index_to_atomic_formula env_state.index_cpt f;
    env_state.index_cpt
73

74
75
let index_to_atomic_formula i = 
  Hashtbl.find env_state.index_to_atomic_formula i
76
77
78


let in_env_unsorted _ = 
79
80
81
82
83
84
85
86
  let vnt_list =
    Hashtbl.fold 
      (fun _ (x,_,_) acc -> Util.merge x acc) 
      env_state.var_names
      [] 
  in
    vnt_list

87

88
89
let out_env_unsorted _ =  
  let vnt_list =
90
91
92
  Hashtbl.fold 
    (fun _ (_,x,_) acc -> Util.merge x acc) 
    env_state.var_names
93
94
95
    []  
  in
    vnt_list
96
97


98
99
100

let loc_env_unsorted _ =  
  let vnt_list =
101
102
103
  Hashtbl.fold 
    (fun _ (_,_,x) acc -> Util.merge x acc) 
    env_state.var_names
104
105
106
107
    []  
  in
    vnt_list

108
109