1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- T A B L E --
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2017, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package is a wrapper for GNAT.Table, for use in the compiler front
-- end. It adds the Tree_Write/Tree_Read functionality; everything else is
-- just a renaming of GNAT.Table. See GNAT.Table (g-table.ads) and
-- GNAT.Dynamic_Tables (g-dyntab.ads) for documentation.
-- Note that these three interfaces should remain synchronized to keep as much
-- coherency as possible among these related units:
--
-- GNAT.Dynamic_Tables
-- GNAT.Table
-- Table (the compiler unit)
with Types; use Types;
with GNAT.Table;
package Table is
pragma Elaborate_Body;
generic
type Table_Component_Type is private;
type Table_Index_Type is range <>;
Table_Low_Bound : Table_Index_Type := Table_Index_Type'First;
Table_Initial : Pos := 8;
Table_Increment : Nat := 100;
Table_Name : String; -- for debugging printouts
Release_Threshold : Nat := 0;
package Table is
package Tab is new GNAT.Table
(Table_Component_Type,
Table_Index_Type,
Table_Low_Bound,
Positive (Table_Initial),
Natural (Table_Increment),
Table_Name,
Natural (Release_Threshold));
subtype Valid_Table_Index_Type is Tab.Valid_Table_Index_Type;
subtype Table_Last_Type is Tab.Table_Last_Type;
subtype Table_Type is Tab.Table_Type;
subtype Table_Ptr is Tab.Table_Ptr;
Table : Table_Ptr renames Tab.Table;
Locked : Boolean renames Tab.Locked;
function Is_Empty return Boolean renames Tab.Is_Empty;
procedure Init renames Tab.Init;
function First return Table_Index_Type renames Tab.First;
function Last return Table_Last_Type renames Tab.Last;
procedure Release renames Tab.Release;
procedure Free renames Tab.Free;
procedure Set_Last (New_Val : Table_Last_Type) renames Tab.Set_Last;
procedure Increment_Last renames Tab.Increment_Last;
procedure Decrement_Last renames Tab.Decrement_Last;
procedure Append (New_Val : Table_Component_Type) renames Tab.Append;
procedure Append_All (New_Vals : Table_Type) renames Tab.Append_All;
procedure Set_Item
(Index : Valid_Table_Index_Type;
Item : Table_Component_Type) renames Tab.Set_Item;
subtype Saved_Table is Tab.Saved_Table;
function Save return Saved_Table renames Tab.Save;
procedure Restore (T : in out Saved_Table) renames Tab.Restore;
procedure Tree_Write;
-- Writes out contents of table using Tree_IO
procedure Tree_Read;
-- Initializes table by reading contents previously written with the
-- Tree_Write call, also using Tree_IO.
end Table;
end Table;
|