Revision 3b2bd83d
Added by Teme Kahsai about 8 years ago
src/automata.ml | ||
---|---|---|
139 | 139 |
let node_of_unless nused used node aut_id aut_state handler = |
140 | 140 |
(*Format.eprintf "node_of_unless %s@." node.node_id;*) |
141 | 141 |
let inputs = unless_read ISet.empty handler in |
142 |
let var_inputs = aut_state.incoming_r :: aut_state.incoming_s :: (node_vars_of_idents node inputs) in
|
|
142 |
let var_inputs = aut_state.incoming_r (*:: aut_state.incoming_s*) :: (node_vars_of_idents node inputs) in
|
|
143 | 143 |
let var_outputs = aut_state.actual_r :: aut_state.actual_s :: [] in |
144 |
let expr_outputs = List.fold_right add_branch handler.hand_unless (mkidentpair handler.hand_loc aut_state.incoming_r.var_id aut_state.incoming_s.var_id) in |
|
144 |
let init_expr = mkpair handler.hand_loc (mkident handler.hand_loc aut_state.incoming_r.var_id) (mkconst handler.hand_loc handler.hand_state) in |
|
145 |
(* let init_expr = mkidentpair handler.hand_loc aut_state.incoming_r.var_id aut_state.incoming_s.var_id in *) |
|
146 |
let expr_outputs = List.fold_right add_branch handler.hand_unless init_expr in |
|
145 | 147 |
let eq_outputs = Eq (mkeq handler.hand_loc ([aut_state.actual_r.var_id; aut_state.actual_s.var_id], expr_outputs)) in |
146 | 148 |
let node_id = mk_new_name nused (Format.sprintf "%s__%s_unless" aut_id handler.hand_state) in |
147 | 149 |
let args = List.map (fun v -> mkexpr handler.hand_loc (Expr_when (mkident handler.hand_loc v.var_id, aut_state.incoming_s.var_id, handler.hand_state))) var_inputs in |
... | ... | |
185 | 187 |
let writes = handler_write ISet.empty handler in |
186 | 188 |
let inputs = ISet.diff (handler_read (until_read ISet.empty handler) handler) writes in |
187 | 189 |
let frename = mk_frename used writes in |
188 |
let var_inputs = node_vars_of_idents node inputs in |
|
190 |
let var_inputs = aut_state.actual_r (*:: aut_state.actual_s*) :: node_vars_of_idents node inputs in
|
|
189 | 191 |
let new_var_locals = node_vars_of_idents node writes in |
190 | 192 |
let var_outputs = List.sort IdentModule.compare (node_vars_of_idents node writes) in |
191 | 193 |
let new_var_outputs = List.map (fun vdecl -> { vdecl with var_id = frename vdecl.var_id }) var_outputs in |
192 | 194 |
let new_output_eqs = List.map2 (fun o o' -> Eq (mkeq handler.hand_loc ([o'.var_id], mkident handler.hand_loc o.var_id))) var_outputs new_var_outputs in |
193 |
let until_expr = List.fold_right add_branch handler.hand_until (mkidentpair handler.hand_loc aut_state.actual_r.var_id aut_state.actual_s.var_id) in |
|
195 |
let init_until = mkpair handler.hand_loc (mkconst handler.hand_loc tag_false) (mkconst handler.hand_loc handler.hand_state) in |
|
196 |
let until_expr = List.fold_right add_branch handler.hand_until init_until in |
|
194 | 197 |
let until_eq = Eq (mkeq handler.hand_loc ([aut_state.incoming_r.var_id; aut_state.incoming_s.var_id], until_expr)) in |
195 | 198 |
let node_id = mk_new_name nused (Format.sprintf "%s__%s_handler_until" aut_id handler.hand_state) in |
196 |
let var_inputs = aut_state.actual_r :: aut_state.actual_s :: var_inputs in |
|
197 | 199 |
let args = List.map (fun v -> mkexpr handler.hand_loc (Expr_when (mkident handler.hand_loc v.var_id, aut_state.actual_s.var_id, handler.hand_state))) var_inputs in |
198 | 200 |
let reset = Some (mkident handler.hand_loc aut_state.actual_r.var_id) in |
199 | 201 |
List.fold_left (fun res v -> ISet.add v.var_id res) ISet.empty var_outputs, |
Also available in: Unified diff
updating to onera version 30f766a:2016-12-04