Project

General

Profile

Revision 52c5ba00 src/backends/C/c_backend_src.ml

View differences:

src/backends/C/c_backend_src.ml
588 588
let print_global_init_code fmt basename prog dependencies =
589 589
  let baseNAME = file_to_module_name basename in
590 590
  let constants = List.map const_of_top (get_consts prog) in
591
  fprintf fmt "@[<v 2>%a {@,static _Bool init = 0;@,@[<v 2>if (!init) { @,init = 1;@,%a%t%a@]@,}@,return;@]@,}@.@."
591
  fprintf fmt "@[<v 2>%a {@,static %s init = 0;@,@[<v 2>if (!init) { @,init = 1;@,%a%t%a@]@,}@,return;@]@,}@.@."
592 592
    print_global_init_prototype baseNAME
593
    (pp_c_basic_type_desc Types.Tbool)
593 594
    (* constants *) 
594 595
    (Utils.fprintf_list ~sep:"@," (pp_const_initialize (pp_c_var_read Machine_code.empty_machine))) constants
595 596
    (Utils.pp_final_char_if_non_empty "@," dependencies)
......
599 600
let print_global_clear_code  fmt basename prog dependencies =
600 601
  let baseNAME = file_to_module_name basename in
601 602
  let constants = List.map const_of_top (get_consts prog) in
602
  fprintf fmt "@[<v 2>%a {@,static _Bool clear = 0;@,@[<v 2>if (!clear) { @,clear = 1;@,%a%t%a@]@,}@,return;@]@,}@.@."
603
  fprintf fmt "@[<v 2>%a {@,static %s clear = 0;@,@[<v 2>if (!clear) { @,clear = 1;@,%a%t%a@]@,}@,return;@]@,}@.@."
603 604
    print_global_clear_prototype baseNAME
605
    (pp_c_basic_type_desc Types.Tbool)
604 606
    (* constants *) 
605 607
    (Utils.fprintf_list ~sep:"@," (pp_const_clear (pp_c_var_read Machine_code.empty_machine))) constants
606 608
    (Utils.pp_final_char_if_non_empty "@," dependencies)

Also available in: Unified diff