1
------------------------------------------------------------------------------
2
--                                                                          --
3
--                           OCARINA COMPONENTS                             --
4
--                                                                          --
5
--   O C A R I N A . B A C K E N D S . C O N N E C T I O N _ M A T R I X    --
6
--                                                                          --
7
--                                 B o d y                                  --
8
--                                                                          --
9
--         Copyright (C) 2011-2019 ESA & ISAE, 2019-2020 OpenAADL           --
10
--                                                                          --
11
-- Ocarina  is free software; you can redistribute it and/or modify under   --
12
-- terms of the  GNU General Public License as published  by the Free Soft- --
13
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
14
-- sion. Ocarina is distributed in the hope that it will be useful, but     --
15
-- WITHOUT ANY WARRANTY; without even the implied warranty of               --
16
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     --
17
--                                                                          --
18
-- As a special exception under Section 7 of GPL version 3, you are granted --
19
-- additional permissions described in the GCC Runtime Library Exception,   --
20
-- version 3.1, as published by the Free Software Foundation.               --
21
--                                                                          --
22
-- You should have received a copy of the GNU General Public License and    --
23
-- a copy of the GCC Runtime Library Exception along with this program;     --
24
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
25
-- <http://www.gnu.org/licenses/>.                                          --
26
--                                                                          --
27
--                    Ocarina is maintained by OpenAADL team                --
28
--                              (info@openaadl.org)                         --
29
--                                                                          --
30
------------------------------------------------------------------------------
31

32
with Ocarina.Instances;
33
with Ocarina.Backends.Messages;
34
with Ocarina.Backends.Expander;
35
with Ocarina.Backends.XML_Tree.Generator;
36
with Ocarina.Backends.Utils;
37
with Ocarina.Backends.Connection_Matrix.Main;
38

39
package body Ocarina.Backends.Connection_Matrix is
40

41
   use Ocarina.Instances;
42
   use Ocarina.Backends.Expander;
43
   use Ocarina.Backends.Messages;
44
   use Ocarina.Backends.Utils;
45

46
   procedure Visit_Architecture_Instance (E : Node_Id);
47
   --  Most top level visitor routine. E is the root of the AADL
48
   --  instance tree. The procedure does a traversal for each
49
   --  compilation unit to be generated.
50

51
   --------------
52
   -- Generate --
53
   --------------
54

55 1
   procedure Generate (AADL_Root : Node_Id) is
56 1
      Instance_Root : Node_Id;
57
   begin
58

59 1
      Instance_Root := Instantiate_Model (AADL_Root);
60

61 1
      Expand (Instance_Root);
62

63 1
      Visit_Architecture_Instance (Instance_Root);
64
      --  Abort if the construction of the tree failed
65

66 1
      if No (XML_Root) then
67 0
         Display_Error ("Statistics generation failed", Fatal => True);
68
      end if;
69

70
      --  At this point, we have a valid tree, we can begin the XML
71
      --  file generation.
72

73
      --  Enter the output directory
74

75 1
      Enter_Directory (Generated_Sources_Directory);
76

77 1
      if not Remove_Generated_Sources then
78
         --  Create the source files
79

80 1
         XML_Tree.Generator.Generate (XML_Root);
81

82
      end if;
83

84
      --  Leave the output directory
85 1
      Leave_Directory;
86 1
   end Generate;
87

88
   ----------
89
   -- Init --
90
   ----------
91

92 1
   procedure Init is
93
   begin
94 1
      Register_Backend
95
        ("Connection_Matrix",
96
         Generate'Access,
97
         Connection_Matrix_Analysis);
98 1
   end Init;
99

100
   -----------
101
   -- Reset --
102
   -----------
103

104 1
   procedure Reset is
105
   begin
106 1
      null;
107 1
   end Reset;
108

109
   ---------------------------------
110
   -- Visit_Architecture_Instance --
111
   ---------------------------------
112

113 1
   procedure Visit_Architecture_Instance (E : Node_Id) is
114
   begin
115 1
      Main.Visit (E);
116

117 1
   end Visit_Architecture_Instance;
118

119
end Ocarina.Backends.Connection_Matrix;

Read our documentation on viewing source code .

Loading