Project

General

Profile

« Previous | Next » 

Revision 66359a5e

Added by Pierre-Loïc Garoche about 7 years ago

[general] large modification: added machine types, a second typing phase dealing with machine types (eg uint8)
typing was transformed as a functor and parametrized by basic types (int/real/bool)
it can also be applied multiple times on the same program

View differences:

src/backends/C/c_backend_src.ml
608 608
  let constants = List.map const_of_top (get_consts prog) in
609 609
  fprintf fmt "@[<v 2>%a {@,static %s init = 0;@,@[<v 2>if (!init) { @,init = 1;@,%a%t%a@]@,}@,return;@]@,}@.@."
610 610
    print_global_init_prototype baseNAME
611
    (pp_c_basic_type_desc Types.Tbool)
611
    (pp_c_basic_type_desc Type_predef.type_bool)
612 612
    (* constants *) 
613 613
    (Utils.fprintf_list ~sep:"@," (pp_const_initialize (pp_c_var_read Machine_code.empty_machine))) constants
614 614
    (Utils.pp_final_char_if_non_empty "@," dependencies)
......
620 620
  let constants = List.map const_of_top (get_consts prog) in
621 621
  fprintf fmt "@[<v 2>%a {@,static %s clear = 0;@,@[<v 2>if (!clear) { @,clear = 1;@,%a%t%a@]@,}@,return;@]@,}@.@."
622 622
    print_global_clear_prototype baseNAME
623
    (pp_c_basic_type_desc Types.Tbool)
623
    (pp_c_basic_type_desc Type_predef.type_bool)
624 624
    (* constants *) 
625 625
    (Utils.fprintf_list ~sep:"@," (pp_const_clear (pp_c_var_read Machine_code.empty_machine))) constants
626 626
    (Utils.pp_final_char_if_non_empty "@," dependencies)
......
666 666
let print_import_standard source_fmt =
667 667
  begin
668 668
    fprintf source_fmt "#include <assert.h>@.";
669
    if Machine_types.has_machine_type () then
670
      begin
671
	fprintf source_fmt "#include <stdint.h>@."
672
      end;
669 673
    if not !Options.static_mem then
670 674
      begin
671 675
	fprintf source_fmt "#include <stdlib.h>@.";

Also available in: Unified diff