1
----------------------------------------------------------------------
2
-- Framework.Symbol_Table - Package specification --
4
-- This software is (c) Adalog 2004-2007. The Ada Controller is --
5
-- free software; you can redistribute it and/or modify it under --
6
-- terms of the GNU General Public License as published by the --
7
-- Free Software Foundation; either version 2, or (at your option) --
8
-- any later version. This unit is distributed in the hope that --
9
-- it will be useful, but WITHOUT ANY WARRANTY; without even the --
10
-- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR --
11
-- PURPOSE. See the GNU General Public License for more details. --
12
-- You should have received a copy of the GNU General Public --
13
-- License distributed with this program; see file COPYING. If --
14
-- not, write to the Free Software Foundation, 59 Temple Place - --
15
-- Suite 330, Boston, MA 02111-1307, USA. --
17
-- As a special exception, if other files instantiate generics --
18
-- from the units of this program, or if you link this unit with --
19
-- other files to produce an executable, this unit does not by --
20
-- itself cause the resulting executable to be covered by the GNU --
21
-- General Public License. This exception does not however --
22
-- invalidate any other reasons why the executable file might be --
23
-- covered by the GNU Public License. --
25
-- This software is distributed in the hope that it will be --
26
-- useful, but WITHOUT ANY WARRANTY; without even the implied --
27
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR --
29
----------------------------------------------------------------------
37
Framework.Scope_Manager;
39
package Framework.Symbol_Table is
41
type Root_Content is tagged limited null record;
42
-- This declaration is here for use in the private part of the generic,
43
-- no use for the user
45
Max_Instances : constant := 5;
46
-- Max allowed number of instantiations of Data_Access.
47
-- Exceeding this number will immediately result in Failure
48
-- If necessary, just increase the above constant, no other change required.
52
-- Declarations common to all instantiations
54
type Scope_Kinds is (Declaration, Visibility);
55
-- The Declaration scope is the scope where the entity is declared
56
-- The Visibility scope is the outermost scope where the entity is visible
57
-- They are different for entities declared in package specs.
58
-- TBSL: formal parameters
60
Not_In_Table : exception;
61
Delete_Current : exception;
62
-- Works like Binary_Map.Delete_Current
65
-- Instantiate this generic to allow to associate any data with any declared element.
66
-- Data associated to an element are automatically freed when the scope of the element is
67
-- exited. Note that this happens *after* calling Framework.Plugs.Exit_Scope, therefore
68
-- rules that need to inspect how an entity has been used can do so by plugging some
69
-- processing into Exit_Scope.
71
type Content is private;
72
package Data_Access is
73
procedure Store (Element : Asis.Element; Content_Value : Content; At_Declaration_Scope : Boolean := True);
74
-- At_Declaration_Scope must be set to False if Store is called from a scope which is not the one
75
-- where Element is declared.
76
-- It must be set to True only if Element is the Defining_Name
77
function Fetch (Element : Asis.Element) return Content;
78
-- Raises Not_In_Table if not present
79
function Fetch (Element : Asis.Element; Default : Content) return Content;
80
-- Returns Default if not present
82
function Is_Present (Element : Asis.Element) return Boolean;
83
function Depth_Of (Element : Asis.Element) return Framework.Scope_Manager.Scope_Range;
84
-- Raises Not_In_Table if not present
87
-- Remove all data stored by this package
89
-- Apply Action to all entities declared within the current scope
91
with procedure Action (Entity : Asis.Defining_Name; Content_Value : in out Content);
92
procedure On_Every_Entity_From_Scope (Scope_Kind : Scope_Kinds);
94
type Content_Hook is new Root_Content with
96
The_Content : Content;
101
-- Declarations below this line are for the use of the framework
104
procedure Exit_Scope (Element : in Asis.Element);
105
-- Clean-up elements from current scope
107
end Framework.Symbol_Table;