OSDN Git Service

Delete all lines containing "$Revision:".
[pf3gnuchains/gcc-fork.git] / gcc / ada / g-curexc.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT LIBRARY COMPONENTS                          --
4 --                                                                          --
5 --               G N A T . C U R R E N T _ E X C E P T I O N                --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                                                                          --
10 --         Copyright (C) 1996-2000 Ada Core Technologies, Inc.              --
11 --                                                                          --
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.                                                      --
22 --                                                                          --
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.                                      --
29 --                                                                          --
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). --
32 --                                                                          --
33 ------------------------------------------------------------------------------
34
35 --  This package provides routines for obtaining the current exception
36 --  information in Ada 83 style. In Ada 83, there was no official method
37 --  for obtaining exception information, but a number of vendors supplied
38 --  routines for this purpose, and this package closely approximates the
39 --  interfaces supplied by DEC Ada 83 and VADS Ada.
40
41 --  The routines in this package are associated with a particular exception
42 --  handler, and can only be called from within an exception handler. See
43 --  also the package GNAT.Most_Recent_Exception, which provides access to
44 --  the most recently raised exception, and is not limited to static calls
45 --  from an exception handler.
46
47 package GNAT.Current_Exception is
48 pragma Pure (Current_Exception);
49
50    -----------------
51    -- Subprograms --
52    -----------------
53
54    function Exception_Information return String;
55    --  Returns the result of calling Ada.Exceptions.Exception_Information
56    --  with an argument that is the Exception_Occurrence corresponding to
57    --  the current exception. Returns the null string if called from outside
58    --  an exception handler.
59
60    function Exception_Message return String;
61    --  Returns the result of calling Ada.Exceptions.Exception_Message with
62    --  an argument that is the Exception_Occurrence corresponding to the
63    --  current exception. Returns the null string if called from outside an
64    --  exception handler.
65
66    function Exception_Name return String;
67    --  Returns the result of calling Ada.Exceptions.Exception_Name with
68    --  an argument that is the Exception_Occurrence corresponding to the
69    --  current exception. Returns the null string if called from outside
70    --  an exception handler.
71
72    --  Note: all these functions return useful information only if
73    --  called statically from within an exception handler, and they
74    --  return information about the exception corresponding to the
75    --  handler in which they appear. This is NOT the same as the most
76    --  recently raised exception. Consider the example:
77
78    --     exception
79    --        when Constraint_Error =>
80    --          begin
81    --             ...
82    --          exception
83    --             when Tasking_Error => ...
84    --          end;
85    --
86    --          -- Exception_xxx at this point returns the information about
87    --          -- the constraint error, not about any exception raised within
88    --          -- the nested block since it is the static nesting that counts.
89
90    -----------------------------------
91    -- Use of Library Level Renaming --
92    -----------------------------------
93
94    --  For greater compatibility with existing legacy software, library
95    --  level renaming may be used to create a function with a name matching
96    --  one that is in use. For example, some versions of VADS Ada provided
97    --  a functin called Current_Exception whose semantics was identical to
98    --  that of GNAT. The following library level renaming declaration:
99
100    --    with GNAT.Current_Exception;
101    --    function Current_Exception
102    --      renames GNAT.Current_Exception.Exception_Name;
103
104    --  placed in a file called current_exception.ads and compiled into the
105    --  application compilation environment, will make the function available
106    --  in a manner exactly compatible with that in VADS Ada 83.
107
108 private
109    pragma Import (Intrinsic, Exception_Information);
110    pragma Import (intrinsic, Exception_Message);
111    pragma Import (Intrinsic, Exception_Name);
112
113 end GNAT.Current_Exception;