Start
[mono.git] / mcs / mbas / report.cs
index 50c355f8ae73336ef656846920190bd091ae04bf..64d4863c4e73479394f8e75ac23165ccef7ba3cf 100644 (file)
@@ -14,7 +14,7 @@ using System.Text;
 using System.Collections;
 using System.Diagnostics;
 
-namespace Mono.CSharp {
+namespace Mono.MonoBASIC {
 
        /// <summary>
        ///   This class is used to report errors and warnings t te user.
@@ -58,9 +58,30 @@ namespace Mono.CSharp {
                //
                static Hashtable warning_ignore_table;
                
+               static public int ProcessResults(bool quiet)
+               {
+                       if (!quiet)
+                       {
+                               if (Report.ExpectedError != 0)
+                                       Console.WriteLine("Failed to report expected Error " + Report.ExpectedError);
+                                       
+                               if (Errors == 0) 
+                               {
+                                       if (Warnings == 0) 
+                                               Console.WriteLine("Compilation succeeded");
+                                       else
+                                               Console.WriteLine("Compilation succeeded: {0} warning(s)", Warnings);
+                               }
+                               else
+                                       Console.WriteLine("Compilation failed: {0} Error(s), {1} warnings",     Errors, Warnings);
+                       }
+                       return (Errors == 0)?0:1;
+               }
+               
                static void Check (int code)
                {
-                       if (code == expected_error){
+                       if (code == expected_error)
+                       {
                                if (Fatal)
                                        throw new Exception ();
                                
@@ -68,7 +89,7 @@ namespace Mono.CSharp {
                        }
                }
                
-               static public void RealError (string msg)
+               static private void RealError (string msg)
                {
                        Errors++;
                        Console.WriteLine (msg);
@@ -82,8 +103,7 @@ namespace Mono.CSharp {
                static public void Error (int code, Location l, string text)
                {
                        string msg = String.Format (
-                               "{0}({1}) error CS{2:0000}: {3}", l.Name, l.Row, code, text);
-//                             "{0}({1}) error CS{2}: {3}", l.Name, l.Row, code, text);
+                               "{0}({1},{2}) error BC{3:0000}: {4}", l.Name, l.Row, l.Col, code, text);
                        
                        RealError (msg);
                        Check (code);
@@ -99,17 +119,12 @@ namespace Mono.CSharp {
                        if (WarningsAreErrors)
                                Error (code, l, text);
                        else {
-                               string row;
-                               
                                if (Location.IsNull (l))
-                                       row = "";
+                                       Console.WriteLine(String.Format("{0} warning BC{1:0000}: {2}",
+                                               l.Name, code, text));
                                else
-                                       row = l.Row.ToString ();
-                               
-                               Console.WriteLine (String.Format (
-                                       "{0}({1}) warning CS{2:0000}: {3}",
-//                                     "{0}({1}) warning CS{2}: {3}",
-                                       l.Name,  row, code, text));
+                                       Console.WriteLine(String.Format("{0}({1},{2}) warning BC{3:0000}: {4}",
+                                               l.Name, l.Row, l.Col, code, text));
                                Warnings++;
                                Check (code);
 
@@ -137,8 +152,7 @@ namespace Mono.CSharp {
 
                static public void Error (int code, string text)
                {
-                       string msg = String.Format ("error CS{0:0000}: {1}", code, text);
-//                     string msg = String.Format ("error CS{0}: {1}", code, text);
+                       string msg = String.Format ("error BC{0:0000}: {1}", code, text);
                        
                        RealError (msg);
                        Check (code);