* config/rs6000/rs6000.md: Document why a pattern is not
[official-gcc.git] / gcc / ada / g-curexc.ads
blob87017c71df20c594c469c562ee60f439bc960396
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 -- Copyright (C) 1996-2004 Ada Core Technologies, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 -- This package provides routines for obtaining the current exception
35 -- information in Ada 83 style. In Ada 83, there was no official method
36 -- for obtaining exception information, but a number of vendors supplied
37 -- routines for this purpose, and this package closely approximates the
38 -- interfaces supplied by DEC Ada 83 and VADS Ada.
40 -- The routines in this package are associated with a particular exception
41 -- handler, and can only be called from within an exception handler. See
42 -- also the package GNAT.Most_Recent_Exception, which provides access to
43 -- the most recently raised exception, and is not limited to static calls
44 -- from an exception handler.
46 package GNAT.Current_Exception is
47 pragma Pure (Current_Exception);
49 -----------------
50 -- Subprograms --
51 -----------------
53 -- Note: the lower bound of returnd String values is always one.
55 function Exception_Information return String;
56 -- Returns the result of calling Ada.Exceptions.Exception_Information
57 -- with an argument that is the Exception_Occurrence corresponding to
58 -- the current exception. Returns the null string if called from outside
59 -- an exception handler.
61 function Exception_Message return String;
62 -- Returns the result of calling Ada.Exceptions.Exception_Message with
63 -- an argument that is the Exception_Occurrence corresponding to the
64 -- current exception. Returns the null string if called from outside an
65 -- exception handler.
67 function Exception_Name return String;
68 -- Returns the result of calling Ada.Exceptions.Exception_Name with
69 -- an argument that is the Exception_Occurrence corresponding to the
70 -- current exception. Returns the null string if called from outside
71 -- an exception handler.
73 -- Note: all these functions return useful information only if
74 -- called statically from within an exception handler, and they
75 -- return information about the exception corresponding to the
76 -- handler in which they appear. This is NOT the same as the most
77 -- recently raised exception. Consider the example:
79 -- exception
80 -- when Constraint_Error =>
81 -- begin
82 -- ...
83 -- exception
84 -- when Tasking_Error => ...
85 -- end;
87 -- -- Exception_xxx at this point returns the information about
88 -- -- the constraint error, not about any exception raised within
89 -- -- the nested block since it is the static nesting that counts.
91 -----------------------------------
92 -- Use of Library Level Renaming --
93 -----------------------------------
95 -- For greater compatibility with existing legacy software, library
96 -- level renaming may be used to create a function with a name matching
97 -- one that is in use. For example, some versions of VADS Ada provided
98 -- a functin called Current_Exception whose semantics was identical to
99 -- that of GNAT. The following library level renaming declaration:
101 -- with GNAT.Current_Exception;
102 -- function Current_Exception
103 -- renames GNAT.Current_Exception.Exception_Name;
105 -- placed in a file called current_exception.ads and compiled into the
106 -- application compilation environment, will make the function available
107 -- in a manner exactly compatible with that in VADS Ada 83.
109 private
110 pragma Import (Intrinsic, Exception_Information);
111 pragma Import (intrinsic, Exception_Message);
112 pragma Import (Intrinsic, Exception_Name);
114 end GNAT.Current_Exception;