1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
-------------------------------------------------------------------------------
-- (C) Altran Praxis Limited
-------------------------------------------------------------------------------
--
-- The SPARK toolset is free software; you can redistribute it and/or modify it
-- under terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any later
-- version. The SPARK toolset is distributed in the hope that it will be
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-- Public License for more details. You should have received a copy of the GNU
-- General Public License distributed with the SPARK toolset; see file
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy of
-- the license.
--
--=============================================================================
with SPARK_IO;
with SparkMakeDebug;
with SystemErrors;
package body SparkMakeErrors is
subtype Error is Fault range Fault'First .. Cannot_Close_File;
subtype Warning is Fault range Fault'Succ (Error'Last) .. Fault'Last;
procedure Report
(The_Fault : in Fault;
E_Str1 : in E_Strings.T;
E_Str2 : in E_Strings.T;
E_Str3 : in E_Strings.T)
is
begin
case The_Fault is
when Error =>
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "!!! Sparkmake error: ", 0);
when Warning =>
SPARK_IO.Put_String (SPARK_IO.Standard_Output, ">>> Sparkmake warning: ", 0);
end case;
case The_Fault is
-- COMMAND LINE FAULTS
when Invalid_Switch =>
E_Strings.Put_String (File => SPARK_IO.Standard_Output,
E_Str => E_Str1);
SPARK_IO.Put_Line (SPARK_IO.Standard_Output, " is not a recognised switch", 0);
when Invalid_Argument =>
E_Strings.Put_String (File => SPARK_IO.Standard_Output,
E_Str => E_Str1);
SPARK_IO.Put_String (SPARK_IO.Standard_Output, " is not a valid argument for switch ", 0);
E_Strings.Put_Line (File => SPARK_IO.Standard_Output,
E_Str => E_Str2);
when Duplicate_Switch =>
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "The switch ", 0);
E_Strings.Put_String (File => SPARK_IO.Standard_Output,
E_Str => E_Str1);
SPARK_IO.Put_Line (SPARK_IO.Standard_Output, " cannot be duplicated", 0);
when Cannot_Find_File =>
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "Could not find the file ", 0);
E_Strings.Put_Line (File => SPARK_IO.Standard_Output,
E_Str => E_Str1);
-- INDEX FILE FAULTS
when Duplicate_Errors =>
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "Unit ", 0);
E_Strings.Put_String (File => SPARK_IO.Standard_Output,
E_Str => E_Str1);
SPARK_IO.Put_String (SPARK_IO.Standard_Output, " is duplicated in files ", 0);
E_Strings.Put_String (File => SPARK_IO.Standard_Output,
E_Str => E_Str2);
SPARK_IO.Put_String (SPARK_IO.Standard_Output, " and ", 0);
E_Strings.Put_Line (File => SPARK_IO.Standard_Output,
E_Str => E_Str3);
when Duplicate_Okay =>
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "Unit ", 0);
E_Strings.Put_String (File => SPARK_IO.Standard_Output,
E_Str => E_Str1);
SPARK_IO.Put_String (SPARK_IO.Standard_Output, " in file ", 0);
E_Strings.Put_String (File => SPARK_IO.Standard_Output,
E_Str => E_Str2);
SPARK_IO.Put_String (SPARK_IO.Standard_Output, " is already seen in ", 0);
E_Strings.Put_Line (File => SPARK_IO.Standard_Output,
E_Str => E_Str3);
when Invalid_Unit =>
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "File ", 0);
E_Strings.Put_String (File => SPARK_IO.Standard_Output,
E_Str => E_Str1);
SPARK_IO.Put_Line (SPARK_IO.Standard_Output, " does not contain a valid unit", 0);
when Multiple_Main_Programs =>
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "Files ", 0);
E_Strings.Put_String (File => SPARK_IO.Standard_Output,
E_Str => E_Str1);
SPARK_IO.Put_String (SPARK_IO.Standard_Output, " and ", 0);
E_Strings.Put_String (File => SPARK_IO.Standard_Output,
E_Str => E_Str2);
SPARK_IO.Put_Line (SPARK_IO.Standard_Output, " both contain main programs", 0);
-- GENERAL FILE HANDLING FAULTS
when Cannot_Open_File =>
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "Cannot open ", 0);
E_Strings.Put_Line (File => SPARK_IO.Standard_Output,
E_Str => E_Str1);
when Cannot_Close_File =>
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "Cannot close ", 0);
E_Strings.Put_Line (File => SPARK_IO.Standard_Output,
E_Str => E_Str1);
end case;
end Report;
procedure Fatal (Text : in String) is
--# hide Fatal;
begin
SparkMakeDebug.Report_Text (Text => "Fatal error: " & Text);
SystemErrors.Fatal_Error (Sys_Err => SystemErrors.Other_Internal_Error,
Msg => "Internal error. ");
end Fatal;
end SparkMakeErrors;
|