source: trunk/ada-2012/src/semantic/gela-plain_interpretations.ads@ 552

Last change on this file since 552 was 511, checked in by Maxim Reznik, 5 years ago

Drop Cursor and Visiter for up interpretation set.

Replace it with Any_Cursor and iterator.

  • Property svn:keywords set to Author Date Revision
File size: 7.9 KB
Line 
1-- This package provides trivial Interpretation_Manager
2
3with Ada.Containers.Vectors;
4
5with Gela.Contexts;
6with Gela.Elements.Defining_Names;
7with Gela.Int_Sets;
8with Gela.Interpretations;
9with Gela.Lexical_Types;
10with Gela.Plain_Int_Sets;
11with Gela.Semantic_Types;
12
13package Gela.Plain_Interpretations is
14 pragma Preelaborate;
15
16 type Interpretation_Manager (Context : Gela.Contexts.Context_Access) is
17 limited new Gela.Interpretations.Interpretation_Manager
18 and Gela.Int_Sets.Index_Provider with private;
19
20 type Interpretation_Manager_Access is
21 access all Interpretation_Manager'Class;
22
23private
24
25 use type Gela.Interpretations.Interpretation_Index;
26 use type Gela.Interpretations.Interpretation_Set_Index;
27
28 Batch_Size : constant := 16 * 1024;
29
30 subtype Set_Batch is Gela.Interpretations.Interpretation_Set_Index
31 range 0 .. Interpretations.Interpretation_Set_Index'Last / Batch_Size;
32
33 subtype Item_Index is Gela.Interpretations.Interpretation_Index
34 range 0 .. Gela.Interpretations.Interpretation_Index'Last / Batch_Size;
35
36 package Set_Vectors is new Ada.Containers.Vectors
37 (Index_Type => Set_Batch,
38 Element_Type => Gela.Int_Sets.Interpretation_Set_Access,
39 "=" => Gela.Int_Sets."=");
40
41 package Item_Vectors is new Ada.Containers.Vectors
42 (Index_Type => Item_Index,
43 Element_Type => Gela.Int_Sets.Interpretation_Set_Access,
44 "=" => Gela.Int_Sets."=");
45
46 type Interpretation_Manager (Context : Gela.Contexts.Context_Access) is
47 limited new Gela.Interpretations.Interpretation_Manager
48 and Gela.Int_Sets.Index_Provider with
49 record
50 Plain_Int_Set : Gela.Plain_Int_Sets.Interpretation_Set_Access :=
51 new Gela.Plain_Int_Sets.Interpretation_Set
52 (Interpretation_Manager'Unchecked_Access);
53 Set_Batches : Set_Vectors.Vector;
54 Item_Batches : Item_Vectors.Vector;
55 end record;
56
57 overriding procedure Add_Defining_Name
58 (Self : in out Interpretation_Manager;
59 Name : Gela.Elements.Defining_Names.Defining_Name_Access;
60 Down : Gela.Interpretations.Interpretation_Index_Array;
61 Result : in out Gela.Interpretations.Interpretation_Set_Index);
62
63 overriding procedure Add_Expression
64 (Self : in out Interpretation_Manager;
65 Tipe : Gela.Semantic_Types.Type_Index;
66 Kind : Gela.Interpretations.Unknown_Auxiliary_Apply_Kinds :=
67 Gela.Interpretations.Unknown;
68 Down : Gela.Interpretations.Interpretation_Index_Array;
69 Result : in out Gela.Interpretations.Interpretation_Set_Index);
70
71 overriding procedure Add_Expression_Category
72 (Self : in out Interpretation_Manager;
73 Match : not null Gela.Interpretations.Type_Matcher_Access;
74 Down : Gela.Interpretations.Interpretation_Index_Array;
75 Result : in out Gela.Interpretations.Interpretation_Set_Index);
76
77 overriding procedure Add_Attr_Function
78 (Self : in out Interpretation_Manager;
79 Tipe : Gela.Semantic_Types.Type_Index;
80 Kind : Gela.Lexical_Types.Predefined_Symbols.Attribute;
81 Down : Gela.Interpretations.Interpretation_Index_Array;
82 Result : in out Gela.Interpretations.Interpretation_Set_Index);
83
84 overriding procedure Add_Placeholder
85 (Self : in out Interpretation_Manager;
86 Kind : Gela.Interpretations.Placeholder_Kind;
87 Result : in out Gela.Interpretations.Interpretation_Set_Index);
88
89 overriding procedure Add_Symbol
90 (Self : in out Interpretation_Manager;
91 Symbol : Gela.Lexical_Types.Symbol;
92 Result : in out Gela.Interpretations.Interpretation_Set_Index);
93
94 overriding procedure Add_Tuple
95 (Self : in out Interpretation_Manager;
96 Left : Gela.Interpretations.Interpretation_Set_Index;
97 Right : Gela.Interpretations.Interpretation_Tuple_Index;
98 Result : out Gela.Interpretations.Interpretation_Tuple_Index);
99
100 overriding procedure Add_Tuple_List
101 (Self : in out Interpretation_Manager;
102 Left : Gela.Interpretations.Interpretation_Tuple_Index;
103 Right : Gela.Interpretations.Interpretation_Tuple_List_Index;
104 Result : out Gela.Interpretations.Interpretation_Tuple_List_Index);
105
106 overriding procedure Get_Defining_Name_Index
107 (Self : in out Interpretation_Manager;
108 Name : Gela.Elements.Defining_Names.Defining_Name_Access;
109 Result : out Gela.Interpretations.Interpretation_Index);
110
111 overriding procedure Get_Expression_Index
112 (Self : in out Interpretation_Manager;
113 Tipe : Gela.Semantic_Types.Type_Index;
114 Result : out Gela.Interpretations.Interpretation_Index);
115
116 overriding procedure Get_Tuple_Index
117 (Self : in out Interpretation_Manager;
118 Left : Gela.Interpretations.Interpretation_Index;
119 Right : Gela.Interpretations.Interpretation_Index;
120 Result : out Gela.Interpretations.Interpretation_Index);
121
122 overriding function Get_Tuple
123 (Self : in out Interpretation_Manager;
124 Index : Gela.Interpretations.Interpretation_Tuple_Index)
125 return Gela.Interpretations.Interpretation_Set_Index_Array;
126
127 overriding function Get_Tuple_List
128 (Self : in out Interpretation_Manager;
129 Index : Gela.Interpretations.Interpretation_Tuple_List_Index)
130 return Gela.Interpretations.Interpretation_Tuple_Index_Array;
131
132 overriding procedure Visit
133 (Self : in out Interpretation_Manager;
134 Index : Gela.Interpretations.Interpretation_Index;
135 Target : in out Gela.Interpretations.Down_Visiter'Class);
136 -- For given interpretations call Target visiter
137
138 overriding procedure Get_Down_Interpretation
139 (Self : in out Interpretation_Manager;
140 Value : Gela.Interpretations.Interpretation_Index;
141 Index : Positive;
142 Result : out Gela.Interpretations.Interpretation_Index);
143 -- Return interpretation from which Value was derived
144
145 overriding procedure Get_Defining_Name
146 (Self : in out Interpretation_Manager;
147 Value : Gela.Interpretations.Interpretation_Index;
148 Result : out Gela.Elements.Defining_Names.Defining_Name_Access);
149
150 overriding procedure Reserve_Indexes
151 (Self : in out Interpretation_Manager;
152 Set : Gela.Int_Sets.Interpretation_Set_Access;
153 From : out Gela.Interpretations.Interpretation_Set_Index;
154 To : out Gela.Interpretations.Interpretation_Set_Index);
155
156 overriding procedure Reserve_Indexes
157 (Self : in out Interpretation_Manager;
158 Set : Gela.Int_Sets.Interpretation_Set_Access;
159 From : out Gela.Interpretations.Interpretation_Index;
160 To : out Gela.Interpretations.Interpretation_Index);
161
162 overriding function Symbols
163 (Self : in out Interpretation_Manager;
164 Set : Gela.Interpretations.Interpretation_Set_Index)
165 return Gela.Interpretations.Symbol_Iterators
166 .Forward_Iterator'Class;
167
168 overriding function Defining_Names
169 (Self : in out Interpretation_Manager;
170 Set : Gela.Interpretations.Interpretation_Set_Index)
171 return Gela.Interpretations.Defining_Name_Iterators
172 .Forward_Iterator'Class;
173
174 overriding function Expressions
175 (Self : in out Interpretation_Manager;
176 Set : Gela.Interpretations.Interpretation_Set_Index)
177 return Gela.Interpretations.Expression_Iterators
178 .Forward_Iterator'Class;
179
180 overriding function Categories
181 (Self : in out Interpretation_Manager;
182 Set : Gela.Interpretations.Interpretation_Set_Index)
183 return Gela.Interpretations.Category_Iterators
184 .Forward_Iterator'Class;
185
186 overriding function Profiles
187 (Self : in out Interpretation_Manager;
188 Set : Gela.Interpretations.Interpretation_Set_Index)
189 return Gela.Interpretations.Profile_Iterators
190 .Forward_Iterator'Class;
191
192 overriding function Each
193 (Self : in out Interpretation_Manager;
194 Set : Gela.Interpretations.Interpretation_Set_Index)
195 return Gela.Interpretations.Any_Iterators
196 .Forward_Iterator'Class;
197
198end Gela.Plain_Interpretations;
Note: See TracBrowser for help on using the repository browser.