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-2003 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,  59 Temple Place - Suite 330,  Boston, --
20-- MA 02111-1307, 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
30with Types; use Types;
31
32package Binderr is
33
34   Errors_Detected : Int;
35   --  Number of errors detected so far
36
37   Warnings_Detected : Int;
38   --  Number of warnings detected
39
40   Info_Prefix_Suppress : Boolean := False;
41   --  If set to True, the normal "info: " header before messages generated
42   --  by Error_Msg_Info will be omitted.
43
44   ---------------------------------------------------------
45   -- Error Message Text and Message Insertion Characters --
46   ---------------------------------------------------------
47
48   --  Error message text strings are composed of letters, digits and the
49   --  special characters space, comma, period, colon and semicolon,
50   --  apostrophe and parentheses. Special insertion characters can also
51   --  appear which cause the error message circuit to modify the given
52   --  string as follows:
53
54   --    Insertion character % (Percent: insert file name from Names table)
55   --      The character % is replaced by the text for the file name specified
56   --      by the Name_Id value stored in Error_Msg_Name_1. The name is always
57   --      enclosed in quotes. A second % may appear in a single message in
58   --      which case it is similarly replaced by the name which is specified
59   --      by the Name_Id value stored in Error_Msg_Name_2.
60
61   --    Insertion character & (Ampersand: insert unit name from Names table)
62   --      The character & is replaced by the text for the unit name specified
63   --      by the Name_Id value stored in Error_Msg_Name_1. The name is always
64   --      enclosed in quotes. A second & may appear in a single message in
65   --      which case it is similarly replaced by the name which is specified
66   --      by the Name_Id value stored in Error_Msg_Name_2.
67
68   --    Insertion character # (Pound: insert non-negative number in decimal)
69   --      The character # is replaced by the contents of Error_Msg_Nat_1
70   --      converted into an unsigned decimal string. A second # may appear
71   --      in a single message, in which case it is similarly replaced by
72   --      the value stored in Error_Msg_Nat_2.
73
74   --    Insertion character ? (Question mark: warning message)
75   --      The character ?, which must be the first character in the message
76   --      string, signals a warning message instead of an error message.
77
78   -----------------------------------------------------
79   -- Global Values Used for Error Message Insertions --
80   -----------------------------------------------------
81
82   --  The following global variables are essentially additional parameters
83   --  passed to the error message routine for insertion sequences described
84   --  above. The reason these are passed globally is that the insertion
85   --  mechanism is essentially an untyped one in which the appropriate
86   --  variables are set dependingon the specific insertion characters used.
87
88   Error_Msg_Name_1 : Name_Id;
89   Error_Msg_Name_2 : Name_Id;
90   --  Name_Id values for % insertion characters in message
91
92   Error_Msg_Nat_1 : Nat;
93   Error_Msg_Nat_2 : Nat;
94   --  Integer values for # insertion characters in message
95
96   ------------------------------
97   -- Error Output Subprograms --
98   ------------------------------
99
100   procedure Error_Msg (Msg : String);
101   --  Output specified error message to standard error or standard output
102   --  as governed by the brief and verbose switches, and update error
103   --  counts appropriately
104
105   procedure Error_Msg_Info (Msg : String);
106   --  Output information line. Indentical in effect to Error_Msg, except
107   --  that the prefix is info: instead of error: and the error count is
108   --  not incremented. The prefix may be suppressed by setting the global
109   --  variable Info_Prefix_Suppress to True.
110
111   procedure Error_Msg_Output (Msg : String; Info : Boolean);
112   --  Output given message, with insertions, to current message output file.
113   --  The second argument is True for an info message, false for a normal
114   --  warning or error message. Normally this is not called directly, but
115   --  rather only by Error_Msg or Error_Msg_Info. It is called directly
116   --  when the caller must control whether the output goes to stderr or
117   --  stdout (Error_Msg_Output always goes to the current output file).
118
119   procedure Finalize_Binderr;
120   --  Finalize error output for one file
121
122   procedure Initialize_Binderr;
123   --  Initialize error output for one file
124
125end Binderr;
126