OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [ada/] [a-cidlli.ads] - Blame information for rev 523

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 281 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT LIBRARY COMPONENTS                          --
4
--                                                                          --
5
--               ADA.CONTAINERS.INDEFINITE_DOUBLY_LINKED_LISTS              --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 2004-2009, Free Software Foundation, Inc.         --
10
--                                                                          --
11
-- This specification is derived from the Ada Reference Manual for use with --
12
-- GNAT. The copyright notice above, and the license provisions that follow --
13
-- apply solely to the  contents of the part following the private keyword. --
14
--                                                                          --
15
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
16
-- terms of the  GNU General Public License as published  by the Free Soft- --
17
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
18
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
19
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
20
-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
21
--                                                                          --
22
-- As a special exception under Section 7 of GPL version 3, you are granted --
23
-- additional permissions described in the GCC Runtime Library Exception,   --
24
-- version 3.1, as published by the Free Software Foundation.               --
25
--                                                                          --
26
-- You should have received a copy of the GNU General Public License and    --
27
-- a copy of the GCC Runtime Library Exception along with this program;     --
28
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
29
-- <http://www.gnu.org/licenses/>.                                          --
30
--                                                                          --
31
-- This unit was originally developed by Matthew J Heaney.                  --
32
------------------------------------------------------------------------------
33
 
34
private with Ada.Finalization;
35
private with Ada.Streams;
36
 
37
generic
38
   type Element_Type (<>) is private;
39
 
40
   with function "=" (Left, Right : Element_Type)
41
      return Boolean is <>;
42
 
43
package Ada.Containers.Indefinite_Doubly_Linked_Lists is
44
   pragma Preelaborate;
45
   pragma Remote_Types;
46
 
47
   type List is tagged private;
48
   pragma Preelaborable_Initialization (List);
49
 
50
   type Cursor is private;
51
   pragma Preelaborable_Initialization (Cursor);
52
 
53
   Empty_List : constant List;
54
 
55
   No_Element : constant Cursor;
56
 
57
   function "=" (Left, Right : List) return Boolean;
58
 
59
   function Length (Container : List) return Count_Type;
60
 
61
   function Is_Empty (Container : List) return Boolean;
62
 
63
   procedure Clear (Container : in out List);
64
 
65
   function Element (Position : Cursor) return Element_Type;
66
 
67
   procedure Replace_Element
68
     (Container : in out List;
69
      Position  : Cursor;
70
      New_Item  : Element_Type);
71
 
72
   procedure Query_Element
73
     (Position : Cursor;
74
      Process  : not null access procedure (Element : Element_Type));
75
 
76
   procedure Update_Element
77
     (Container : in out List;
78
      Position  : Cursor;
79
      Process   : not null access procedure (Element : in out Element_Type));
80
 
81
   procedure Move
82
     (Target : in out List;
83
      Source : in out List);
84
 
85
   procedure Insert
86
     (Container : in out List;
87
      Before    : Cursor;
88
      New_Item  : Element_Type;
89
      Count     : Count_Type := 1);
90
 
91
   procedure Insert
92
     (Container : in out List;
93
      Before    : Cursor;
94
      New_Item  : Element_Type;
95
      Position  : out Cursor;
96
      Count     : Count_Type := 1);
97
 
98
   procedure Prepend
99
     (Container : in out List;
100
      New_Item  : Element_Type;
101
      Count     : Count_Type := 1);
102
 
103
   procedure Append
104
     (Container : in out List;
105
      New_Item  : Element_Type;
106
      Count     : Count_Type := 1);
107
 
108
   procedure Delete
109
     (Container : in out List;
110
      Position  : in out Cursor;
111
      Count     : Count_Type := 1);
112
 
113
   procedure Delete_First
114
     (Container : in out List;
115
      Count     : Count_Type := 1);
116
 
117
   procedure Delete_Last
118
     (Container : in out List;
119
      Count     : Count_Type := 1);
120
 
121
   procedure Reverse_Elements (Container : in out List);
122
 
123
   procedure Swap (Container : in out List; I, J : Cursor);
124
 
125
   procedure Swap_Links (Container : in out List; I, J : Cursor);
