OSDN Git Service

2007-04-20 Ed Schonberg <schonberg@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / binderr.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              B I N D E R R                               --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 1992-2007, Free Software Foundation, 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,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 --  This package contains the routines to output error messages for the binder
28 --  and also the routines for handling fatal error conditions in the binder.
29
30 with Namet; use Namet;
31 with Types; use Types;
32
33 package Binderr is
34
35    Errors_Detected : Int;
36    --  Number of errors detected so far
37
38    Warnings_Detected : Int;
39    --  Number of warnings detected
40
41    Info_Prefix_Suppress : Boolean := False;
42    --  If set to True, the normal "info: " header before messages generated
43    --  by Error_Msg_Info will be omitted.
44
45    ---------------------------------------------------------
46    -- Error Message Text and Message Insertion Characters --
47    ---------------------------------------------------------
48
49    --  Error message text strings are composed of letters, digits and the
50    --  special characters space, comma, period, colon and semicolon,
51    --  apostrophe and parentheses. Special insertion characters can also
52    --  appear which cause the error message circuit to modify the given
53    --  string as follows:
54
55    --    Insertion character { (Left brace: insert file name from Names table)
56    --      The character { is replaced by the text for the file name specified
57    --      by the File_Name_Type value stored in Error_Msg_File_1. The name is
58    --      always enclosed in quotes. A second % may appear in a single message
59    --      in which case it is similarly replaced by the name which is
60    --      specified by the File_Name_Type value stored in Error_Msg_File_2.
61
62    --    Insertion character $ (Dollar: insert unit name from Names table)
63    --      The character & is replaced by the text for the unit name specified
64    --      by the Name_Id value stored in Error_Msg_Unit_1. The name is always
65    --      enclosed in quotes. A second & may appear in a single message in
66    --      which case it is similarly replaced by the name which is specified
67    --      by the Name_Id value stored in Error_Msg_Unit_2.
68
69    --    Insertion character # (Pound: insert non-negative number in decimal)
70    --      The character # is replaced by the contents of Error_Msg_Nat_1
71    --      converted into an unsigned decimal string. A second # may appear
72    --      in a single message, in which case it is similarly replaced by
73    --      the value stored in Error_Msg_Nat_2.
74
75    --    Insertion character ? (Question mark: warning message)
76    --      The character ?, which must be the first character in the message
77    --      string, signals a warning message instead of an error message.
78
79    -----------------------------------------------------
80    -- Global Values Used for Error Message Insertions --
81    -----------------------------------------------------
82
83    --  The following global variables are essentially additional parameters
84    --  passed to the error message routine for insertion sequences described
85    --  above. The reason these are passed globally is that the insertion
86    --  mechanism is essentially an untyped one in which the appropriate
87    --  variables are set depending on the specific insertion characters used.
88
89    Error_Msg_Name_1 : Name_Id;
90    --  Name_Id value for % insertion characters in message
91
92    Error_Msg_File_1 : File_Name_Type;
93    Error_Msg_File_2 : File_Name_Type;
94    --  Name_Id values for { insertion characters in message
95
96    Error_Msg_Unit_1 : Unit_Name_Type;
97    Error_Msg_Unit_2 : Unit_Name_Type;
98    --  Name_Id values for $ insertion characters in message
99
100    Error_Msg_Nat_1 : Nat;
101    Error_Msg_Nat_2 : Nat;
102    --  Integer values for # insertion characters in message
103
104    ------------------------------
105    -- Error Output Subprograms --
106    ------------------------------
107
108    procedure Error_Msg (Msg : String);
109    --  Output specified error message to standard error or standard output
110    --  as governed by the brief and verbose switches, and update error
111    --  counts appropriately
112
113    procedure Error_Msg_Info (Msg : String);
114    --  Output information line. Indentical in effect to Error_Msg, except
115    --  that the prefix is info: instead of error: and the error count is
116    --  not incremented. The prefix may be suppressed by setting the global
117    --  variable Info_Prefix_Suppress to True.
118
119    procedure Error_Msg_Output (Msg : String; Info : Boolean);
120    --  Output given message, with insertions, to current message output file.
121    --  The second argument is True for an info message, false for a normal
122    --  warning or error message. Normally this is not called directly, but
123    --  rather only by Error_Msg or Error_Msg_Info. It is called directly
124    --  when the caller must control whether the output goes to stderr or
125    --  stdout (Error_Msg_Output always goes to the current output file).
126
127    procedure Finalize_Binderr;
128    --  Finalize error output for one file
129
130    procedure Initialize_Binderr;
131    --  Initialize error output for one file
132
133 end Binderr;