diff options
Diffstat (limited to 'gcc/ada/a-coorse.ads')
-rw-r--r-- | gcc/ada/a-coorse.ads | 73 |
1 files changed, 44 insertions, 29 deletions
diff --git a/gcc/ada/a-coorse.ads b/gcc/ada/a-coorse.ads index 1dca837ccb6..17994951713 100644 --- a/gcc/ada/a-coorse.ads +++ b/gcc/ada/a-coorse.ads @@ -2,11 +2,11 @@ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- --- ADA.CONTAINERS.ORDERED_SETS -- +-- A D A . C O N T A I N E R S . O R D E R E D _ S E T S -- -- -- -- S p e c -- -- -- --- Copyright (C) 2004 Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2005 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 -- @@ -57,6 +57,8 @@ pragma Preelaborate (Ordered_Sets); function "=" (Left, Right : Set) return Boolean; + function Equivalent_Sets (Left, Right : Set) return Boolean; + function Length (Container : Set) return Count_Type; function Is_Empty (Container : Set) return Boolean; @@ -69,11 +71,10 @@ pragma Preelaborate (Ordered_Sets); (Position : Cursor; Process : not null access procedure (Element : Element_Type)); --- TODO: resolve in Atlanta. ??? --- procedure Replace_Element --- (Container : in out Set; --- Position : Cursor; --- By : Element_Type); + procedure Replace_Element + (Container : Set; -- TODO: need ARG ruling + Position : Cursor; + By : Element_Type); procedure Move (Target : in out Set; @@ -94,17 +95,13 @@ pragma Preelaborate (Ordered_Sets); New_Item : Element_Type); procedure Replace - (Container : in out Set; + (Container : in out Set; -- TODO: need ARG ruling New_Item : Element_Type); procedure Delete (Container : in out Set; Item : Element_Type); - procedure Exclude - (Container : in out Set; - Item : Element_Type); - procedure Delete (Container : in out Set; Position : in out Cursor); @@ -113,6 +110,10 @@ pragma Preelaborate (Ordered_Sets); procedure Delete_Last (Container : in out Set); + procedure Exclude + (Container : in out Set; + Item : Element_Type); + procedure Union (Target : in out Set; Source : Set); function Union (Left, Right : Set) return Set; @@ -160,10 +161,10 @@ pragma Preelaborate (Ordered_Sets); function Next (Position : Cursor) return Cursor; - function Previous (Position : Cursor) return Cursor; - procedure Next (Position : in out Cursor); + function Previous (Position : Cursor) return Cursor; + procedure Previous (Position : in out Cursor); function Has_Element (Position : Cursor) return Boolean; @@ -215,11 +216,10 @@ pragma Preelaborate (Ordered_Sets); function Element (Container : Set; Key : Key_Type) return Element_Type; --- TODO: resolve in Atlanta ??? --- procedure Replace --- (Container : in out Set; --- Key : Key_Type; --- New_Item : Element_Type); + procedure Replace + (Container : in out Set; -- TODO: need ARG ruling + Key : Key_Type; + New_Item : Element_Type); procedure Delete (Container : in out Set; Key : Key_Type); @@ -233,8 +233,7 @@ pragma Preelaborate (Ordered_Sets); function ">" (Left : Key_Type; Right : Cursor) return Boolean; --- TODO: resolve name in Atlanta. Should name be just "Update_Element" ??? - procedure Checked_Update_Element + procedure Update_Element_Preserving_Key (Container : in out Set; Position : Cursor; Process : not null access @@ -247,21 +246,32 @@ private type Node_Type; type Node_Access is access Node_Type; - package Tree_Types is - new Red_Black_Trees.Generic_Tree_Types (Node_Access); + type Node_Type is limited record + Parent : Node_Access; + Left : Node_Access; + Right : Node_Access; + Color : Red_Black_Trees.Color_Type := Red_Black_Trees.Red; + Element : Element_Type; + end record; - use Tree_Types; - use Ada.Finalization; + package Tree_Types is new Red_Black_Trees.Generic_Tree_Types + (Node_Type, + Node_Access); - type Set is new Controlled with record - Tree : Tree_Type := (Length => 0, others => null); + type Set is new Ada.Finalization.Controlled with record + Tree : Tree_Types.Tree_Type; end record; procedure Adjust (Container : in out Set); procedure Finalize (Container : in out Set) renames Clear; - type Set_Access is access constant Set; + use Red_Black_Trees; + use Tree_Types; + use Ada.Finalization; + + type Set_Access is access all Set; + for Set_Access'Storage_Size use 0; type Cursor is record Container : Set_Access; @@ -285,6 +295,11 @@ private for Set'Read use Read; Empty_Set : constant Set := - (Controlled with Tree => (Length => 0, others => null)); + (Controlled with Tree => (First => null, + Last => null, + Root => null, + Length => 0, + Busy => 0, + Lock => 0)); end Ada.Containers.Ordered_Sets; |