Project

General

Profile

« Previous | Next » 

Revision 61e0c3c4

Added by Guillaume DAVY over 5 years ago

Ada:
- Correct the merge with lustrec-seal
- Improve support for builtin function(still work to do)
- Add generation of a gpr file for lib(without main).
- Add var initialisation in the reset, still work to do.

View differences:

src/backends/Ada/ada_backend.ml
42 42
  close_out out
43 43

  
44 44

  
45
(** Print the filename of a machine package.
46
   @param extension the extension to append to the package name
47
   @param fmt the formatter
48
   @param machine the machine corresponding to the package
49
**)
50
let pp_machine_filename extension fmt machine =
51
  pp_filename extension fmt (function fmt -> pp_package_name fmt machine)
52

  
53 45
(** Exception raised when a machine contains a feature not supported by the
54 46
  Ada backend*)
55 47
exception CheckFailed of string
......
64 56
    | [] -> ()
65 57
    | _ -> raise (CheckFailed "machine.mconst should be void")
66 58

  
67
(** Print the name of the ada project file.
68
   @param fmt the formater to print on
69
   @param main_machine the machine associated to the main node
70
**)
71
let pp_project_name fmt main_machine =
72
  fprintf fmt "%a.gpr" pp_package_name main_machine
73

  
74 59

  
75 60
let get_typed_submachines machines m =
76 61
  let instances = List.filter (fun (id, _) -> not (is_builtin_fun id)) m.mcalls in
......
83 68

  
84 69
(** Main function of the Ada backend. It calls all the subfunction creating all
85 70
the file and fill them with Ada code representing the machines list given.
86
   @param basename useless
71
   @param basename name of the lustre file
87 72
   @param prog useless
88 73
   @param prog list of machines to translate
89 74
   @param dependencies useless
......
98 83

  
99 84
  let _machines = List.combine typed_submachines machines in
100 85

  
101
  let _pp_filename ext fmt (typed_submachines, machine) =
86
  let _pp_filename ext fmt (typed_submachine, machine) =
102 87
    pp_machine_filename ext fmt machine in
103 88

  
104 89
  (* Extract the main machine if there is one *)
......
126 111

  
127 112
  (* If a main node is given we generate a main adb file and a project file *)
128 113
  log_str_level_two 1 "Generating wrapper files";
129
  match main_machine with
130
    | None -> log_str_level_two 2 "File not generated(no -node argument)";
114
  (match main_machine with
115
    | None -> ()
131 116
    | Some machine ->
132
begin
133
  let pp_main_filename fmt _ =
134
    pp_filename "adb" fmt pp_main_procedure_name in
135
  write_file destname pp_project_name Wrapper.pp_project_file machine;
136
  write_file destname pp_main_filename Wrapper.pp_main_adb machine;
137
end
117
        write_file destname pp_main_filename Wrapper.pp_main_adb machine;
118
        write_file destname (Wrapper.pp_project_name (basename^"_exe")) (Wrapper.pp_project_file machines basename) main_machine);
119
  write_file destname Wrapper.pp_project_configuration_name Wrapper.pp_project_configuration_file basename;
120
  write_file destname (Wrapper.pp_project_name (basename^"_lib")) (Wrapper.pp_project_file machines basename) None;
138 121

  
139 122

  
140 123
(* Local Variables: *)

Also available in: Unified diff