Project

General

Profile

Download (1.84 KB) Statistics
| Branch: | Tag: | Revision:
1
(********************************************************************)
2
(*                                                                  *)
3
(*  The LustreC compiler toolset   /  The LustreC Development Team  *)
4
(*  Copyright 2012 -    --   ONERA - CNRS - INPT - ISAE-SUPAERO     *)
5
(*                                                                  *)
6
(*  LustreC is free software, distributed WITHOUT ANY WARRANTY      *)
7
(*  under the terms of the GNU Lesser General Public License        *)
8
(*  version 2.1.                                                    *)
9
(*                                                                  *)
10
(********************************************************************)
11

    
12
open Format
13
open Machine_code_types
14

    
15
let gen_ada destname print suffix machine =
16
  let path = destname ^ machine.mname.node_id ^ suffix in
17
  let out = open_out path in
18
  let fmt = formatter_of_out_channel out in
19
  print fmt machine;
20
  close_out out;
21
  Log.report ~level:2 (fun fmt -> fprintf fmt "    .. %s generated @." path)
22

    
23
exception CheckFailed of string
24

    
25
let check machine =
26
  match machine.mconst with
27
    | [] -> ()
28
    | _ -> raise (CheckFailed "machine.mconst should be void")
29

    
30
let translate_to_ada basename prog machines dependencies =
31
  let module Ads = Ada_backend_ads.Main in
32
  let module Adb = Ada_backend_adb.Main in
33
  let module Wrapper = Ada_backend_wrapper.Main in
34

    
35
  let destname = !Options.dest_dir ^ "/" in
36

    
37
  Log.report ~level:2 (fun fmt -> fprintf fmt "  .. Checking machines@.");
38

    
39
  List.iter check machines;
40

    
41
  Log.report ~level:2 (fun fmt -> fprintf fmt "  .. Generating ads@.");
42

    
43
  List.iter (gen_ada destname Ads.print ".ads") machines;
44

    
45
  Log.report ~level:2 (fun fmt -> fprintf fmt "  .. Generating adb@.");
46

    
47
  List.iter (gen_ada destname Adb.print ".adb") machines
48

    
49
(* Local Variables: *)
50
(* compile-command:"make -C ../../.." *)
51
(* End: *)
(2-2/6)