Project

General

Profile

Revision c82ea2ca

View differences:

src/backends/EMF/EMF_backend.ml
329 329
  fprintf fmt "@ @]},@ "
330 330
    
331 331
let translate fmt basename prog machines =
332
  (* record_types prog; *)
332 333
  fprintf fmt "@[<v 0>{@ ";
333 334
  pp_meta fmt basename;
334 335
  fprintf fmt "\"nodes\": @[<v 0>{@ ";
src/backends/EMF/EMF_common.ml
19 19
let is_imported_node f m =
20 20
  let (decl, _) = List.assoc f m.mcalls in
21 21
  Corelang.is_imported_node decl
22

  
23
(* Handling of enumerated types: for the moment each of such type is transformed
24
   into an int: the idx number of the constant in the typedef. This is not so
25
   nice but is compatible with basic Simulink types: int, real, bools) *)
26
(*
27
let recorded_enums = ref []
28
let record_types prog =
29
  let typedefs = Corelang.get_typedefs prog in
30
  List.iter (fun top ->
31
    let consts = consts_of_enum_type top in
32
  ) prog
33
*)
22 34
    
23 35
(* Basic printing functions *)
24 36
    
......
42 54
    
43 55
let pp_emf_cst_or_var fmt v =
44 56
  match v.value_desc with
57
  | Cst ((Const_tag t) as c)->
58
     let typ = (Corelang.typedef_of_top (Hashtbl.find Corelang.tag_table t)) in
59
     if typ.tydef_id = "bool" then
60
       fprintf fmt "{@[\"type\": \"constant\",@ \"value\": \"%a\"@ @]}"
61
	 Printers.pp_const c
62
     else (
63
       let const_list = match typ.tydef_desc with Tydec_enum tl -> tl | _ -> assert false in
64
       fprintf fmt "{@[\"type\": \"constant\",@ \"value\": \"%i\",@ " 
65
	 (get_idx t const_list);
66
       fprintf fmt "\"origin_type\": \"%s\",@ \"origin_value\": \"%s\"@ "
67
	 typ.tydef_id t;
68
       fprintf fmt "@]}"
69
     )
45 70
  | Cst c ->
46 71
     fprintf fmt "{@[\"type\": \"constant\",@ \"value\": \"%a\"@ @]}"
47 72
       Printers.pp_const c

Also available in: Unified diff