diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-21 12:01:28 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-21 12:01:28 +0000 |
commit | 4ada9c3242281563f1549ddb33b29ecb0f3f1e65 (patch) | |
tree | 765ff5b796fde6843e06dc9b97e68453e35eb766 /gcc/ada/a-cfdlli.ads | |
parent | cb84e6f05eea8e5b1da6a10cda5e0c5d7a883d1a (diff) | |
download | gcc-4ada9c3242281563f1549ddb33b29ecb0f3f1e65.tar.gz |
2011-12-21 Robert Dewar <dewar@adacore.com>
* exp_ch5.adb, sem_dim.adb, sem_dim.ads, sem_ch12.adb, prj-conf.adb:
Minor reformatting.
2011-12-21 Claire Dross <dross@adacore.com>
* a-cfdlli.ads (Constant_Indexing, Default_Iterator,
Iterator_Element): Added to type List.
(Not_No_Element, List_Iterator_Interfaces, Iterate,
Constant_Reference_Type, Constant_Reference): New.
* a-cfdlli.adb (type Iterator, Finalize, First, Last, Next,
Previous, Iterate, Not_No_Element, Constant_Reference): New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182576 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-cfdlli.ads')
-rw-r--r-- | gcc/ada/a-cfdlli.ads | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/gcc/ada/a-cfdlli.ads b/gcc/ada/a-cfdlli.ads index 714ce6761f4..c6deaf16693 100644 --- a/gcc/ada/a-cfdlli.ads +++ b/gcc/ada/a-cfdlli.ads @@ -53,6 +53,7 @@ private with Ada.Streams; with Ada.Containers; +with Ada.Iterator_Interfaces; generic type Element_Type is private; @@ -63,7 +64,10 @@ generic package Ada.Containers.Formal_Doubly_Linked_Lists is pragma Pure; - type List (Capacity : Count_Type) is tagged private; + type List (Capacity : Count_Type) is tagged private with + Constant_Indexing => Constant_Reference, + Default_Iterator => Iterate, + Iterator_Element => Element_Type; -- pragma Preelaborable_Initialization (List); type Cursor is private; @@ -73,6 +77,17 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is No_Element : constant Cursor; + function Not_No_Element (Position : Cursor) return Boolean; + + package List_Iterator_Interfaces is new + Ada.Iterator_Interfaces (Cursor => Cursor, Has_Element => Not_No_Element); + + function Iterate (Container : List; Start : Cursor) + return List_Iterator_Interfaces.Reversible_Iterator'Class; + + function Iterate (Container : List) + return List_Iterator_Interfaces.Reversible_Iterator'Class; + function "=" (Left, Right : List) return Boolean; function Length (Container : List) return Count_Type; @@ -225,6 +240,15 @@ package Ada.Containers.Formal_Doubly_Linked_Lists is end Generic_Sorting; + type Constant_Reference_Type + (Element : not null access constant Element_Type) is private + with + Implicit_Dereference => Element; + + function Constant_Reference + (Container : List; Position : Cursor) -- SHOULD BE ALIASED + return Constant_Reference_Type; + function Strict_Equal (Left, Right : List) return Boolean; -- Strict_Equal returns True if the containers are physically equal, i.e. -- they are structurally equal (function "=" returns True) and that they @@ -244,8 +268,9 @@ private type Node_Type is record Prev : Count_Type'Base := -1; Next : Count_Type; - Element : Element_Type; + Element : aliased Element_Type; end record; + function "=" (L, R : Node_Type) return Boolean is abstract; type Node_Array is array (Count_Type range <>) of Node_Type; @@ -275,6 +300,9 @@ private for List'Write use Write; + type List_Access is access all List; + for List_Access'Storage_Size use 0; + type Cursor is record Node : Count_Type := 0; end record; @@ -295,4 +323,7 @@ private No_Element : constant Cursor := (Node => 0); + type Constant_Reference_Type + (Element : not null access constant Element_Type) is null record; + end Ada.Containers.Formal_Doubly_Linked_Lists; |