1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . V M S _ E X C E P T I O N _ T A B L E --
10 -- Copyright (C) 1997-2001, Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
30 -- GNAT was originally developed by the GNAT team at New York University. --
31 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
33 ------------------------------------------------------------------------------
35 -- This is an Alpha/VMS package.
38 pragma Elaborate_All (GNAT.HTable);
40 package body System.VMS_Exception_Table is
42 use System.Standard_Library;
44 type HTable_Headers is range 1 .. 37;
46 type Exception_Code_Data;
47 type Exception_Code_Data_Ptr is access all Exception_Code_Data;
49 -- The following record maps an imported VMS condition to an
52 type Exception_Code_Data is record
54 Except : Exception_Data_Ptr;
55 HTable_Ptr : Exception_Code_Data_Ptr;
59 (T : Exception_Code_Data_Ptr;
60 Next : Exception_Code_Data_Ptr);
62 function Get_HT_Link (T : Exception_Code_Data_Ptr)
63 return Exception_Code_Data_Ptr;
65 function Hash (F : Natural) return HTable_Headers;
66 function Get_Key (T : Exception_Code_Data_Ptr) return Natural;
68 package Exception_Code_HTable is new GNAT.HTable.Static_HTable (
69 Header_Num => HTable_Headers,
70 Element => Exception_Code_Data,
71 Elmt_Ptr => Exception_Code_Data_Ptr,
73 Set_Next => Set_HT_Link,
84 function Coded_Exception (X : Natural) return Exception_Data_Ptr is
85 Res : Exception_Code_Data_Ptr;
88 Res := Exception_Code_HTable.Get (X);
102 function Get_HT_Link (T : Exception_Code_Data_Ptr)
103 return Exception_Code_Data_Ptr is
112 function Get_Key (T : Exception_Code_Data_Ptr) return Natural is
121 function Hash (F : Natural) return HTable_Headers is
123 return HTable_Headers
124 (F mod Natural (HTable_Headers'Last - HTable_Headers'First + 1) + 1);
127 ----------------------------
128 -- Register_VMS_Exception --
129 ----------------------------
131 procedure Register_VMS_Exception (Code : Integer) is
132 -- Mask off lower 3 bits which are the severity
134 Excode : Integer := (Code / 8) * 8;
137 -- This allocates an empty exception that gets filled in by
138 -- __gnat_error_handler when the exception is raised. Allocating
139 -- it here prevents having to allocate it each time the exception
142 if Exception_Code_HTable.Get (Excode) = null then
143 Exception_Code_HTable.Set
144 (new Exception_Code_Data'
146 new Exception_Data'(False, 'V', 0, null, null, 0),
149 end Register_VMS_Exception;
155 procedure Set_HT_Link
156 (T : Exception_Code_Data_Ptr;
157 Next : Exception_Code_Data_Ptr)
160 T.HTable_Ptr := Next;
163 end System.VMS_Exception_Table;