Project

General

Profile

Revision 66359a5e src/backends/C/c_backend_mauve.ml

View differences:

src/backends/C/c_backend_mauve.ml
43 43
let mauve_default_value v =
44 44
  (* let v_name = v.var_id in *)
45 45

  
46
  let v_type = (Types.repr v.var_type).Types.tdesc in
47
  match v_type with
48
  | Types.Tbool -> "false"
49
  | Types.Tint  -> "0"
50
  | Types.Treal -> "0.0"
51
  | _ -> assert false
46
  if Types.is_bool_type v.var_type then "false"
47
  else if Types.is_int_type v.var_type then "0"
48
  else if Types.is_real_type v.var_type then "0.0"
49
  else assert false
52 50

  
53 51
let print_mauve_default fmt mauve_machine v = 
54 52
  let v_name: string = v.var_id in
......
80 78
  List.iter
81 79
    (fun v ->
82 80
      let v_name = v.var_id in
83
      let v_type = pp_c_basic_type_desc (Types.repr v.var_type).Types.tdesc in
81
      let v_type = pp_c_basic_type_desc v.var_type in
84 82
      fprintf fmt "\tReadPort<%s> & port_%s = mk_readPort<%s>(\"%s\", " v_type v_name v_type v_name;
85 83
      print_mauve_default fmt mauve_machine v;
86 84
      fprintf fmt ");@.";
......
90 88
  List.iter
91 89
    (fun v ->
92 90
      let v_name = v.var_id in
93
      let v_type = pp_c_basic_type_desc (Types.repr v.var_type).Types.tdesc in
91
      let v_type = pp_c_basic_type_desc v.var_type in
94 92
      fprintf fmt "\tWritePort<%s> & port_%s = mk_writePort<%s>(\"%s\");@." v_type v_name v_type v_name;
95 93
    ) mauve_machine.mstep.step_outputs;
96 94

  
......
134 132
  List.iter
135 133
    (fun v ->
136 134
      let v_name = v.var_id in
137
      let v_type = pp_c_basic_type_desc (Types.repr v.var_type).Types.tdesc in
135
      let v_type = pp_c_basic_type_desc v.var_type in
138 136
      fprintf fmt "\t\t%s %s = port_%s.read();@." v_type v_name v_name;
139 137
    ) mauve_machine.mstep.step_inputs;
140 138
  List.iter
141 139
    (fun v ->
142 140
      let v_name = v.var_id in
143
      let v_type = pp_c_basic_type_desc (Types.repr v.var_type).Types.tdesc in
141
      let v_type = pp_c_basic_type_desc v.var_type in
144 142
      fprintf fmt "\t\t%s %s;@." v_type v_name;
145 143
    ) mauve_machine.mstep.step_outputs;
146 144
  print_mauve_step fmt node_name mauve_machine;

Also available in: Unified diff