Project

General

Profile

Revision dc893173 src/backends/C/c_backend.ml

View differences:

src/backends/C/c_backend.ml
25 25
  )
26 26
*)
27 27

  
28
let gen_files funs basename prog machines dependencies header_file source_lib_file source_main_file makefile_file machines =
29

  
30
  let header_out = open_out header_file in
31
  let header_fmt = formatter_of_out_channel header_out in
32
  let source_lib_out = open_out source_lib_file in
33
  let source_lib_fmt = formatter_of_out_channel source_lib_out in
34

  
28
let gen_files funs basename prog machines dependencies =
29
  let destname = !Options.dest_dir ^ "/" ^ basename in
30
  let source_main_file = destname ^ "_main.c" in (* Could be changed *)
31
  let makefile_file = destname ^ ".makefile" in (* Could be changed *)
32
  
35 33
  let print_header, print_lib_c, print_main_c, print_makefile = funs in
34

  
36 35
  (* Generating H file *)
36
  let alloc_header_file = destname ^ "_alloc.h" in (* Could be changed *)
37
  let header_out = open_out alloc_header_file in
38
  let header_fmt = formatter_of_out_channel header_out in
37 39
  print_header header_fmt basename prog machines dependencies;
38
 
40
  close_out header_out;
41
  
39 42
  (* Generating Lib C file *)
43
  let source_lib_file = destname ^ ".c" in (* Could be changed *)
44
  let source_lib_out = open_out source_lib_file in
45
  let source_lib_fmt = formatter_of_out_channel source_lib_out in
40 46
  print_lib_c source_lib_fmt basename prog machines dependencies;
41

  
42
  close_out header_out;
43 47
  close_out source_lib_out;
44 48

  
45 49
  match !Options.main_node with
......
69 73
    end
70 74
  )
71 75

  
72
let translate_to_c header source_lib source_main makefile basename prog machines dependencies =
76
let translate_to_c basename prog machines dependencies =
73 77
  match !Options.spec with
74 78
  | "no" -> begin
75 79
    let module HeaderMod = C_backend_header.EmptyMod in
......
88 92
      SourceMain.print_main_c, 
89 93
      Makefile.print_makefile 
90 94
    in
91
    gen_files 
92
      funs basename prog machines dependencies 
93
      header source_lib source_main makefile machines
95
    gen_files funs basename prog machines dependencies 
94 96

  
95 97
  end
96 98
  | "acsl" -> begin
......
111 113
      SourceMain.print_main_c,
112 114
      Makefile.print_makefile 
113 115
    in
114
    gen_files
115
      funs basename prog machines dependencies
116
      header source_lib source_main makefile machines
116
    gen_files funs basename prog machines dependencies 
117 117

  
118 118
  end
119 119
  | "c" -> begin

Also available in: Unified diff