diff --git a/src/Generator/Generators/CLI/CLIGenerator.cs b/src/Generator/Generators/CLI/CLIGenerator.cs index 7da3dca4..fc013c32 100644 --- a/src/Generator/Generators/CLI/CLIGenerator.cs +++ b/src/Generator/Generators/CLI/CLIGenerator.cs @@ -17,7 +17,7 @@ namespace Cxxi.Generators.CLI void WriteTemplate(TextTemplate template) { - var file = Path.GetFileNameWithoutExtension(template.unit.FileName) + var file = Path.GetFileNameWithoutExtension(template.TranslationUnit.FileName) + Driver.Options.WrapperSuffix + "." + template.FileExtension; diff --git a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs index f2c8d7f1..7484c5ed 100644 --- a/src/Generator/Generators/CLI/CLIHeadersTemplate.cs +++ b/src/Generator/Generators/CLI/CLIHeadersTemplate.cs @@ -25,7 +25,7 @@ namespace Cxxi.Generators.CLI WriteLine("#pragma once"); NewLine(); - WriteLine("#include <{0}>", unit.IncludePath); + WriteLine("#include <{0}>", TranslationUnit.IncludePath); GenerateIncludeForwardRefs(); NewLine(); @@ -38,7 +38,7 @@ namespace Cxxi.Generators.CLI public void GenerateIncludeForwardRefs() { - var typeRefs = unit.TypeReferences as TypeRefsVisitor; + var typeRefs = TranslationUnit.TypeReferences as TypeRefsVisitor; forwardRefsPrinter = new CLIForwardReferencePrinter(typeRefs); forwardRefsPrinter.Process(); @@ -50,7 +50,7 @@ namespace Cxxi.Generators.CLI if (string.IsNullOrWhiteSpace(include)) continue; - if (include == Path.GetFileNameWithoutExtension(unit.FileName)) + if (include == Path.GetFileNameWithoutExtension(TranslationUnit.FileName)) continue; includes.Add(string.Format("#include \"{0}.h\"", include)); @@ -92,16 +92,16 @@ namespace Cxxi.Generators.CLI bool needsNewline = false; // Generate all the enum declarations for the module. - for (var i = 0; i < unit.Enums.Count; ++i) + for (var i = 0; i < TranslationUnit.Enums.Count; ++i) { - var @enum = unit.Enums[i]; + var @enum = TranslationUnit.Enums[i]; if (@enum.Ignore || @enum.IsIncomplete) continue; GenerateEnum(@enum); NeedNewLine(); - if (i < unit.Enums.Count - 1) + if (i < TranslationUnit.Enums.Count - 1) NewLine(); } @@ -113,9 +113,9 @@ namespace Cxxi.Generators.CLI needsNewline = false; // Generate all the struct/class declarations for the module. - for (var i = 0; i < unit.Classes.Count; ++i) + for (var i = 0; i < TranslationUnit.Classes.Count; ++i) { - var @class = unit.Classes[i]; + var @class = TranslationUnit.Classes[i]; if (@class.Ignore || @class.IsIncomplete) continue; @@ -126,11 +126,11 @@ namespace Cxxi.Generators.CLI GenerateClass(@class); needsNewline = true; - if (i < unit.Classes.Count - 1) + if (i < TranslationUnit.Classes.Count - 1) NewLine(); } - if (unit.HasFunctions) + if (TranslationUnit.HasFunctions) { if (needsNewline) NewLine(); @@ -143,7 +143,7 @@ namespace Cxxi.Generators.CLI public void GenerateTypedefs() { - foreach (var typedef in unit.Typedefs) + foreach (var typedef in TranslationUnit.Typedefs) { if (typedef.Ignore) continue; @@ -158,13 +158,13 @@ namespace Cxxi.Generators.CLI public void GenerateFunctions() { WriteLine("public ref class {0}{1}", SafeIdentifier(Library.Name), - unit.FileNameWithoutExtension); + TranslationUnit.FileNameWithoutExtension); WriteLine("{"); WriteLine("public:"); PushIndent(); // Generate all the function declarations for the module. - foreach (var function in unit.Functions) + foreach (var function in TranslationUnit.Functions) { GenerateFunction(function); } diff --git a/src/Generator/Generators/CLI/CLISourcesTemplate.cs b/src/Generator/Generators/CLI/CLISourcesTemplate.cs index b41e6eaa..b16ec203 100644 --- a/src/Generator/Generators/CLI/CLISourcesTemplate.cs +++ b/src/Generator/Generators/CLI/CLISourcesTemplate.cs @@ -20,7 +20,7 @@ namespace Cxxi.Generators.CLI GenerateStart(); WriteLine("#include \"{0}{1}.h\"", - Path.GetFileNameWithoutExtension(unit.FileName), + Path.GetFileNameWithoutExtension(TranslationUnit.FileName), Options.WrapperSuffix); GenerateForwardReferenceHeaders(); @@ -38,7 +38,7 @@ namespace Cxxi.Generators.CLI { var includes = new SortedSet(StringComparer.InvariantCulture); - var typeRefs = unit.TypeReferences as TypeRefsVisitor; + var typeRefs = TranslationUnit.TypeReferences as TypeRefsVisitor; // Generate the forward references. foreach (var forwardRef in typeRefs.ForwardReferences) @@ -59,7 +59,7 @@ namespace Cxxi.Generators.CLI var includeName = Path.GetFileNameWithoutExtension(translationUnit.FileName); - if (includeName == Path.GetFileNameWithoutExtension(((TextTemplate) this).unit.FileName)) + if (includeName == Path.GetFileNameWithoutExtension(((TextTemplate) this).TranslationUnit.FileName)) continue; includes.Add(string.Format("#include \"{0}.h\"", includeName)); @@ -75,9 +75,9 @@ namespace Cxxi.Generators.CLI public void GenerateDeclarations() { // Generate all the struct/class definitions for the module. - for (var i = 0; i < unit.Classes.Count; ++i) + for (var i = 0; i < TranslationUnit.Classes.Count; ++i) { - var @class = unit.Classes[i]; + var @class = TranslationUnit.Classes[i]; if (@class.Ignore) continue; @@ -88,14 +88,14 @@ namespace Cxxi.Generators.CLI GenerateClass(@class); } - if (unit.HasFunctions) + if (TranslationUnit.HasFunctions) { - var staticClassName = Library.Name + unit.FileNameWithoutExtension; + var staticClassName = Library.Name + TranslationUnit.FileNameWithoutExtension; // Generate all the function declarations for the module. - for (var i = 0; i < unit.Functions.Count; ++i) + for (var i = 0; i < TranslationUnit.Functions.Count; ++i) { - var function = unit.Functions[i]; + var function = TranslationUnit.Functions[i]; if (function.Ignore) continue; diff --git a/src/Generator/Generators/CSharp/CSharpGenerator.cs b/src/Generator/Generators/CSharp/CSharpGenerator.cs index 8ba50b14..6a9a74ae 100644 --- a/src/Generator/Generators/CSharp/CSharpGenerator.cs +++ b/src/Generator/Generators/CSharp/CSharpGenerator.cs @@ -16,7 +16,7 @@ namespace Cxxi.Generators.CSharp void WriteTemplate(TextTemplate template) { - var file = Path.GetFileNameWithoutExtension(template.unit.FileName) + var file = Path.GetFileNameWithoutExtension(template.TranslationUnit.FileName) + Driver.Options.WrapperSuffix + "." + template.FileExtension; diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index 3865b121..cead6345 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -77,7 +77,7 @@ namespace Cxxi.Generators.CSharp public void GenerateDeclarations() { // Generate all the enum declarations for the module. - foreach (var @enum in unit.Enums) + foreach (var @enum in TranslationUnit.Enums) { if (@enum.Ignore || @enum.IsIncomplete) continue; @@ -87,7 +87,7 @@ namespace Cxxi.Generators.CSharp } // Generate all the typedef declarations for the module. - foreach (var typedef in unit.Typedefs) + foreach (var typedef in TranslationUnit.Typedefs) { if (typedef.Ignore) continue; @@ -98,7 +98,7 @@ namespace Cxxi.Generators.CSharp } // Generate all the struct/class declarations for the module. - foreach (var @class in unit.Classes) + foreach (var @class in TranslationUnit.Classes) { if (@class.Ignore) continue; @@ -106,13 +106,13 @@ namespace Cxxi.Generators.CSharp NewLine(); } - if (unit.HasFunctions) + if (TranslationUnit.HasFunctions) { WriteLine("public partial class " + SafeIdentifier(Options.LibraryName)); WriteStartBraceIndent(); // Generate all the function declarations for the module. - foreach (var function in unit.Functions) + foreach (var function in TranslationUnit.Functions) GenerateFunction(function); WriteCloseBraceIndent(); diff --git a/src/Generator/Generators/Template.cs b/src/Generator/Generators/Template.cs index 6cc466d5..3a9dd788 100644 --- a/src/Generator/Generators/Template.cs +++ b/src/Generator/Generators/Template.cs @@ -9,7 +9,7 @@ public DriverOptions Options { get; set; } public Library Library { get; set; } public ILibrary Transform; - public TranslationUnit unit { get; set; } + public TranslationUnit TranslationUnit { get; set; } public abstract string FileExtension { get; } public abstract void Generate(); @@ -20,7 +20,7 @@ Options = driver.Options; Library = driver.Library; Transform = driver.Transform; - this.unit = unit; + TranslationUnit = unit; } } } \ No newline at end of file