OpenAADL / ocarina
1
------------------------------------------------------------------------------
2
--                                                                          --
3
--                           OCARINA COMPONENTS                             --
4
--                                                                          --
5
--    O C A R I N A . B A C K E N D S . A I R _ C O N F . M A P P I N G     --
6
--                                                                          --
7
--                                 B o d y                                  --
8
--                                                                          --
9
--         Copyright (C) 2018-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.Namet; use Ocarina.Namet;
33
with Ocarina.ME_AADL;
34
with Ocarina.ME_AADL.AADL_Instances.Nodes;
35
with Ocarina.ME_AADL.AADL_Instances.Nutils;
36

37
with Ocarina.Backends.XML_Tree.Nodes;
38
with Ocarina.Backends.XML_Tree.Nutils;
39

40
package body Ocarina.Backends.AIR_Conf.Mapping is
41

42
   use Ocarina.ME_AADL.AADL_Instances.Nodes;
43
   use Ocarina.Backends.XML_Tree.Nodes;
44
   use Ocarina.Backends.XML_Tree.Nutils;
45

46
   package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
47
   package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
48
   package XTN renames Ocarina.Backends.XML_Tree.Nodes;
49

50
   -----------------
51
   -- Map_HI_Node --
52
   -----------------
53

54 1
   function Map_HI_Node (E : Node_Id) return Node_Id is
55 1
      N : constant Node_Id := New_Node (XTN.K_HI_Node);
56
   begin
57
      pragma Assert
58 1
        (AINU.Is_Process (E)
59 1
         or else AINU.Is_System (E)
60 0
         or else AINU.Is_Processor (E));
61

62 1
      if AINU.Is_System (E) then
63 1
         Set_Str_To_Name_Buffer ("general");
64
      else
65 0
         Get_Name_String
66 0
           (To_XML_Name
67 0
              (AIN.Name (AIN.Identifier (AIN.Parent_Subcomponent (E)))));
68 0
         Add_Str_To_Name_Buffer ("_arinc653");
69
      end if;
70

71 1
      XTN.Set_Name (N, Name_Find);
72

73 1
      Set_Units (N, New_List (K_List_Id));
74

75
      --  Append the partition N to the node list
76

77 1
      Append_Node_To_List (N, HI_Nodes (Current_Entity));
78 1
      Set_Distributed_Application (N, Current_Entity);
79

80 1
      return N;
81
   end Map_HI_Node;
82

83
   -----------------
84
   -- Map_HI_Unit --
85
   -----------------
86

87 1
   function Map_HI_Unit (E : Node_Id) return Node_Id is
88 1
      U    : Node_Id;
89 1
      N    : Node_Id;
90 1
      P    : Node_Id;
91 1
      Q    : Node_Id;
92 1
      R    : Node_Id;
93 1
      Root : Node_Id;
94

95
   begin
96
      pragma Assert
97 1
        (AINU.Is_System (E)
98 0
         or else AINU.Is_Process (E)
99 0
         or else AINU.Is_Processor (E));
100

101 1
      U := New_Node (XTN.K_HI_Unit, AIN.Identifier (E));
102

103
      --  XML Configuration file
104

105 1
      Get_Name_String (To_XML_Name (Display_Name (Identifier (E))));
106 1
      Add_Str_To_Name_Buffer ("_air-conf");
107 1
      N := Make_Defining_Identifier (Name_Find);
108 1
      P := Make_XML_File (N);
109 1
      Set_Distributed_Application_Unit (P, U);
110 1
      XTN.Set_XML_File (U, P);
111

112
      --  Root of the XML Configuration file
113

114 1
      Root := Make_XML_Node ("ARINC_653_Module");
115

116 1
      Set_Str_To_Name_Buffer ("xmlns:xsi");
117 1
      R := Make_Defining_Identifier (Name_Find);
118

119 1
      Set_Str_To_Name_Buffer ("http://www.w3.org/2001/XMLSchema-instance");
120 1
      Q := Make_Defining_Identifier (Name_Find);
121

122 1
      Append_Node_To_List (Make_Assignement (R, Q), XTN.Items (Root));
123

124 1
      Set_Str_To_Name_Buffer ("ModuleName");
125 1
      R := Make_Defining_Identifier (Name_Find);
126

127 1
      Get_Name_String (To_XML_Name (Display_Name (Identifier (E))));
128 1
      Q := Make_Defining_Identifier (Name_Find);
129

130 1
      Append_Node_To_List (Make_Assignement (R, Q), XTN.Items (Root));
131

132 1
      XTN.Set_Root_Node (P, Root);
133

134 1
      Append_Node_To_List (U, Units (Current_Entity));
135 1
      XTN.Set_Entity (U, Current_Entity);
136

137 1
      return U;
138
   end Map_HI_Unit;
139

140
end Ocarina.Backends.AIR_Conf.Mapping;

Read our documentation on viewing source code .

Loading