annotate gcc/ada/libgnat/g-curexc.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT LIBRARY COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- G N A T . C U R R E N T _ E X C E P T I O N --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1996-2018, AdaCore --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
17 -- --
kono
parents:
diff changeset
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
19 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
20 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
23 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
25 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
26 -- --
kono
parents:
diff changeset
27 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
29 -- --
kono
parents:
diff changeset
30 ------------------------------------------------------------------------------
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 -- This package provides routines for obtaining the current exception
kono
parents:
diff changeset
33 -- information in Ada 83 style. In Ada 83, there was no official method
kono
parents:
diff changeset
34 -- for obtaining exception information, but a number of vendors supplied
kono
parents:
diff changeset
35 -- routines for this purpose, and this package closely approximates the
kono
parents:
diff changeset
36 -- interfaces supplied by DEC Ada 83 and VADS Ada.
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 -- The routines in this package are associated with a particular exception
kono
parents:
diff changeset
39 -- handler, and can only be called from within an exception handler. See
kono
parents:
diff changeset
40 -- also the package GNAT.Most_Recent_Exception, which provides access to
kono
parents:
diff changeset
41 -- the most recently raised exception, and is not limited to static calls
kono
parents:
diff changeset
42 -- from an exception handler.
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 package GNAT.Current_Exception is
kono
parents:
diff changeset
45 pragma Pure;
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 -----------------
kono
parents:
diff changeset
48 -- Subprograms --
kono
parents:
diff changeset
49 -----------------
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 -- Note: the lower bound of returned String values is always one
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 function Exception_Information return String;
kono
parents:
diff changeset
54 -- Returns the result of calling Ada.Exceptions.Exception_Information
kono
parents:
diff changeset
55 -- with an argument that is the Exception_Occurrence corresponding to
kono
parents:
diff changeset
56 -- the current exception. Returns the null string if called from outside
kono
parents:
diff changeset
57 -- an exception handler.
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 function Exception_Message return String;
kono
parents:
diff changeset
60 -- Returns the result of calling Ada.Exceptions.Exception_Message with
kono
parents:
diff changeset
61 -- an argument that is the Exception_Occurrence corresponding to the
kono
parents:
diff changeset
62 -- current exception. Returns the null string if called from outside an
kono
parents:
diff changeset
63 -- exception handler.
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 function Exception_Name return String;
kono
parents:
diff changeset
66 -- Returns the result of calling Ada.Exceptions.Exception_Name with
kono
parents:
diff changeset
67 -- an argument that is the Exception_Occurrence corresponding to the
kono
parents:
diff changeset
68 -- current exception. Returns the null string if called from outside
kono
parents:
diff changeset
69 -- an exception handler.
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 -- Note: all these functions return useful information only if
kono
parents:
diff changeset
72 -- called statically from within an exception handler, and they
kono
parents:
diff changeset
73 -- return information about the exception corresponding to the
kono
parents:
diff changeset
74 -- handler in which they appear. This is NOT the same as the most
kono
parents:
diff changeset
75 -- recently raised exception. Consider the example:
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 -- exception
kono
parents:
diff changeset
78 -- when Constraint_Error =>
kono
parents:
diff changeset
79 -- begin
kono
parents:
diff changeset
80 -- ...
kono
parents:
diff changeset
81 -- exception
kono
parents:
diff changeset
82 -- when Tasking_Error => ...
kono
parents:
diff changeset
83 -- end;
kono
parents:
diff changeset
84 --
kono
parents:
diff changeset
85 -- -- Exception_xxx at this point returns the information about
kono
parents:
diff changeset
86 -- -- the constraint error, not about any exception raised within
kono
parents:
diff changeset
87 -- -- the nested block since it is the static nesting that counts.
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 -----------------------------------
kono
parents:
diff changeset
90 -- Use of Library Level Renaming --
kono
parents:
diff changeset
91 -----------------------------------
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 -- For greater compatibility with existing legacy software, library
kono
parents:
diff changeset
94 -- level renaming may be used to create a function with a name matching
kono
parents:
diff changeset
95 -- one that is in use. For example, some versions of VADS Ada provided
kono
parents:
diff changeset
96 -- a function called Current_Exception whose semantics was identical to
kono
parents:
diff changeset
97 -- that of GNAT. The following library level renaming declaration:
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 -- with GNAT.Current_Exception;
kono
parents:
diff changeset
100 -- function Current_Exception
kono
parents:
diff changeset
101 -- renames GNAT.Current_Exception.Exception_Name;
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 -- placed in a file called current_exception.ads and compiled into the
kono
parents:
diff changeset
104 -- application compilation environment, will make the function available
kono
parents:
diff changeset
105 -- in a manner exactly compatible with that in VADS Ada 83.
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 private
kono
parents:
diff changeset
108 pragma Import (Intrinsic, Exception_Information);
kono
parents:
diff changeset
109 pragma Import (intrinsic, Exception_Message);
kono
parents:
diff changeset
110 pragma Import (Intrinsic, Exception_Name);
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 end GNAT.Current_Exception;