~ubuntu-branches/ubuntu/jaunty/adacontrol/jaunty

« back to all changes in this revision

Viewing changes to src/framework-symbol_table.ads

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Brenta
  • Date: 2008-04-27 15:25:59 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080427152559-qrlic533a1x02flu
Tags: 1.8r8-1

* New upstream version.
* debian/adacontrol.gpr: delete; use upstream's project file instead.
* patches/build.patch: patch upstream's project file to change Object_Dir
  and Exec_Dir.
* Build-depend on asis 2007 and gnat-4.3.
* Add support for mips, mipsel and ppc64.
* Build and provide ptree.
* ptree.1: new.
* adactl.1: update; new options and rules are available.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
----------------------------------------------------------------------
 
2
--  Framework.Symbol_Table - Package specification                  --
 
3
--                                                                  --
 
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.                          --
 
16
--                                                                  --
 
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.                              --
 
24
--                                                                  --
 
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 --
 
28
--  PURPOSE.                                                        --
 
29
----------------------------------------------------------------------
 
30
 
 
31
-- ASIS
 
32
with
 
33
  Asis;
 
34
 
 
35
-- Adalog
 
36
with
 
37
  Framework.Scope_Manager;
 
38
 
 
39
package Framework.Symbol_Table is
 
40
 
 
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
 
44
 
 
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.
 
49
 
 
50
 
 
51
   --
 
52
   -- Declarations common to all instantiations
 
53
   --
 
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
 
59
 
 
60
   Not_In_Table   : exception;
 
61
   Delete_Current : exception;
 
62
   -- Works like Binary_Map.Delete_Current
 
63
 
 
64
 
 
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.
 
70
   generic
 
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
 
81
 
 
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
 
85
 
 
86
      procedure Clear;
 
87
      -- Remove all data stored by this package
 
88
 
 
89
      -- Apply Action to all entities declared within the current scope
 
90
      generic
 
91
         with procedure Action (Entity : Asis.Defining_Name; Content_Value : in out Content);
 
92
      procedure On_Every_Entity_From_Scope (Scope_Kind : Scope_Kinds);
 
93
   private
 
94
      type Content_Hook is new Root_Content with
 
95
         record
 
96
            The_Content : Content;
 
97
         end record;
 
98
   end Data_Access;
 
99
 
 
100
   --
 
101
   --  Declarations below this line are for the use of the framework
 
102
   --
 
103
 
 
104
   procedure Exit_Scope (Element : in Asis.Element);
 
105
   -- Clean-up elements from current scope
 
106
 
 
107
end Framework.Symbol_Table;