1------------------------------------------------------------------------------
2--                                                                          --
3--             ASIS Tester And iNTerpreter (ASIStant) COMPONENTS            --
4--                                                                          --
5--                       A S I S T A N T . T A B L E                        --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--          Copyright (C) 1997-2013, Free Software Foundation, Inc.         --
10--                                                                          --
11-- ASIStant is free software; you can redistribute it and/or modify it      --
12-- under terms of the  GNU General Public License  as published by the Free --
13-- Software Foundation;  either version 2,  or  (at your option)  any later --
14-- version. ASIStant is distributed  in the hope  that it will be useful,   --
15-- but WITHOUT ANY WARRANTY; without even the implied warranty of MER-      --
16-- CHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General  --
17-- Public License for more details. You should have received a copy of the  --
18-- GNU General Public License distributed with GNAT; see file COPYING. If   --
19-- not, write to the Free Software Foundation, 59 Temple Place Suite 330,   --
20-- Boston, MA 02111-1307, USA.                                              --
21--                                                                          --
22-- ASIStant is an evolution of ASIStint tool that was created by            --
23-- Vasiliy Fofanov as part of a collaboration between Software Engineering  --
24-- Laboratory of the Swiss Federal Institute of Technology in Lausanne,     --
25-- Switzerland, and the Scientific Research Computer Center of the Moscow   --
26-- University, Russia, supported by the Swiss National Science Foundation   --
27-- grant #7SUPJ048247, "Development of ASIS for GNAT with industry quality" --
28--                                                                          --
29-- ASIStant is distributed as a part of the ASIS implementation for GNAT    --
30-- (ASIS-for-GNAT) and is maintained by AdaCore (http://www.adacore.com).   --
31--                                                                          --
32------------------------------------------------------------------------------
33
34with ASIStant.Common; use ASIStant.Common;
35with ASIStant.FuncEnum; use ASIStant.FuncEnum;
36
37package ASIStant.Table is
38
39------------------------------------------------------------------------------
40--  This package provides handling of ASIStant language variable tables
41------------------------------------------------------------------------------
42
43   subtype Var_Name is Name_String;
44
45   type Var_Info is
46      record
47         Name   : Var_Name;
48         VType  : Var_Type;
49         IValue : Integer;
50         SValue : String_Ptr;
51      end record;
52
53   Var_Unknown : constant Var_Info :=
54      ((1 .. MAX_ID_LENGTH => ' '), Par_Absent, 0, null);
55
56   type V_Table is array (Positive range <>) of Var_Info;
57   type V_TablePtr is access all V_Table;
58
59   type Var_Table is
60      record
61         Free  : Positive;
62         Max   : Positive;
63         Table : V_TablePtr;
64      end record;
65
66   CurTable : Var_Table :=
67      (1, MAX_VARIABLES, new V_Table (1 .. MAX_VARIABLES));
68
69   function  Get_Var (T : Var_Table; N : Wide_String) return Var_Info;
70   --  Scans for the variable in table T. Returns Var_Unknown if fails.
71
72   function Get_Var_Value (VI : Var_Info) return Query_Result;
73   --  Returns variable value information
74
75   function Store_Var_Value (QR : Query_Result) return Var_Info;
76   --  Stores value information in variable
77
78   procedure Modify_Var (T : in out Var_Table; V : Var_Info);
79   --  Adds/changes variable
80
81end ASIStant.Table;
82