1
------------------------------------------------------------------------------
2
--                                                                          --
3
--                           OCARINA COMPONENTS                             --
4
--                                                                          --
5
--            O C A R I N A . A N A L Y Z E R . A A D L _ E M A             --
6
--                                                                          --
7
--                                 B o d y                                  --
8
--                                                                          --
9
--         Copyright (C) 2016-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.Analyzer.AADL_EMA.Naming_Rules;
33
with Ocarina.ME_AADL_EMA.EMA_Tree.Nodes;
34
with Ocarina.ME_AADL.AADL_Tree.Nodes;
35
with Ocarina.ME_AADL_EMA.EMA_Tree.Nutils;
36
with Ocarina.Analyzer.AADL_EMA.Finder;
37

38
package body Ocarina.Analyzer.AADL_EMA is
39

40
   use Ocarina.Analyzer.AADL_EMA.Naming_Rules;
41
   use Ocarina.ME_AADL_EMA.EMA_Tree.Nodes;
42
   use Ocarina.Analyzer.AADL_EMA.Finder;
43

44
   package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes;
45
   package ANU renames Ocarina.ME_AADL_EMA.EMA_Tree.Nutils;
46
   package EMATN renames Ocarina.ME_AADL_EMA.EMA_Tree.Nodes;
47

48
   Language : constant String := "emv2";
49

50
   ----------
51
   -- Init --
52
   ----------
53

54 1
   procedure Init is
55
   begin
56 1
      ANU.Init;
57 1
      Ocarina.Analyzer.Register_Analyzer (Language, Analyze_Model'Access);
58 1
   end Init;
59

60
   -----------
61
   -- Reset --
62
   -----------
63

64 1
   procedure Reset is
65
   begin
66 1
      ANU.Reset;
67 1
   end Reset;
68

69
   -------------------
70
   -- Analyze_Model --
71
   -------------------
72

73 0
   function Analyze_Model (Root : Node_Id) return Boolean is
74
      use ATN;
75

76 0
      pragma Assert (ATN.Kind (Root) = ATN.K_AADL_Specification);
77

78 0
      Success : Boolean := True;
79 0
      EMA_Root : Node_Id;
80 0
      Roots : Node_List;
81 0
      Packages : Node_List;
82 0
      Package_Spec : Node_Id;
83 0
      Pass_To_Next : Boolean := False;
84
   begin
85 0
      Get_EMA_Annexes_List
86
      (Root,
87
       Roots.First,
88
       Roots.Last,
89
       Packages.First,
90
       Packages.Last);
91

92 0
      EMA_Root := Roots.First;
93 0
      Package_Spec := Packages.First;
94 0
      while Present (EMA_Root) loop
95 0
         if EMATN.Kind (EMA_Root) = EMATN.K_Annex_Subclause then
96 0
            Success := Success and then
97 0
                 Check_Names_In_Subclause (Root, EMA_Root, Package_Spec);
98 0
            Pass_To_Next := True;
99 0
         elsif EMATN.Kind (EMA_Root) = EMATN.K_Annex_Library then
100 0
            Success := Success and then
101 0
                 Check_Names_In_Library (Root, EMA_Root, Package_Spec);
102 0
            Pass_To_Next := True;
103
         else
104 0
            Pass_To_Next := False;
105
         end if;
106

107 0
         if Pass_To_Next and then Present (Package_Spec)
108
         then
109 0
            Package_Spec := ATN.Next_Entity (Package_Spec);
110
         end if;
111

112 0
         EMA_Root := EMATN.Next_Node (EMA_Root);
113 0
      end loop;
114

115 0
      return Success;
116 0
   end Analyze_Model;
117

118
end Ocarina.Analyzer.AADL_EMA;

Read our documentation on viewing source code .

Loading