summaryrefslogtreecommitdiff
path: root/gcc/ada/a-chtgke.adb
diff options
context:
space:
mode:
authorMatthew Heaney <heaney@adacore.com>2005-06-16 10:56:24 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2005-06-16 10:56:24 +0200
commit8704d4b30e3eace58fc9506cf3533b15835c784a (patch)
tree60bbc3a40631ce4a825ff74330cd04720cf0d624 /gcc/ada/a-chtgke.adb
parentdc8f57914cb54a209cf2d52bb04d21502990842b (diff)
downloadgcc-8704d4b30e3eace58fc9506cf3533b15835c784a.tar.gz
a-swunha.ads, [...]: Removed.
2005-06-14 Matthew Heaney <heaney@adacore.com> * a-swunha.ads, a-swunha.adb: Removed. Replaced by a-swuwha.ad[sb] * a-swuwha.ads, a-swuwha.adb: New files * a-szunha.ads, a-szunha.adb: Removed, replaced by a-szuzha.ad[sb] * a-szuzha.ads, a-szuzha.adb: New files. * a-rbtgso.adb, a-crbtgo.ads, a-crbtgo.adb, a-crbtgk.ads, a-crbtgk.adb, a-crbltr.ads, a-coorse.ads, a-coorse.adb, a-convec.ads, a-convec.adb, a-coinve.ads, a-coinve.adb, a-cohata.ads, a-cohama.ads, a-cohama.adb, a-ciorse.ads, a-ciorse.adb, a-cihama.ads, a-cihama.adb, a-cidlli.ads, a-cidlli.adb, a-chtgop.ads, a-chtgop.adb, a-cdlili.ads, a-cdlili.adb, a-coormu.adb, a-ciormu.adb, a-cihase.adb, a-cohase.adb, a-cohase.ads, a-ciorma.ads, a-coorma.ads, a-ciormu.ads, a-coormu.ads, a-swunha.adb, a-stunha.adb, a-ciorma.adb, a-coorma.adb, a-shcain.ads, a-shcain.adb, a-chtgke.ads, a-chtgke.adb, a-stwiha.ads, a-stwiha.adb, a-strhas.adb, a-stzhas.adb: synchronized to the latest version of the Ada 2005 RM. From-SVN: r101069
Diffstat (limited to 'gcc/ada/a-chtgke.adb')
-rw-r--r--gcc/ada/a-chtgke.adb57
1 files changed, 36 insertions, 21 deletions
diff --git a/gcc/ada/a-chtgke.adb b/gcc/ada/a-chtgke.adb
index 9a21ad0c9eb..010d557de82 100644
--- a/gcc/ada/a-chtgke.adb
+++ b/gcc/ada/a-chtgke.adb
@@ -2,11 +2,12 @@
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
--- ADA.CONTAINERS.HASH_TABLES.GENERIC_KEYS --
+-- A D A . C O N T A I N E R S . --
+-- H A S H _ T A B L E S . G E N E R I C _ K E Y S --
-- --
-- B o d y --
-- --
--- 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 --
@@ -40,7 +41,7 @@ package body Ada.Containers.Hash_Tables.Generic_Keys is
--------------------------
procedure Delete_Key_Sans_Free
- (HT : in out HT_Type;
+ (HT : in out Hash_Table_Type;
Key : Key_Type;
X : out Node_Access)
is
@@ -49,18 +50,21 @@ package body Ada.Containers.Hash_Tables.Generic_Keys is
begin
if HT.Length = 0 then
- X := Null_Node;
+ X := null;
return;
end if;
Indx := Index (HT, Key);
X := HT.Buckets (Indx);
- if X = Null_Node then
+ if X = null then
return;
end if;
if Equivalent_Keys (Key, X) then
+ if HT.Busy > 0 then
+ raise Program_Error;
+ end if;
HT.Buckets (Indx) := Next (X);
HT.Length := HT.Length - 1;
return;
@@ -70,11 +74,14 @@ package body Ada.Containers.Hash_Tables.Generic_Keys is
Prev := X;
X := Next (Prev);
- if X = Null_Node then
+ if X = null then
return;
end if;
if Equivalent_Keys (Key, X) then
+ if HT.Busy > 0 then
+ raise Program_Error;
+ end if;
Set_Next (Node => Prev, Next => Next (X));
HT.Length := HT.Length - 1;
return;
@@ -87,7 +94,7 @@ package body Ada.Containers.Hash_Tables.Generic_Keys is
----------
function Find
- (HT : HT_Type;
+ (HT : Hash_Table_Type;
Key : Key_Type) return Node_Access is
Indx : Hash_Type;
@@ -95,20 +102,20 @@ package body Ada.Containers.Hash_Tables.Generic_Keys is
begin
if HT.Length = 0 then
- return Null_Node;
+ return null;
end if;
Indx := Index (HT, Key);
Node := HT.Buckets (Indx);
- while Node /= Null_Node loop
+ while Node /= null loop
if Equivalent_Keys (Key, Node) then
return Node;
end if;
Node := Next (Node);
end loop;
- return Null_Node;
+ return null;
end Find;
--------------------------------
@@ -116,10 +123,10 @@ package body Ada.Containers.Hash_Tables.Generic_Keys is
--------------------------------
procedure Generic_Conditional_Insert
- (HT : in out HT_Type;
- Key : Key_Type;
- Node : out Node_Access;
- Success : out Boolean)
+ (HT : in out Hash_Table_Type;
+ Key : Key_Type;
+ Node : out Node_Access;
+ Inserted : out Boolean)
is
Indx : constant Hash_Type := Index (HT, Key);
B : Node_Access renames HT.Buckets (Indx);
@@ -127,12 +134,16 @@ package body Ada.Containers.Hash_Tables.Generic_Keys is
subtype Length_Subtype is Count_Type range 0 .. Count_Type'Last - 1;
begin
- if B = Null_Node then
+ if B = null then
+ if HT.Busy > 0 then
+ raise Program_Error;
+ end if;
+
declare
Length : constant Length_Subtype := HT.Length;
begin
- Node := New_Node (Next => Null_Node);
- Success := True;
+ Node := New_Node (Next => null);
+ Inserted := True;
B := Node;
HT.Length := Length + 1;
@@ -144,20 +155,24 @@ package body Ada.Containers.Hash_Tables.Generic_Keys is
Node := B;
loop
if Equivalent_Keys (Key, Node) then
- Success := False;
+ Inserted := False;
return;
end if;
Node := Next (Node);
- exit when Node = Null_Node;
+ exit when Node = null;
end loop;
+ if HT.Busy > 0 then
+ raise Program_Error;
+ end if;
+
declare
Length : constant Length_Subtype := HT.Length;
begin
Node := New_Node (Next => B);
- Success := True;
+ Inserted := True;
B := Node;
HT.Length := Length + 1;
@@ -169,7 +184,7 @@ package body Ada.Containers.Hash_Tables.Generic_Keys is
-----------
function Index
- (HT : HT_Type;
+ (HT : Hash_Table_Type;
Key : Key_Type) return Hash_Type is
begin
return Hash (Key) mod HT.Buckets'Length;