ocarina-analyzer-aadl-finder.ads 8.44 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
------------------------------------------------------------------------------
--                                                                          --
--                           OCARINA COMPONENTS                             --
--                                                                          --
--         O C A R I N A . A N A L Y Z E R . A A D L . F I N D E R          --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
--                 Copyright (C) 2009, GET-Telecom Paris.                   --
--                                                                          --
-- Ocarina  is free software;  you  can  redistribute  it and/or  modify    --
-- it under terms of the GNU General Public License as published by the     --
-- Free Software Foundation; either version 2, or (at your option) any      --
-- later version. Ocarina is distributed  in  the  hope  that it will be    --
-- useful, but WITHOUT ANY WARRANTY;  without even the implied warranty of  --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received  a copy of the --
-- GNU General Public License distributed with Ocarina; see file COPYING.   --
-- If not, write to the Free Software Foundation, 51 Franklin Street, Fifth --
-- Floor, Boston, MA 02111-1301, USA.                                       --
--                                                                          --
-- As a special exception,  if other files  instantiate  generics from this --
-- unit, or you link  this unit with other files  to produce an executable, --
-- this  unit  does not  by itself cause  the resulting  executable to be   --
-- covered  by the  GNU  General  Public  License. This exception does not  --
-- however invalidate  any other reasons why the executable file might be   --
-- covered by the GNU Public License.                                       --
--                                                                          --
--                 Ocarina is maintained by the Ocarina team                --
--                       (ocarina-users@listes.enst.fr)                     --
--                                                                          --
------------------------------------------------------------------------------

--  This package provides functions to search nodes in the abstract
--  tree. The functions return No_Node if nothing was found.

with Ocarina.ME_AADL.AADL_Tree.Nodes;

package Ocarina.Analyzer.AADL.Finder is

   type Node_Kind_Array is array (Positive range <>)
     of Ocarina.Me_AADL.AADL_Tree.Nodes.Node_Kind;

   procedure Select_Nodes
     (Decl_List  :        List_Id;
      Kinds      :        Node_Kind_Array;
      First_Node : in out Node_Id;
      Last_Node  : in out Node_Id);
   --  Build a list (chained using the accessor Next_Entity) from
   --  Decl_List and appends it to Last_Node. This list will contain
   --  the nodes whose kinds correspond to Kinds.

   function Find_Property_Entity
     (Root                    : Node_Id;
      Property_Set_Identifier : Node_Id;
      Property_Identifier     : Node_Id)
     return Node_Id;
   --  Find a property entity (type, name or constant). If
   --  Property_Set_Identifier is No_Node and the current scope is the
   --  one of a property set, try to find the property in it. Finally,
hugues.jerome's avatar
hugues.jerome committed
61
   --  look for the implicit property sets.
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

   function Find_Component_Classifier
     (Root                 : Node_Id;
      Package_Identifier   : Node_Id;
      Component_Identifier : Node_Id)
     return Node_Id;
   --  Same as above, but find a component classifier

   function Find_Port_Group_Classifier
     (Root                  : Node_Id;
      Package_Identifier    : Node_Id;
      Port_Group_Identifier : Node_Id)
     return Node_Id;
   --  Same as above, but find a port group

   function Find_Feature
     (Component          : Node_Id;
      Feature_Identifier : Node_Id)
     return Node_Id;
   --  Find a feature in a component type or implementation

   function Find_Mode
     (Component       : Node_Id;
      Mode_Identifier : Node_Id)
     return Node_Id;
   --  Same as above, but find a mode

89
90
91
92
93
94
   function Find_Prototype
     (Component            : Node_Id;
      Prototype_Identifier : Node_Id)
     return Node_Id;
   --  XXX

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
   function Find_Subcomponent
     (Component               : Node_Id;
      Subcomponent_Identifier : Node_Id;
      In_Modes                : Node_Id := No_Node)
     return Node_Id;
   --  Find a subcomponent in a component implementation. If In_Modes
   --  is specified, return the subcomponent that are set in the
   --  given modes.

   function Find_Subprogram_Call
     (Component       : Node_Id;
      Call_Identifier : Node_Id;
      In_Modes        : Node_Id := No_Node)
     return Node_Id;
   --  Same as above but find a subprogram call

   function Find_Connection
     (Component             : Node_Id;
      Connection_Identifier : Node_Id;
      In_Modes              : Node_Id := No_Node)
     return Node_Id;
   --  Same as above but find a connection

   function Find_Flow_Spec
     (Component       : Node_Id;
      Flow_Identifier : Node_Id)
     return Node_Id;
   --  Find a flow in a component type or implementation

   function Find_Subclause
     (Component  : Node_Id;
      Identifier : Node_Id)
     return Node_Id;
   --  Same as above but find a subclause

   function Find_All_Declarations
     (Root      : Node_Id;
      Kinds     : Node_Kind_Array;
      Namespace : Node_Id := No_Node)
     return Node_List;
   --  Returns the first node of a list of declarations corresponding
   --  to the Kinds requested. Following nodes are accessed through
   --  the Next_Entity accessor. If no Kinds are requested, then
   --  return all the declarations found. If the Namespace is not
   --  given, search the declaration in the whole AADL specification
   --  declarations and its namespaces. Otherwise, search the
   --  declaration in the given namespace.

   function Find_All_Component_Types
     (Root      : Node_Id;
      Namespace : Node_Id := No_Node)
     return Node_List;
   --  Return the first component type found in the Namespace. If
   --  Namespace is No_Node, then return the first component type
   --  declaration in the whole AADL specification. Following
   --  declarations are accessed using the Next_Entity accessor.

   function Find_All_Root_Systems (Root : Node_Id) return Node_List;
   --  Return all systems implementations whose component type do not
   --  have any feature. Those systems correspond to the roots of the
   --  instantiated architecture.

hugues.jerome's avatar
hugues.jerome committed
157
   function Find_All_Subclauses
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
     (AADL_Declaration : Node_Id;
      Kinds            : Node_Kind_Array)
     return Node_List;
   --  General function that returns the first node of a list of
   --  subclauses corresponding to the Kinds requested. Following
   --  nodes are accessed through the Next_Entity accessor.

   function Find_All_Features
     (AADL_Declaration : Node_Id)
     return Node_List;
   --  Applicable to component types and implementations, and port
   --  group types.

   function Find_All_Subclause_Declarations_Except_Properties
     (AADL_Declaration : Node_Id)
     return Node_List;
   --  Applicable to component types and implementations, and port
   --  group types.

   function Find_All_Property_Associations
     (AADL_Declaration : Node_Id)
     return Node_List;
   --  Applicable to component types and implementations, and port
   --  group types.

   function Find_Property_Association
     (AADL_Declaration          : Node_Id;
      Property_Association_Name : Name_Id)
     return Node_Id;
   --  Find the property association named
   --  Property_Association_Name. Return No_Node if nothing was found.

   function Find_Property_Enumeration
     (Root               : Node_Id;
      Container          : Node_Id;
      Property_Container : Node_Id;
      Default_Value      : Node_Id;
      Designator         : Node_Id)
     return Node_Id;

   function Find_In_Import_Declaration
     (Package_Container : Node_Id;
      Node              : Node_Id)
     return Boolean;
   --  The kind of Package_Container is K_Package_Specification,
   --  the kind of Node is K_Identifier or K_ENtity_Reference,
   --  return True if the Node is 'with' in Package_Container
   --  'with' declarations.

end Ocarina.Analyzer.AADL.Finder;