summaryrefslogtreecommitdiff
path: root/gcc/ada/a-coorse.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-29 13:38:55 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-29 13:38:55 +0000
commitb818431600fef3f751f6713c943b47d88d2effd2 (patch)
treec5c5a59fe92af48a72ef4d23e699ecfeee3903ef /gcc/ada/a-coorse.ads
parent15f3d9888ce2a021c4b42032a3a051c07b5bdcad (diff)
downloadgcc-b818431600fef3f751f6713c943b47d88d2effd2.tar.gz
2011-08-29 Ed Schonberg <schonberg@adacore.com>
* sem_res.adb: Remove Build_Explicit_Dereference. * sem_util.adb, sem_util.ads (Build_Explicit_Dereference): Moved here from sem_res.adb, used in analysis of additional constructs. (Is_Iterator, Is_Reversible_Iterator): New predicates for Ada2012 expansion of iterators. (Is_Object_Reference): Recognize variables rewritten as explicit dereferences in Ada2012. * snames.ads-tmpl: Add Has_Element, Forward_Iterator, Reversible_Iterator names, for expansion of Ada2012 iterators. * aspects.ads, aspects.adb (Find_Aspect): Utility. * a-cdlili.ads, a-cdlili.adb: Add new iterator machinery to doubly linked list container. * a-coinve.ads, a-coinve.adb: Ditto for indefinite vector containers. * a-coorse.ads, a-coorse.adb: Ditto for ordered sets. 2011-08-29 Ed Schonberg <schonberg@adacore.com> * a-cohama.adb, a-cohama.ads: Add iterator primitives to hashed map containers. 2011-08-29 Vincent Celier <celier@adacore.com> * make.adb (Gnatmake): Get the maximum number of simultaneous compilation processes after the Builder switches has been scanned, as there may include -jnn. 2011-08-29 Matthew Heaney <heaney@adacore.com> * a-chtgbo.adb (Generic_Equal): Use correct overloading of Next. 2011-08-29 Tristan Gingold <gingold@adacore.com> * gnatcmd.adb (GNATCmd): On OpenVMS, truncate the length of GNAT_DRIVER_COMMAND_LINE to 255. 2011-08-29 Pascal Obry <obry@adacore.com> * freeze.adb, sem_ch8.adb, a-convec.adb, a-convec.ads: Minor reformatting and style fix (class attribute casing). 2011-08-29 Yannick Moy <moy@adacore.com> * exp_ch11.adb: Yet another case where expansion should be common between CodePeer and Alfa. 2011-08-29 Yannick Moy <moy@adacore.com> * exp_ch9.adb: Partial revert of previous change for Alfa mode. 2011-08-29 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Matches_Limited_With_View): The limited views of an incomplete type and its completion match. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178228 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-coorse.ads')
-rw-r--r--gcc/ada/a-coorse.ads99
1 files changed, 81 insertions, 18 deletions
diff --git a/gcc/ada/a-coorse.ads b/gcc/ada/a-coorse.ads
index afa767159cd..cf52da66a1c 100644
--- a/gcc/ada/a-coorse.ads
+++ b/gcc/ada/a-coorse.ads
@@ -33,7 +33,8 @@
private with Ada.Containers.Red_Black_Trees;
private with Ada.Finalization;
-private with Ada.Streams;
+with Ada.Streams; use Ada.Streams;
+with Ada.Iterator_Interfaces;
generic
type Element_Type is private;
@@ -47,16 +48,81 @@ package Ada.Containers.Ordered_Sets is
function Equivalent_Elements (Left, Right : Element_Type) return Boolean;
- type Set is tagged private;
+ type Set is tagged private
+ with
+ Constant_Indexing => Constant_Reference,
+ Variable_Indexing => Reference,
+ Default_Iterator => Iterate,
+ Iterator_Element => Element_Type;
+
pragma Preelaborable_Initialization (Set);
type Cursor is private;
pragma Preelaborable_Initialization (Cursor);
+ function Has_Element (Position : Cursor) return Boolean;
+
Empty_Set : constant Set;
No_Element : constant Cursor;
+ procedure Write
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : Cursor);
+
+ for Cursor'Write use Write;
+
+ procedure Read
+ (Stream : not null access Root_Stream_Type'Class;
+ Item : out Cursor);
+
+ for Cursor'Read use Read;
+
+ package Ordered_Set_Iterator_Interfaces is new
+ Ada.Iterator_Interfaces (Cursor, Has_Element);
+
+ 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;
+
+ function Constant_Reference
+ (Container : Set; Position : Cursor)
+ return Constant_Reference_Type;
+
+ 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 Reference
+ (Container : Set; Position : Cursor)
+ return Reference_Type;
+
function "=" (Left, Right : Set) return Boolean;
function Equivalent_Sets (Left, Right : Set) return Boolean;
@@ -168,8 +234,6 @@ package Ada.Containers.Ordered_Sets is
function Contains (Container : Set; Item : Element_Type) return Boolean;
- function Has_Element (Position : Cursor) return Boolean;
-
function "<" (Left, Right : Cursor) return Boolean;
function ">" (Left, Right : Cursor) return Boolean;
@@ -190,6 +254,12 @@ package Ada.Containers.Ordered_Sets is
(Container : Set;
Process : not null access procedure (Position : Cursor));
+ function Iterate (Container : Set)
+ return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class;
+
+ function Iterate (Container : Set; Start : Cursor)
+ return Ordered_Set_Iterator_Interfaces.Reversible_Iterator'class;
+
generic
type Key_Type (<>) is private;
@@ -243,7 +313,7 @@ private
Left : Node_Access;
Right : Node_Access;
Color : Red_Black_Trees.Color_Type := Red_Black_Trees.Red;
- Element : Element_Type;
+ Element : aliased Element_Type;
end record;
package Tree_Types is
@@ -260,7 +330,6 @@ private
use Red_Black_Trees;
use Tree_Types;
use Ada.Finalization;
- use Ada.Streams;
type Set_Access is access all Set;
for Set_Access'Storage_Size use 0;
@@ -270,18 +339,6 @@ private
Node : Node_Access;
end record;
- procedure Write
- (Stream : not null access Root_Stream_Type'Class;
- Item : Cursor);
-
- for Cursor'Write use Write;
-
- procedure Read
- (Stream : not null access Root_Stream_Type'Class;
- Item : out Cursor);
-
- for Cursor'Read use Read;
-
No_Element : constant Cursor := Cursor'(null, null);
procedure Write
@@ -296,6 +353,12 @@ private
for Set'Read use Read;
+ 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_Set : constant Set :=
(Controlled with Tree => (First => null,
Last => null,