Project

General

Profile

Revision 7ab1c5bd src/backends/C/c_backend_main.ml

View differences:

src/backends/C/c_backend_main.ml
53 53

  
54 54
let print_put_outputs fmt m = 
55 55
  let po fmt (id, o', o) =
56
    match (Types.unclock_type o.var_type).Types.tdesc with
57
    | Types.Tint -> fprintf fmt "_put_int(f_out%i, \"%s\", %s)" id o'.var_id o.var_id
58
    | Types.Tbool -> fprintf fmt "_put_bool(f_out%i, \"%s\", %s)" id o'.var_id o.var_id
59
    | Types.Treal when !Options.mpfr -> fprintf fmt "_put_double(f_out%i, \"%s\", mpfr_get_d(%s, %s))" id o'.var_id o.var_id (Mpfr.mpfr_rnd ())
60
    | Types.Treal -> fprintf fmt "_put_double(f_out%i, \"%s\", %s)" id o'.var_id o.var_id
61
    | _ -> assert false
56
    let suff = string_of_int id in
57
    print_put_var fmt suff o'.var_id o.var_type o.var_id
62 58
  in
63 59
  Utils.List.iteri2 (fun idx v' v -> fprintf fmt "@ %a;" po ((idx+1), v', v)) m.mname.node_outputs m.mstep.step_outputs
64 60

  
......
158 154
    else "main_mem" in
159 155
  fprintf fmt "@[<v 2>int main (int argc, char *argv[]) {@ ";
160 156
  print_main_inout_declaration basename fmt m;
157
  Plugins.c_backend_main_loop_body_prefix basename mname fmt ();
161 158
  print_main_memory_allocation mname main_mem fmt m;
162 159
  if !Options.mpfr then
163 160
    begin

Also available in: Unified diff