| 1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
| 2 |
|
|
-- --
|
| 3 |
|
|
-- GNAT COMPILER COMPONENTS --
|
| 4 |
|
|
-- --
|
| 5 |
|
|
-- P R J . E R R --
|
| 6 |
|
|
-- --
|
| 7 |
|
|
-- S p e c --
|
| 8 |
|
|
-- --
|
| 9 |
|
|
-- Copyright (C) 2002-2009, 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 3, 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 COPYING3. If not, go to --
|
| 19 |
|
|
-- http://www.gnu.org/licenses for a complete copy of the license. --
|
| 20 |
|
|
-- --
|
| 21 |
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
| 22 |
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
| 23 |
|
|
-- --
|
| 24 |
|
|
------------------------------------------------------------------------------
|
| 25 |
|
|
|
| 26 |
|
|
-- This package contains the routines to output error messages and the scanner
|
| 27 |
|
|
-- for the project files. It replaces Errout and Scn. It is not dependent on
|
| 28 |
|
|
-- the GNAT tree packages (Atree, Sinfo, ...). It uses exactly the same global
|
| 29 |
|
|
-- variables as Errout, located in package Err_Vars. Like Errout, it also uses
|
| 30 |
|
|
-- the common variables and routines in package Erroutc.
|
| 31 |
|
|
--
|
| 32 |
|
|
-- Parameters are set through Err_Vars.Error_Msg_File_* or
|
| 33 |
|
|
-- Err_Vars.Error_Msg_Name_*, and replaced automatically in the messages
|
| 34 |
|
|
-- ("{{" for files, "%%" for names).
|
| 35 |
|
|
--
|
| 36 |
|
|
-- However, in this package you can configure the error messages to be sent
|
| 37 |
|
|
-- to your own callback by setting Report_Error in the flags. This ensures
|
| 38 |
|
|
-- that applications can control where error messages are displayed.
|
| 39 |
|
|
|
| 40 |
|
|
with Scng;
|
| 41 |
|
|
with Errutil;
|
| 42 |
|
|
|
| 43 |
|
|
package Prj.Err is
|
| 44 |
|
|
|
| 45 |
|
|
---------------------------------------------------------
|
| 46 |
|
|
-- Error Message Text and Message Insertion Characters --
|
| 47 |
|
|
---------------------------------------------------------
|
| 48 |
|
|
|
| 49 |
|
|
-- See errutil.ads
|
| 50 |
|
|
|
| 51 |
|
|
-----------------------------------------------------
|
| 52 |
|
|
-- Format of Messages and Manual Quotation Control --
|
| 53 |
|
|
-----------------------------------------------------
|
| 54 |
|
|
|
| 55 |
|
|
-- See errutil.ads
|
| 56 |
|
|
|
| 57 |
|
|
------------------------------
|
| 58 |
|
|
-- Error Output Subprograms --
|
| 59 |
|
|
------------------------------
|
| 60 |
|
|
|
| 61 |
|
|
procedure Initialize renames Errutil.Initialize;
|
| 62 |
|
|
-- Initializes for output of error messages. Must be called for each
|
| 63 |
|
|
-- file before using any of the other routines in the package.
|
| 64 |
|
|
|
| 65 |
|
|
procedure Finalize (Source_Type : String := "project")
|
| 66 |
|
|
renames Errutil.Finalize;
|
| 67 |
|
|
-- Finalize processing of error messages for one file and output message
|
| 68 |
|
|
-- indicating the number of detected errors.
|
| 69 |
|
|
|
| 70 |
|
|
procedure Error_Msg
|
| 71 |
|
|
(Flags : Processing_Flags;
|
| 72 |
|
|
Msg : String;
|
| 73 |
|
|
Location : Source_Ptr := No_Location;
|
| 74 |
|
|
Project : Project_Id := null);
|
| 75 |
|
|
-- Output an error message, either through Flags.Error_Report or through
|
| 76 |
|
|
-- Errutil. The location defaults to the project's location ("project"
|
| 77 |
|
|
-- in the source code). If Msg starts with "?", this is a warning, and
|
| 78 |
|
|
-- Warning: is added at the beginning. If Msg starts with "<", see comment
|
| 79 |
|
|
-- for Err_Vars.Error_Msg_Warn.
|
| 80 |
|
|
|
| 81 |
|
|
-------------
|
| 82 |
|
|
-- Scanner --
|
| 83 |
|
|
-------------
|
| 84 |
|
|
|
| 85 |
|
|
procedure Obsolescent_Check (S : Source_Ptr);
|
| 86 |
|
|
-- Dummy null procedure for Scng instantiation
|
| 87 |
|
|
|
| 88 |
|
|
procedure Post_Scan;
|
| 89 |
|
|
-- Convert an Ada operator symbol into a standard string
|
| 90 |
|
|
|
| 91 |
|
|
package Scanner is new Scng
|
| 92 |
|
|
(Post_Scan => Post_Scan,
|
| 93 |
|
|
Error_Msg => Errutil.Error_Msg,
|
| 94 |
|
|
Error_Msg_S => Errutil.Error_Msg_S,
|
| 95 |
|
|
Error_Msg_SC => Errutil.Error_Msg_SC,
|
| 96 |
|
|
Error_Msg_SP => Errutil.Error_Msg_SP,
|
| 97 |
|
|
Obsolescent_Check => Obsolescent_Check,
|
| 98 |
|
|
Style => Errutil.Style);
|
| 99 |
|
|
-- Instantiation of the generic scanner
|
| 100 |
|
|
|
| 101 |
|
|
end Prj.Err;
|