Project

General

Profile

Revision e24b2e9b src/automata.ml

View differences:

src/automata.ml
24 24
      actual_s : var_decl
25 25
    }
26 26

  
27
let cpvar_decl var_decl =
28
 mkvar_decl var_decl.var_loc ~orig:var_decl.var_orig (var_decl.var_id, var_decl.var_dec_type, var_decl.var_dec_clock, var_decl.var_dec_const, var_decl.var_dec_value)
29

  
30 27
let as_clock var_decl =
31 28
  let tydec = var_decl.var_dec_type in
32 29
  { var_decl with var_dec_type = { ty_dec_desc = Tydec_clock tydec.ty_dec_desc; ty_dec_loc = tydec.ty_dec_loc } }
......
37 34
let mkident loc id =
38 35
 mkexpr loc (Expr_ident id)
39 36

  
37
let mkconst loc id =
38
 mkexpr loc (Expr_const (Const_tag id))
39

  
40 40
let mkfby loc e1 e2 =
41 41
 mkexpr loc (Expr_arrow (e1, mkexpr loc (Expr_pre e2)))
42 42

  
43
let mkpair loc e1 e2 =
44
 mkexpr loc (Expr_tuple [e1; e2])
45

  
43 46
let mkidentpair loc restart state =
44 47
 mkexpr loc (Expr_tuple [mkident loc restart; mkident loc state])
45 48

  
......
126 129
    node_id = node_id;
127 130
    node_type = Types.new_var ();
128 131
    node_clock = Clocks.new_var true;
129
    node_inputs = List.map cpvar_decl var_inputs;
130
    node_outputs = List.map cpvar_decl var_outputs;
132
    node_inputs = List.map copy_var_decl var_inputs;
133
    node_outputs = List.map copy_var_decl var_outputs;
131 134
    node_locals = [];
132 135
    node_gencalls = [];
133 136
    node_checks = [];
......
176 179
    node_id = node_id;
177 180
    node_type = Types.new_var ();
178 181
    node_clock = Clocks.new_var true;
179
    node_inputs = List.map cpvar_decl var_inputs;
180
    node_outputs = List.map cpvar_decl (aut_state.incoming_r :: aut_state.incoming_s :: new_var_outputs);
181
    node_locals = List.map cpvar_decl (new_var_locals @ handler.hand_locals);
182
    node_inputs = List.map copy_var_decl var_inputs;
183
    node_outputs = List.map copy_var_decl (aut_state.incoming_r :: aut_state.incoming_s :: new_var_outputs);
184
    node_locals = List.map copy_var_decl (new_var_locals @ handler.hand_locals);
182 185
    node_gencalls = [];
183 186
    node_checks = [];
184 187
    node_asserts = handler.hand_asserts; 
......
209 212
  let assign_until_expr = mkexpr aut.aut_loc (Expr_merge (aut_state.actual_s.var_id, assign_until_handlers)) in
210 213
  let assign_until_vars = [aut_state.incoming_r'.var_id; aut_state.incoming_s'.var_id] @ (ISet.elements all_outputs) in
211 214
  let assign_until_eq = mkeq aut.aut_loc (assign_until_vars, assign_until_expr) in
212
  let fby_incoming_expr = mkfby aut.aut_loc (mkidentpair aut.aut_loc tag_false initial) (mkidentpair aut.aut_loc aut_state.incoming_r'.var_id aut_state.incoming_s'.var_id) in
215
  let fby_incoming_expr = mkfby aut.aut_loc (mkpair aut.aut_loc (mkconst aut.aut_loc tag_false) (mkconst aut.aut_loc initial)) (mkidentpair aut.aut_loc aut_state.incoming_r'.var_id aut_state.incoming_s'.var_id) in
213 216
  let incoming_eq = mkeq aut.aut_loc ([aut_state.incoming_r.var_id; aut_state.incoming_s.var_id], fby_incoming_expr) in
214 217
  let locals' = vars_of_aut_state aut_state in
215 218
  let eqs' = [Eq unless_eq; Eq assign_until_eq; Eq incoming_eq] in

Also available in: Unified diff