diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-05 08:05:32 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-05 08:05:32 +0000 |
commit | a4f57dfb8913775e2031ff0a074ca54b188d2ec3 (patch) | |
tree | 7b4be4425a576dfefafcfd6533af08d710bea8f0 /gcc/ada/a-coorse.adb | |
parent | f394630b0d3000248678a2393066f06627336437 (diff) | |
download | gcc-a4f57dfb8913775e2031ff0a074ca54b188d2ec3.tar.gz |
2005-09-01 Matthew Heaney <heaney@adacore.com>
* a-cihase.adb, a-coorse.ads, a-coorse.adb, a-cohama.adb,
a-ciorse.ads, a-ciorse.adb, a-cihama.adb, a-cdlili.adb,
a-cidlli.adb, a-chtgop.adb, a-cihase.adb, a-cihase.ads,
a-cohase.adb, a-cohase.adb, a-cohase.ads: Synchronized with latest
draft (Draft 13, August 2005) of Ada Amendment 1.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103892 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-coorse.adb')
-rw-r--r-- | gcc/ada/a-coorse.adb | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/gcc/ada/a-coorse.adb b/gcc/ada/a-coorse.adb index d088672aaf8..04652f80444 100644 --- a/gcc/ada/a-coorse.adb +++ b/gcc/ada/a-coorse.adb @@ -359,6 +359,21 @@ package body Ada.Containers.Ordered_Sets is return Position.Node.Element; end Element; + ------------------------- + -- Equivalent_Elements -- + ------------------------- + + function Equivalent_Elements (Left, Right : Element_Type) return Boolean is + begin + if Left < Right + or else Right < Left + then + return False; + else + return True; + end if; + end Equivalent_Elements; + --------------------- -- Equivalent_Sets -- --------------------- @@ -490,34 +505,6 @@ package body Ada.Containers.Ordered_Sets is Is_Less_Key_Node => Is_Less_Key_Node, Is_Greater_Key_Node => Is_Greater_Key_Node); - --------- - -- "<" -- - --------- - - function "<" (Left : Key_Type; Right : Cursor) return Boolean is - begin - return Left < Right.Node.Element; - end "<"; - - function "<" (Left : Cursor; Right : Key_Type) return Boolean is - begin - return Right > Left.Node.Element; - end "<"; - - --------- - -- ">" -- - --------- - - function ">" (Left : Key_Type; Right : Cursor) return Boolean is - begin - return Left > Right.Node.Element; - end ">"; - - function ">" (Left : Cursor; Right : Key_Type) return Boolean is - begin - return Right < Left.Node.Element; - end ">"; - ------------- -- Ceiling -- ------------- @@ -573,6 +560,21 @@ package body Ada.Containers.Ordered_Sets is return Node.Element; end Element; + --------------------- + -- Equivalent_Keys -- + --------------------- + + function Equivalent_Keys (Left, Right : Key_Type) return Boolean is + begin + if Left < Right + or else Right < Left + then + return False; + else + return True; + end if; + end Equivalent_Keys; + ------------- -- Exclude -- ------------- @@ -626,7 +628,7 @@ package body Ada.Containers.Ordered_Sets is Right : Node_Access) return Boolean is begin - return Left > Right.Element; + return Key (Right.Element) < Left; end Is_Greater_Key_Node; ---------------------- @@ -638,7 +640,7 @@ package body Ada.Containers.Ordered_Sets is Right : Node_Access) return Boolean is begin - return Left < Right.Element; + return Left < Key (Right.Element); end Is_Less_Key_Node; --------- @@ -691,7 +693,7 @@ package body Ada.Containers.Ordered_Sets is declare E : Element_Type renames Position.Node.Element; - K : Key_Type renames Key (E); + K : constant Key_Type := Key (E); B : Natural renames Tree.Busy; L : Natural renames Tree.Lock; @@ -712,11 +714,7 @@ package body Ada.Containers.Ordered_Sets is L := L - 1; B := B - 1; - if K < E - or else K > E - then - null; - else + if Equivalent_Keys (K, Key (E)) then return; end if; end; @@ -1319,12 +1317,10 @@ package body Ada.Containers.Ordered_Sets is end Replace_Element; procedure Replace_Element - (Container : Set; + (Container : in out Set; Position : Cursor; - By : Element_Type) + New_Item : Element_Type) is - Tree : Tree_Type renames Container.Tree'Unrestricted_Access.all; - begin if Position.Node = null then raise Constraint_Error; @@ -1334,7 +1330,7 @@ package body Ada.Containers.Ordered_Sets is raise Program_Error; end if; - Replace_Element (Tree, Position.Node, By); + Replace_Element (Container.Tree, Position.Node, New_Item); end Replace_Element; --------------------- |