OSDN Git Service

Add NIOS2 support. Code from SourceyG++.
[pf3gnuchains/gcc-fork.git] / gcc / ada / g-souinf.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUN-TIME 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 --                     Copyright (C) 2000-2005 AdaCore                      --
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,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, 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 ------------------------------------------------------------------------------
33
34 --  This package provides some useful utility subprograms that provide access
35 --  to source code information known at compile time. These subprograms are
36 --  intrinsic operations that provide information known to the compiler in
37 --  a form that can be embedded into the source program for identification
38 --  and logging purposes. For example, an exception handler can print out
39 --  the name of the source file in which the exception is handled.
40
41 package GNAT.Source_Info is
42    pragma Pure;
43
44    function File return String;
45    --  Return the name of the current file, not including the path information.
46    --  The result is considered to be a static string constant.
47
48    function Line return Positive;
49    --  Return the current input line number. The result is considered to be a
50    --  static expression.
51
52    function Source_Location return String;
53    --  Return a string literal of the form "name:line", where name is the
54    --  current source file name without path information, and line is the
55    --  current line number. In the event that instantiations are involved,
56    --  additional suffixes of the same form are appended after the separating
57    --  string " instantiated at ". The result is considered to be a static
58    --  string constant.
59
60    function Enclosing_Entity return String;
61    --  Return the name of the current subprogram, package, task, entry or
62    --  protected subprogram. The string is in exactly the form used for the
63    --  declaration of the entity (casing and encoding conventions), and is
64    --  considered to be a static string constant. The name is fully qualified
65    --  using periods where possible (this is not always possible, notably in
66    --  the case of entities appearing in unnamed block statements.)
67    --
68    --  Note: if this function is used at the outer level of a generic package,
69    --  the string returned will be the name of the instance, not the generic
70    --  package itself. This is useful in identifying and logging information
71    --  from within generic templates.
72
73 private
74    pragma Import (Intrinsic, File);
75    pragma Import (Intrinsic, Line);
76    pragma Import (Intrinsic, Source_Location);
77    pragma Import (Intrinsic, Enclosing_Entity);
78 end GNAT.Source_Info;