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.26 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
28
29
30
  mutable node_to_file_name: (int, string) Hashtbl.t;
  mutable var_name_to_index: ((string, int) Hashtbl.t);
  mutable index_to_var_name: ((int, string) Hashtbl.t);
  mutable bdd_tbl: (formula, Bdd.t) Hashtbl.t;
31
  mutable snt: (Bdd.t, Util.sol_nb * Util.sol_nb) Hashtbl.t;
32
33
34
35
36
37
  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 ;
38
39
40
41
42
  mutable input : env_in ;
  mutable output: env_out ;
  mutable local : env_loc 
}

43

44
45

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

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
let vn_to_index vn = Hashtbl.find env_state.var_name_to_index vn

let index_to_vn i = Hashtbl.find env_state.index_to_var_name i


let in_env_unsorted _ = 
  Hashtbl.fold 
    (fun _ (x,_,_) acc -> Util.merge x acc) 
    env_state.var_names
    [] 

let out_env_unsorted _ = 
  Hashtbl.fold 
    (fun _ (_,x,_) acc -> Util.merge x acc) 
    env_state.var_names
    [] 


let loc_env_unsorted _ = 
  Hashtbl.fold 
    (fun _ (_,_,x) acc -> Util.merge x acc) 
    env_state.var_names
    []