diff options
Diffstat (limited to 'gcc/ada/a-coormu.ads')
-rw-r--r-- | gcc/ada/a-coormu.ads | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/gcc/ada/a-coormu.ads b/gcc/ada/a-coormu.ads index 6d848a8215a..4fbb653725d 100644 --- a/gcc/ada/a-coormu.ads +++ b/gcc/ada/a-coormu.ads @@ -2,11 +2,11 @@ -- -- -- GNAT LIBRARY COMPONENTS -- -- -- --- ADA.CONTAINERS.ORDERED_MULTISETS -- +-- A D A . C O N T A I N E R S . O R D E R E D _ M U L T I 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 -- @@ -56,6 +56,8 @@ pragma Preelaborate (Ordered_Multisets); 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; @@ -68,6 +70,11 @@ pragma Preelaborate (Ordered_Multisets); (Position : Cursor; Process : not null access procedure (Element : Element_Type)); + procedure Replace_Element + (Container : Set; + Position : Cursor; + By : Element_Type); + procedure Move (Target : in out Set; Source : in out Set); @@ -85,10 +92,6 @@ pragma Preelaborate (Ordered_Multisets); (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); @@ -97,13 +100,9 @@ pragma Preelaborate (Ordered_Multisets); procedure Delete_Last (Container : in out Set); - -- NOTE: The following operation is named Replace in the Madison API. - -- However, it should be named Replace_Element. ??? - -- - -- procedure Replace - -- (Container : in out Set; - -- Position : Cursor; - -- By : Element_Type); + procedure Exclude + (Container : in out Set; + Item : Element_Type); procedure Union (Target : in out Set; Source : Set); @@ -151,10 +150,10 @@ pragma Preelaborate (Ordered_Multisets); 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; @@ -214,12 +213,6 @@ pragma Preelaborate (Ordered_Multisets); function Element (Container : Set; Key : Key_Type) return Element_Type; - -- NOTE: in post-madison api ??? - -- procedure Replace - -- (Container : in out Set; - -- Key : Key_Type; - -- New_Item : Element_Type); - procedure Delete (Container : in out Set; Key : Key_Type); procedure Exclude (Container : in out Set; Key : Key_Type); @@ -232,9 +225,7 @@ pragma Preelaborate (Ordered_Multisets); function ">" (Left : Key_Type; Right : Cursor) return Boolean; - -- Should name of following be "Update_Element" ??? - - procedure Checked_Update_Element + procedure Update_Element_Preserving_Key (Container : in out Set; Position : Cursor; Process : not null access @@ -257,21 +248,31 @@ 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 @@ -296,6 +297,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_Multisets; |