OpenAADL / ocarina
1
------------------------------------------------------------------------------
2
--                                                                          --
3
--                           OCARINA COMPONENTS                             --
4
--                                                                          --
5
--     O C A R I N A . B A C K E N D S . V X W O R K S 6 5 3 _ C O N F      --
6
--                                                                          --
7
--                                 B o d y                                  --
8
--                                                                          --
9
--         Copyright (C) 2015-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.Nodes;
36
with Ocarina.Backends.XML_Tree.Nutils;
37
with Ocarina.Backends.XML_Tree.Generator;
38
with Ocarina.Backends.Vxworks653_Conf.Hm;
39
with Ocarina.Backends.Vxworks653_Conf.Schedule;
40
with Ocarina.Backends.Vxworks653_Conf.Naming;
41
with Ocarina.Backends.Vxworks653_Conf.Partitions;
42
with Ocarina.Backends.Vxworks653_Conf.Payloads;
43
with Ocarina.Backends.Vxworks653_Conf.Connections;
44
with Ocarina.Backends.Utils;
45

46
with Ocarina.Namet; use Ocarina.Namet;
47

48
package body Ocarina.Backends.Vxworks653_Conf is
49

50
   use Ocarina.Instances;
51
   use Ocarina.Backends.Expander;
52
   use Ocarina.Backends.Messages;
53
   use Ocarina.Backends.Utils;
54

55
   package XTN renames Ocarina.Backends.XML_Tree.Nodes;
56
   package XTU renames Ocarina.Backends.XML_Tree.Nutils;
57

58
   --------------
59
   -- Generate --
60
   --------------
61

62 1
   procedure Generate (AADL_Root : Node_Id) is
63 1
      Instance_Root : Node_Id;
64
   begin
65

66 1
      Instance_Root := Instantiate_Model (AADL_Root);
67

68 1
      Expand (Instance_Root);
69

70 1
      Visit_Architecture_Instance (Instance_Root);
71
      --  Abort if the construction of the tree failed
72

73 1
      if No (XML_Root) then
74 0
         Display_Error
75
           ("Vxworks653 configuration generation failed",
76
            Fatal => True);
77
      end if;
78

79
      --  At this point, we have a valid tree, we can begin the XML
80
      --  file generation.
81

82
      --  Enter the output directory
83

84 1
      Enter_Directory (Generated_Sources_Directory);
85

86 1
      if not Remove_Generated_Sources then
87
         --  Create the source files
88

89 1
         XML_Tree.Generator.Generate (XML_Root);
90

91
      end if;
92

93
      --  Leave the output directory
94 1
      Leave_Directory;
95 1
   end Generate;
96

97
   ----------
98
   -- Init --
99
   ----------
100

101 1
   procedure Init is
102
   begin
103 1
      Register_Backend ("Vxworks653_Conf", Generate'Access, Vxworks653_XML);
104 1
   end Init;
105

106
   -----------
107
   -- Reset --
108
   -----------
109

110 0
   procedure Reset is
111
   begin
112 0
      null;
113 0
   end Reset;
114

115
   ---------------------------------
116
   -- Visit_Architecture_Instance --
117
   ---------------------------------
118

119 1
   procedure Visit_Architecture_Instance (E : Node_Id) is
120
   begin
121 1
      XML_Root := XTU.New_Node (XTN.K_HI_Distributed_Application);
122 1
      Set_Str_To_Name_Buffer ("generated-code");
123 1
      XTN.Set_Name (XML_Root, Name_Find);
124 1
      XTN.Set_Units (XML_Root, XTU.New_List (XTN.K_List_Id));
125 1
      XTN.Set_HI_Nodes (XML_Root, XTU.New_List (XTN.K_List_Id));
126

127 1
      XTU.Push_Entity (XML_Root);
128

129 1
      Vxworks653_Conf.Naming.Visit (E);
130 1
      Vxworks653_Conf.Partitions.Visit (E);
131 1
      Vxworks653_Conf.Schedule.Visit (E);
132 1
      Vxworks653_Conf.Connections.Visit (E);
133 1
      Vxworks653_Conf.Hm.Visit (E);
134 1
      Vxworks653_Conf.Payloads.Visit (E);
135

136 1
      XTU.Pop_Entity;
137

138 1
   end Visit_Architecture_Instance;
139

140
   ------------------
141
   -- Get_XML_Root --
142
   ------------------
143

144 0
   function Get_XML_Root return Node_Id is
145
   begin
146 0
      return XML_Root;
147
   end Get_XML_Root;
148

149
end Ocarina.Backends.Vxworks653_Conf;

Read our documentation on viewing source code .

Loading