Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Report.cs « ilasm « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 02d6536253264f1ef6bbde8ced00fcfc6bc85af2 (plain)
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
//
// Mono.ILASM.Report
//
// Author(s):
//  Jackson Harper (Jackson@LatitudeGeo.com)
//
// (C) 2003 Jackson Harper, All rights reserved
//


using System;
using System.IO;

namespace Mono.ILASM {

        public abstract class Report {

                private static int error_count;
                private static int mark_count;
                private static bool quiet;

                static Report ()
                {
                        error_count = 0;
			quiet = false;
                }

                public static int ErrorCount {
                        get { return error_count; }
                }

		public static bool Quiet {
			get { return quiet; }
			set { quiet = value; }
		}

                public static void AssembleFile (string file, string listing,
                                          string target, string output)
                {
                        Console.WriteLine ("Assembling '{0}' , {1}, to {2} --> '{3}'", file,
                                           GetListing (listing), target, output);
                        Console.WriteLine ();
                }

                public static void Error (string message)
                {
                        error_count++;
                        throw new ILAsmException (message);
                }

                public static void Message (string message)
                {
                        if (quiet)
                                return;
                        Console.WriteLine (message);
                }
                
                private static string GetListing (string listing)
                {
                        if (listing == null)
                                return "no listing file";
                        return listing;
                }

        }

        public class ILAsmException : Exception {

                string message;
                Location location;
                
                public ILAsmException (Location location, string message)
                {
                        this.location = location;
                        this.message = message;
                }

                public ILAsmException (string message)
                {
                        this.message = message;
                }

                public override string Message {
                        get { return message; }
                }

        }

        public class InternalErrorException : Exception {
                public InternalErrorException ()
                        : base ("Internal error")
                {
                }

                public InternalErrorException (string message)
                        : base (message)
                {
                }
        }

}