diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-31 11:07:20 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-31 11:07:20 +0200 |
commit | 8cf23b91885b80e1f673cbc4135d01390b65d213 (patch) | |
tree | 51ba512577c9b4202ce015f57c761ef8d3020acb /gcc/ada/a-cbdlli.ads | |
parent | 0bb3bfb8feacd4bec3f0dc82d75cf1ea01d37010 (diff) | |
download | gcc-8cf23b91885b80e1f673cbc4135d01390b65d213.zip gcc-8cf23b91885b80e1f673cbc4135d01390b65d213.tar.gz gcc-8cf23b91885b80e1f673cbc4135d01390b65d213.tar.bz2 |
[multiple changes]
2011-08-31 Robert Dewar <dewar@adacore.com>
* exp_ch5.adb, exp_alfa.ads, prj.ads, sem_attr.adb,
lib-xref-alfa.adb: Minor reformatting.
2011-08-31 Matthew Heaney <heaney@adacore.com>
* a-crbltr.ads (Tree_Type): Default-initialize the Nodes component.
2011-08-31 Javier Miranda <miranda@adacore.com>
* sem_ch4.adb (Try_Object_Operation): Addition of one formal to search
only for class-wide subprograms conflicting with entities of concurrent
tagged types.
2011-08-31 Matthew Heaney <heaney@adacore.com>
* a-rbtgbo.adb (Generic_Allocate): Initialize pointer components of
node to null value.
2011-08-31 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch12.adb (Insert_Freeze_Node_For_Instance): Provide a more
general description of the routine.
2011-08-31 Ed Schonberg <schonberg@adacore.com>
* a-cbdlli.adb, a-cbdlli.ads: Add iterator machinery to bounded
doubly-linked lists.
From-SVN: r178363
Diffstat (limited to 'gcc/ada/a-cbdlli.ads')
-rw-r--r-- | gcc/ada/a-cbdlli.ads | 75 |
1 files changed, 68 insertions, 7 deletions
diff --git a/gcc/ada/a-cbdlli.ads b/gcc/ada/a-cbdlli.ads index 2e5d96c..32e992f 100644 --- a/gcc/ada/a-cbdlli.ads +++ b/gcc/ada/a-cbdlli.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2004-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2011, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -31,7 +31,8 @@ -- This unit was originally developed by Matthew J Heaney. -- ------------------------------------------------------------------------------ -private with Ada.Streams; +with Ada.Streams; use Ada.Streams; +with Ada.Iterator_Interfaces; generic type Element_Type is private; @@ -43,7 +44,13 @@ package Ada.Containers.Bounded_Doubly_Linked_Lists is pragma Pure; pragma Remote_Types; - type List (Capacity : Count_Type) is tagged private; + type List (Capacity : Count_Type) is tagged private + with + Constant_Indexing => Constant_Reference, + Variable_Indexing => Reference, + Default_Iterator => Iterate, + Iterator_Element => Element_Type; + pragma Preelaborable_Initialization (List); type Cursor is private; @@ -52,6 +59,10 @@ package Ada.Containers.Bounded_Doubly_Linked_Lists is Empty_List : constant List; No_Element : constant Cursor; + function Has_Element (Position : Cursor) return Boolean; + + package List_Iterator_Interfaces is new + Ada.Iterator_Interfaces (Cursor, Has_Element); function "=" (Left, Right : List) return Boolean; @@ -129,6 +140,12 @@ package Ada.Containers.Bounded_Doubly_Linked_Lists is procedure Reverse_Elements (Container : in out List); + function Iterate (Container : List) + return List_Iterator_Interfaces.Reversible_Iterator'class; + + function Iterate (Container : List; Start : Cursor) + return List_Iterator_Interfaces.Reversible_Iterator'class; + procedure Swap (Container : in out List; I, J : Cursor); @@ -183,8 +200,6 @@ package Ada.Containers.Bounded_Doubly_Linked_Lists is (Container : List; Item : Element_Type) return Boolean; - function Has_Element (Position : Cursor) return Boolean; - procedure Iterate (Container : List; Process : not null access procedure (Position : Cursor)); @@ -205,6 +220,48 @@ package Ada.Containers.Bounded_Doubly_Linked_Lists is end Generic_Sorting; + type Constant_Reference_Type + (Element : not null access constant Element_Type) is private + with + Implicit_Dereference => Element; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Constant_Reference_Type); + + for Constant_Reference_Type'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Constant_Reference_Type); + + for Constant_Reference_Type'Read use Read; + + type Reference_Type (Element : not null access Element_Type) is + private + with + Implicit_Dereference => Element; + + procedure Write + (Stream : not null access Root_Stream_Type'Class; + Item : Reference_Type); + + for Reference_Type'Write use Write; + + procedure Read + (Stream : not null access Root_Stream_Type'Class; + Item : out Reference_Type); + + for Reference_Type'Read use Read; + + function Constant_Reference + (Container : List; Position : Cursor) -- SHOULD BE ALIASED + return Constant_Reference_Type; + + function Reference + (Container : List; Position : Cursor) -- SHOULD BE ALIASED + return Reference_Type; + private pragma Inline (Next); @@ -228,8 +285,6 @@ private Lock : Natural := 0; end record; - use Ada.Streams; - procedure Read (Stream : not null access Root_Stream_Type'Class; Item : out List); @@ -263,6 +318,12 @@ private for Cursor'Write use Write; + type Constant_Reference_Type + (Element : not null access constant Element_Type) is null record; + + type Reference_Type + (Element : not null access Element_Type) is null record; + Empty_List : constant List := (Capacity => 0, others => <>); No_Element : constant Cursor := Cursor'(null, 0); |