OSDN Git Service

New Language: Ada
[pf3gnuchains/gcc-fork.git] / gcc / ada / g-souinf.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUNTIME COMPONENTS                          --
4 --                                                                          --
5 --                     G N A T . S O U R C E _ I N F O                      --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                            $Revision: 1.5 $
10 --                                                                          --
11 --              Copyright (C) 2000 Ada Core Technologies, Inc.              --
12 --                                                                          --
13 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
14 -- terms of the  GNU General Public License as published  by the Free Soft- --
15 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
16 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
19 -- for  more details.  You should have  received  a copy of the GNU General --
20 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
21 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
22 -- MA 02111-1307, USA.                                                      --
23 --                                                                          --
24 -- As a special exception,  if other files  instantiate  generics from this --
25 -- unit, or you link  this unit with other files  to produce an executable, --
26 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
27 -- covered  by the  GNU  General  Public  License.  This exception does not --
28 -- however invalidate  any other reasons why  the executable file  might be --
29 -- covered by the  GNU Public License.                                      --
30 --                                                                          --
31 -- GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com).   --
32 --                                                                          --
33 ------------------------------------------------------------------------------
34
35 --  This package provides some useful utility subprograms that provide access
36 --  to source code information known at compile time. These subprograms are
37 --  intrinsic operations that provide information known to the compiler in
38 --  a form that can be embedded into the source program for identification
39 --  and logging purposes. For example, an exception handler can print out
40 --  the name of the source file in which the exception is handled.
41
42 package GNAT.Source_Info is
43 pragma Pure (Source_Info);
44
45    function File return String;
46    --  Return the name of the current file, not including the path information.
47    --  The result is considered to be a static string constant.
48
49    function Line return Positive;
50    --  Return the current input line number. The result is considered
51    --  to be a static expression.
52
53    function Source_Location return String;
54    --  Return a string literal of the form "name:line", where name is the
55    --  current source file name without path information, and line is the
56    --  current line number. In the event that instantiations are involved,
57    --  additional suffixes of the same form are appended after the separating
58    --  string " instantiated at ". The result is considered to be a static
59    --  string constant.
60
61    function Enclosing_Entity return String;
62    --  Return the name of the current subprogram, package, task, entry or
63    --  protected subprogram. The string is in exactly the form used for the
64    --  declaration of the entity (casing and encoding conventions), and is
65    --  considered to be a static string constant.
66    --
67    --  Note: if this function is used at the outer level of a generic
68    --  package, the string returned will be the name of the instance,
69    --  not the generic package itself. This is useful in identifying
70    --  and logging information from within generic templates.
71
72 private
73    pragma Import (Intrinsic, File);
74    pragma Import (Intrinsic, Line);
75    pragma Import (Intrinsic, Source_Location);
76    pragma Import (Intrinsic, Enclosing_Entity);
77 end GNAT.Source_Info;