diff --git a/src/Generator/Diagnostics.cs b/src/Generator/Diagnostics.cs new file mode 100644 index 00000000..392e41b1 --- /dev/null +++ b/src/Generator/Diagnostics.cs @@ -0,0 +1,32 @@ +using System; + +namespace Cxxi +{ + public enum DiagnosticKind + { + Message, + Warning, + Error + } + + public struct DiagnosticInfo + { + public string Message; + public string File; + public int Line; + public int Column; + } + + public interface IDiagnosticConsumer + { + void Emit(DiagnosticKind kind, DiagnosticInfo info); + } + + public class TextDiagnosticPrinter : IDiagnosticConsumer + { + public void Emit(DiagnosticKind kind, DiagnosticInfo info) + { + Console.WriteLine(info.Message); + } + } +} diff --git a/src/Generator/Driver.cs b/src/Generator/Driver.cs index 084243e6..0c4ea643 100644 --- a/src/Generator/Driver.cs +++ b/src/Generator/Driver.cs @@ -10,6 +10,7 @@ namespace Cxxi { private readonly Options options; private readonly ILibrary transform; + private readonly IDiagnosticConsumer diagnostics; private readonly TypeMapDatabase typeDatabase; private Library library; @@ -17,6 +18,8 @@ namespace Cxxi { this.options = options; this.transform = transform; + this.diagnostics = new TextDiagnosticPrinter(); + typeDatabase = new TypeMapDatabase(); typeDatabase.SetupTypeMaps(); }