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

33
with Locations;
34
with Ocarina.Types;
35

36
with Ocarina.ME_AADL.AADL_Instances.Nodes;
37

38
package Ocarina.ME_AADL.AADL_Instances.Nutils is
39

40
   use Locations;
41
   use Ocarina.Types;
42
   use Ocarina.ME_AADL.AADL_Instances.Nodes;
43

44
   procedure Append_List_To_List (S : List_Id; D : in out List_Id);
45
   pragma Inline (Append_List_To_List);
46
   --  Append list S to list D, if D does not exist, then D := S
47

48
   procedure Push_Node_To_List (E : Node_Id; L : List_Id);
49
   --  Add node N to the front of list L
50

51
   procedure Append_Node_To_List (E : Node_Id; L : List_Id);
52
   --  Append node N to list L (to the end of list L)
53

54
   procedure Append_Node_To_Node_List
55
     (Node :        Node_Id;
56
      List : in out Node_List;
57
      Once :        Boolean := True);
58
   --  Append Node to List. If Once true, do not append when Node
59
   --  already there.
60

61
   procedure Replace_Node_To_List
62
     (List     : List_Id;
63
      Old_Node : Node_Id;
64
      New_Node : Node_Id);
65

66
   procedure Remove_Nodes_From_List (List : in out Node_List);
67
   --  Clear all links between the nodes of List.
68

69
   procedure Remove_Node_From_List (E : Node_Id; L : List_Id);
70
   --  Remove node N to list L.
71

72
   function Remove_Last_Node_From_List (L : List_Id) return Node_Id;
73
   --  Remove the last node from list L, return the removed node
74
   --  Return No_Node if L does not exists or is empty
75

76
   function Is_Empty (L : List_Id) return Boolean;
77
   pragma Inline (Is_Empty);
78
   --  Return true when L is empty
79

80
   function Length (L : List_Id) return Natural;
81
   --  Return the length of list L
82

83
   type Node_Array is array (Natural range <>) of Node_Id;
84
   No_Nodes : constant Node_Array (1 .. 0) := (others => No_Node);
85

86
   function To_Node_Array (L : List_Id) return Node_Array;
87
   --  Conver List_Id L into a Node_Array
88

89 0
   function Is_In (N : Node_Id; N_Array : Node_Array) return Boolean is
90 0
      (for some E of N_Array => N = E);
91

92
   function New_Node (Kind : Node_Kind; Loc : Location) return Node_Id;
93
   --  Create a new node
94

95
   function New_List (Kind : Node_Kind; Loc : Location) return List_Id;
96
   --  Create a new list
97

98
   function Make_Node_Container
99
     (Item       : Node_Id;
100
      Extra_Item : Node_Id := No_Node) return Node_Id;
101
   --  Creates a container for the nodes Item and Extra_Item to be able
102
   --  to put one node in several lists
103

104
   procedure Reset_Nodes;
105
   --  Reset the table that contains the nodes. Beware that everything
106
   --  will be lost.
107

108
   function Compute_Full_Name_Of_Instance
109
     (Instance         : Node_Id;
110
      Display_Name     : Boolean := False;
111
      Keep_Root_System : Boolean := True) return Name_Id;
112
   --  Return the complete name (i.e. containing the names of the
113
   --  parent components) of a given component instance. If the
114
   --  Display_Name flag is set, return the display name (any upper
115
   --  case charecters will be conserved. If Keep_Root_System is set
116
   --  to false, the heading root system name will be removed from the
117
   --  full name.
118

119
   function Split_Name (N : Node_Id) return List_Id;
120
   --  Starting from a namespace node N whose name is in the form
121
   --  n1::n2::..., return a list of identifiers whose names are n1,
122
   --  n2...Return a null list if N has no name
123

124
   function Make_Identifier
125
     (Loc          : Location;
126
      Name         : Name_Id;
127
      Display_Name : Name_Id;
128
      Entity       : Node_Id) return Node_Id;
129
   --  Make an identifier
130

131
   function Copy_Node (Original : Node_Id) return Node_Id;
132
   --  Copy an instance node. Duplicate an identifier instance tree node.
133
   --  XXX remove and use Duplicate_Identifier if there is no change
134
   --  when we instantiate properly feature group.
135

136
   function Find_Name_In_List
137
     (Name_Node : Name_Id;
138
      List      : List_Id) return Node_Id;
139
   --  Find a node with a given name in a list. This function
140
   --  was introduced to search for a feature located in a
141
   --  feature group and does not provide advanced search features
142
   --  at this time.
143

144
   --  The routines below are used to check the category of a
145
   --  component or subcomponent instance.
146

147
   function Is_Abstract (C : Node_Id) return Boolean;
148
   function Is_Data (C : Node_Id) return Boolean;
149
   function Is_Memory (C : Node_Id) return Boolean;
150
   function Is_Subprogram (C : Node_Id) return Boolean;
151
   function Is_Process (C : Node_Id) return Boolean;
152
   function Is_Device (C : Node_Id) return Boolean;
153
   function Is_Process_Or_Device (C : Node_Id) return Boolean;
154
   function Is_Thread (C : Node_Id) return Boolean;
155
   function Is_System (C : Node_Id) return Boolean;
156
   function Is_Processor (C : Node_Id) return Boolean;
157
   function Is_Virtual_Processor (C : Node_Id) return Boolean;
158
   function Is_Bus (C : Node_Id) return Boolean;
159
   function Is_Virtual_Bus (C : Node_Id) return Boolean;
160
   function Is_Subprogram_Access (C : Node_Id) return Boolean;
161
   function Is_Port (C : Node_Id) return Boolean;
162

163
end Ocarina.ME_AADL.AADL_Instances.Nutils;

Read our documentation on viewing source code .

Loading