Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / src / backends / Ada / ada_backend_ads.ml @ c06b3b47

History | View | Annotate | Download (1.72 KB)

1 f20d8ac7 Christophe Garion
(********************************************************************)
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 48a6309c Guillaume DAVY
open Format
13 bdc471f3 Guillaume DAVY
14 48a6309c Guillaume DAVY
open Machine_code_types
15
open Lustre_types
16
open Corelang
17
open Machine_code_common
18
19 bdc471f3 Guillaume DAVY
open Ada_backend_common
20
21 b12a91e0 Guillaume DAVY
(** Functions printing the .ads file **)
22 f20d8ac7 Christophe Garion
module Main =
23
struct
24 48a6309c Guillaume DAVY
25 bdc471f3 Guillaume DAVY
(** Print the package declaration(ads) of a lustre node.
26
   @param fmt the formater to print on
27
   @param machine the machine
28
*)
29 48a6309c Guillaume DAVY
let print fmt machine =
30 c06b3b47 Guillaume DAVY
  let pp_record fmt = pp_record_definition fmt machine.mmemory in
31
  fprintf fmt "@[<v 2>%a;@,@,%a;@,@,%a;@,@,%a;@,@,%a;@,@,%a;@,@,private@,@,%a;@,@]@,%a@."
32
    (pp_begin_package false) machine (*Begin the package*)
33
    pp_private_type_decl pp_state_type (*Declare the state type*)
34
    pp_init_prototype machine (*Declare the init procedure*)
35
    pp_step_prototype machine (*Declare the step procedure*)
36
    pp_reset_prototype machine (*Declare the reset procedure*)
37
    pp_clear_prototype machine (*Declare the clear procedure*)
38
    pp_type_decl (pp_state_type, pp_record) (*Define the state type*)
39
    pp_end_package machine  (*End the package*)
40 bdc471f3 Guillaume DAVY
    (*(Utils.fprintf_list ~sep:"@," pp_var_decl) machine.mmemory*)
41 48a6309c Guillaume DAVY
42 f20d8ac7 Christophe Garion
end