Skip to content
Snippets Groups Projects
Commit 2823bc51 authored by Pierre Loic Garoche's avatar Pierre Loic Garoche
Browse files

Proper integer index for enumerated branches

parent c82ea2ca
No related branches found
No related tags found
No related merge requests found
......@@ -246,6 +246,7 @@ let rec pp_emf_instr m fmt i =
(fun fmt (tag, instrs_tag) ->
let (*branch_outputs*) _, branch_inputs = branch_block_vars instrs_tag in
fprintf fmt "@[<v 2>\"%s\": {@ " tag;
fprintf fmt "\"guard_value\": \"%a\",@ " pp_tag_id tag;
fprintf fmt "\"inputs\": [%a],@ " pp_emf_vars_decl (VSet.elements branch_inputs);
fprintf fmt "@[<v 2>\"instrs\": {@ ";
fprintf_list ~sep:",@ " (pp_emf_instr m) fmt instrs_tag;
......
......@@ -51,7 +51,14 @@ let pp_emf_vars_decl fmt vl =
let reset_name id =
"reset_" ^ id
let pp_tag_id fmt t =
let typ = (Corelang.typedef_of_top (Hashtbl.find Corelang.tag_table t)) in
if typ.tydef_id = "bool" then
pp_print_string fmt t
else
let const_list = match typ.tydef_desc with Tydec_enum tl -> tl | _ -> assert false in
fprintf fmt "%i" (get_idx t const_list)
let pp_emf_cst_or_var fmt v =
match v.value_desc with
| Cst ((Const_tag t) as c)->
......@@ -60,9 +67,8 @@ let pp_emf_cst_or_var fmt v =
fprintf fmt "{@[\"type\": \"constant\",@ \"value\": \"%a\"@ @]}"
Printers.pp_const c
else (
let const_list = match typ.tydef_desc with Tydec_enum tl -> tl | _ -> assert false in
fprintf fmt "{@[\"type\": \"constant\",@ \"value\": \"%i\",@ "
(get_idx t const_list);
fprintf fmt "{@[\"type\": \"constant\",@ \"value\": \"%a\",@ "
pp_tag_id t;
fprintf fmt "\"origin_type\": \"%s\",@ \"origin_value\": \"%s\"@ "
typ.tydef_id t;
fprintf fmt "@]}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment