taste-data_view.ads 1.89 KB
Newer Older
1
2
3
4
5
6
--  *************************** taste aadl parser ***********************  --
--  (c) 2018 European Space Agency - maxime.perrotin@esa.int
--  LGPL license, see LICENSE file

--  Data View parser

Maxime Perrotin's avatar
Maxime Perrotin committed
7
with Text_IO,
8
9
     Ada.Containers.Indefinite_Ordered_Maps,
     Ada.Strings.Unbounded,
Maxime Perrotin's avatar
Maxime Perrotin committed
10
11
     Ocarina,
     Ocarina.Types,
12
13
     TASTE.Parser_Utils;

Maxime Perrotin's avatar
Maxime Perrotin committed
14
use Text_IO,
15
16
    Ada.Containers,
    Ada.Strings.Unbounded,
Maxime Perrotin's avatar
Maxime Perrotin committed
17
18
    Ocarina,
    Ocarina.Types,
19
20
21
22
23
24
25
26
27
    TASTE.Parser_Utils;

package TASTE.Data_View is
   use String_Vectors;

   --  Exceptions specific to the Data View
   Data_View_Error   : exception;

   --  Extra files needed to parse the Data view (dependency hell)
Maxime Perrotin's avatar
Maxime Perrotin committed
28
29
30
31
32
33
34
35
36
37
38
   Data_View_AADL_Lib : String_Vectors.Vector :=
     Empty_Vector
     & "aadl_project.aadl"
     & "taste_properties.aadl"
     & "communication_properties.aadl"
     & "timing_properties.aadl"
     & "programming_properties.aadl"
     & "memory_properties.aadl"
     & "base_types.aadl"
     & "data_model.aadl"
     & "deployment.aadl";
39

Maxime Perrotin's avatar
Maxime Perrotin committed
40
41
42
43
44
45
   type ASN1_Module is
      record
         Name  : Unbounded_String;
         Types : String_Vectors.Vector;
      end record;

Maxime Perrotin's avatar
Maxime Perrotin committed
46
   package ASN1_Module_Maps is new Indefinite_Ordered_Maps
Maxime Perrotin's avatar
Maxime Perrotin committed
47
     (String, ASN1_Module);
Maxime Perrotin's avatar
Maxime Perrotin committed
48

49
50
51
   type ASN1_File is
      record
         Path    : Unbounded_String;
Maxime Perrotin's avatar
Maxime Perrotin committed
52
         Modules : ASN1_Module_Maps.Map;
53
      end record;
Maxime Perrotin's avatar
Maxime Perrotin committed
54
   package ASN1_File_Maps is new Indefinite_Ordered_Maps (String, ASN1_File);
55
56
57

   type Taste_Data_View is tagged
      record
Maxime Perrotin's avatar
Maxime Perrotin committed
58
         ASN1_Files : ASN1_File_Maps.Map;
59
60
61
      end record;

   function Parse_Data_View (Dataview_Root : Node_Id) return Taste_Data_View
62
63
64
     with Pre => Dataview_Root /= No_Node;

   procedure Check_Files (DV : Taste_Data_View);
65

Maxime Perrotin's avatar
Maxime Perrotin committed
66
   procedure Debug_Dump (DV : Taste_Data_View; Output : File_Type);
67

68
69
70
   --  Make a local copy of ASN.1 files to allow project export
   procedure Export_ASN1_Files (DV : Taste_Data_View; Output_Path : String);

71
end TASTE.Data_View;