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.18 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
26
27
28
29
  mutable var_names: (string, (vnt list * vnt list * vnt list)) Hashtbl.t;
  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;
30
  mutable snt: (Bdd.t, Util.sol_nb * Util.sol_nb) Hashtbl.t;
31
32
33
34
35
36
  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 ;
37
38
39
40
41
  mutable input : env_in ;
  mutable output: env_out ;
  mutable local : env_loc 
}

42

43
44

let (env_state:env_stateT) = {
45
46
47
48
49
  var_names = Hashtbl.create 0 ;
  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;
50
  snt = Hashtbl.create 3; 
51
52
  pre_expr = [] ;
  pre_form = [] ;
53
54
55
56
  current_nodes = [];
  graph = Graph.create () ;
  formula_table = Hashtbl.create 0 ;
  wtree_table = Hashtbl.create 0 ;
57
58
  input = [] ;
  output = [] ;
59
60
61
  local = [] 
}

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
    []