Project

General

Profile

Revision 66359a5e src/backends/EMF/EMF_backend.ml

View differences:

src/backends/EMF/EMF_backend.ml
197 197
	     (reset_name f,
198 198
	      Corelang.mktyp loc Tydec_bool, Corelang.mkclock loc Ckdec_any,
199 199
	      false,
200
	      None,
200 201
	      None) 
201 202
	 in
202 203
	 VSet.add reset_var args_vars
......
365 366
    fprintf fmt "%a" pp_content i;
366 367
    fprintf fmt "@]@]@ }"
367 368
and pp_emf_instrs m fmt instrs = fprintf_list ~sep:",@ " (pp_emf_instr m) fmt instrs
368
       
369

  
370
let pp_emf_annot cpt fmt (key, ee) =
371
  let _ =
372
    fprintf fmt "\"ann%i\": { @[<hov 0>\"key\": [%a],@ \"eexpr\": %a@] }"
373
      !cpt
374
      (fprintf_list ~sep:"," (fun fmt s -> fprintf fmt "\"%s\"" s)) key
375
      pp_emf_eexpr ee
376
  in
377
  incr cpt
378
  
379
let pp_emf_annots cpt fmt annots = fprintf_list ~sep:",@ " (pp_emf_annot cpt) fmt annots.annots
380
let pp_emf_annots_list cpt fmt annots_list = fprintf_list ~sep:",@ " (pp_emf_annots cpt) fmt annots_list
369 381
let pp_machine fmt m =
370 382
  let instrs = (*merge_branches*) m.mstep.step_instrs in
371 383
  try
372 384
    fprintf fmt "@[<v 2>\"%a\": {@ "
373 385
       print_protect (fun fmt -> pp_print_string fmt m.mname.node_id);
374
    fprintf fmt "\"kind\": %t,@ \"inputs\": [%a],@ \"outputs\": [%a],@ \"locals\": [%a],@ "
386
    fprintf fmt "\"kind\": %t,@ "
375 387
      (fun fmt -> if not ( snd (get_stateless_status m) )
376 388
	then fprintf fmt "\"stateful\""
377
	else fprintf fmt "\"stateless\"")
378
      pp_emf_vars_decl m.mstep.step_inputs
379
      pp_emf_vars_decl m.mstep.step_outputs
380
      pp_emf_vars_decl m.mstep.step_locals
381
    ;
389
	else fprintf fmt "\"stateless\"");
390
    fprintf fmt "\"inputs\": [%a],@ "
391
      pp_emf_vars_decl m.mstep.step_inputs;
392
    fprintf fmt "\"outputs\": [%a],@ "
393
      pp_emf_vars_decl m.mstep.step_outputs;
394
    fprintf fmt "\"locals\": [%a],@ "
395
      pp_emf_vars_decl m.mstep.step_locals;
396
    fprintf fmt "\"mems\": [%a],@ "
397
      pp_emf_vars_decl m.mmemory;
398
    
382 399
    fprintf fmt "\"original_name\": \"%s\",@ " m.mname.node_id;
383
    fprintf fmt "\"instrs\": {@[<v 0> %a@]@ }"
400
    fprintf fmt "\"instrs\": {@[<v 0> %a@]@ },@ "
384 401
      (pp_emf_instrs m) instrs;
402
    fprintf fmt "\"annots\": {@[<v 0> %a@]@ }" (pp_emf_annots_list (ref 0)) m.mannot;
385 403
    fprintf fmt "@]@ }"
386 404
  with Unhandled msg -> (
387 405
    eprintf "[Error] @[<v 0>EMF backend@ Issues while translating node %s@ "

Also available in: Unified diff