126
 
127
   procedure Splice
128
     (Target : in out List;
129
      Before : Cursor;
130
      Source : in out List);
131
 
132
   procedure Splice
133
     (Target   : in out List;
134
      Before   : Cursor;
135
      Source   : in out List;
136
      Position : in out Cursor);
137
 
138
   procedure Splice
139
     (Container : in out List;
140
      Before    : Cursor;
141
      Position  : Cursor);
142
 
143
   function First (Container : List) return Cursor;
144
 
145
   function First_Element (Container : List) return Element_Type;
146
 
147
   function Last (Container : List) return Cursor;
148
 
149
   function Last_Element (Container : List) return Element_Type;
150
 
151
   function Next (Position : Cursor) return Cursor;
152
 
153
   procedure Next (Position : in out Cursor);
154
 
155
   function Previous (Position : Cursor) return Cursor;
156
 
157
   procedure Previous (Position : in out Cursor);
158
 
159
   function Find
160
     (Container : List;
161
      Item      : Element_Type;
162
      Position  : Cursor := No_Element) return Cursor;
163
 
164
   function Reverse_Find
165
     (Container : List;
166
      Item      : Element_Type;
167
      Position  : Cursor := No_Element) return Cursor;
168
 
169
   function Contains
170
     (Container : List;
171
      Item      : Element_Type) return Boolean;
172
 
173
   function Has_Element (Position : Cursor) return Boolean;
174
 
175
   procedure Iterate
176
     (Container : List;
177
      Process   : not null access procedure (Position : Cursor));
178
 
179
   procedure Reverse_Iterate
180
     (Container : List;
181
      Process   : not null access procedure (Position : Cursor));
182
 
183
   generic
184
      with function "<" (Left, Right : Element_Type) return Boolean is <>;
185
   package Generic_Sorting is
186
 
187
      function Is_Sorted (Container : List) return Boolean;
188
 
189
      procedure Sort (Container : in out List);
190
 
191
      procedure Merge (Target, Source : in out List);
192
 
193
   end Generic_Sorting;
194
 
195
private
196
 
197
   pragma Inline (Next);
198
   pragma Inline (Previous);
199
 
200
   type Node_Type;
201
   type Node_Access is access Node_Type;
202
 
203
   type Element_Access is access Element_Type;
204
 
205
   type Node_Type is
206
      limited record
207
         Element : Element_Access;
208
         Next    : Node_Access;
209
         Prev    : Node_Access;
210
      end record;
211
 
212
   use Ada.Finalization;
213
 
214
   type List is
215
     new Controlled with record
216
        First  : Node_Access;
217
        Last   : Node_Access;
218
        Length : Count_Type := 0;
219
        Busy   : Natural := 0;
220
        Lock   : Natural := 0;
221
     end record;
222
 
223
   overriding
224
   procedure Adjust (Container : in out List);
225
 
226
   overriding
227
   procedure Finalize (Container : in out List) renames Clear;
228
 
229
   use Ada.Streams;
230
 
231
   procedure Read
232
     (Stream : not null access Root_Stream_Type'Class;
233
      Item   : out List);
234
 
235
   for List'Read use Read;
236
 
237
   procedure Write
238
     (Stream : not null access Root_Stream_Type'Class;
239
      Item   : List);
240
 
241
   for List'Write use Write;
242
 
243
   type List_Access is access constant List;
244
   for List_Access'Storage_Size use 0;
245
 
246
   type Cursor is
247
      record
248
         Container : List_Access;
249
         Node      : Node_Access;
250
      end record;
251
 
252
   procedure Read
253
     (Stream : not null access Root_Stream_Type'Class;
254
      Item   : out Cursor);
255
 
256
   for Cursor'Read use Read;
257
 
258
   procedure Write
259
     (Stream : not null access Root_Stream_Type'Class;
260
      Item   : Cursor);
261
 
262
   for Cursor'Write use Write;
263
 
264
   Empty_List : constant List := List'(Controlled with null, null, 0, 0, 0);
265
 
266
   No_Element : constant Cursor := Cursor'(null, null);
267
 
268
end Ada.Containers.Indefinite_Doubly_Linked_Lists;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.