Disable tests for strdup/strndup on __hpux__
[official-gcc.git] / gcc / ada / libgnat / a-chtgfk.ads
blob6b0f559d3c538d9c0fd8422a7a7c79dac907e683
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT LIBRARY COMPONENTS --
4 -- --
5 -- ADA.CONTAINERS.HASH_TABLES.GENERIC_FORMAL_KEYS --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2004-2023, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- This unit was originally developed by Matthew J Heaney. --
28 ------------------------------------------------------------------------------
30 -- Hash_Table_Type is used to implement hashed containers. This package
31 -- declares hash-table operations that depend on keys.
33 generic
34 with package HT_Types is
35 new Generic_Formal_Hash_Table_Types (<>);
37 use HT_Types;
39 with function Next (Node : Node_Type) return Count_Type;
41 with procedure Set_Next
42 (Node : in out Node_Type;
43 Next : Count_Type);
45 type Key_Type (<>) is limited private;
47 with function Hash (Key : Key_Type) return Hash_Type;
49 with function Equivalent_Keys
50 (Key : Key_Type;
51 Node : Node_Type) return Boolean;
53 package Ada.Containers.Hash_Tables.Generic_Formal_Keys is
54 pragma Pure;
56 function Index
57 (HT : Hash_Table_Type;
58 Key : Key_Type) return Hash_Type;
59 pragma Inline (Index);
60 -- Returns the bucket number (array index value) for the given key
62 procedure Delete_Key_Sans_Free
63 (HT : in out Hash_Table_Type;
64 Key : Key_Type;
65 X : out Count_Type);
66 -- Removes the node (if any) with the given key from the hash table
68 function Find
69 (HT : Hash_Table_Type;
70 Key : Key_Type) return Count_Type;
71 -- Returns the node (if any) corresponding to the given key
73 generic
74 with procedure New_Node
75 (HT : in out Hash_Table_Type;
76 Node : out Count_Type);
77 procedure Generic_Conditional_Insert
78 (HT : in out Hash_Table_Type;
79 Key : Key_Type;
80 Node : out Count_Type;
81 Inserted : out Boolean);
82 -- Attempts to insert a new node with the given key into the hash table.
83 -- If a node with that key already exists in the table, then that node
84 -- is returned and Inserted returns False. Otherwise New_Node is called
85 -- to allocate a new node, and Inserted returns True.
87 generic
88 with function Hash (Node : Node_Type) return Hash_Type;
89 with procedure Assign (Node : in out Node_Type; Key : Key_Type);
90 procedure Generic_Replace_Element
91 (HT : in out Hash_Table_Type;
92 Node : Count_Type;
93 Key : Key_Type);
94 -- Assigns Key to Node, possibly changing its equivalence class. Procedure
95 -- Assign is called to assign Key to Node. If Node is not in the same
96 -- bucket as Key before the assignment, it is moved from its current bucket
97 -- to the bucket implied by Key. Note that it is never proper to assign to
98 -- Node a key value already in the hash table, and so if Key is equivalent
99 -- to some other node then Program_Error is raised.
101 end Ada.Containers.Hash_Tables.Generic_Formal_Keys;