From c3bfa7dc9a5aaa71352e6414ae15e3feab9e9ce4 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Thu, 2 Dec 2010 21:58:49 +0000 Subject: [PATCH] Moved output filenames to Settings class. --- Source/Bind/CL/CLGenerator.cs | 2 +- Source/Bind/CSharpSpecWriter.cs | 20 ++++---------------- Source/Bind/ES/ESGenerator.cs | 8 ++++---- Source/Bind/GL2/GL4Generator.cs | 8 ++++---- Source/Bind/GL2/Generator.cs | 13 ++++++------- Source/Bind/Settings.cs | 5 +++++ 6 files changed, 24 insertions(+), 32 deletions(-) diff --git a/Source/Bind/CL/CLGenerator.cs b/Source/Bind/CL/CLGenerator.cs index 6f9b28e0..e0067e23 100644 --- a/Source/Bind/CL/CLGenerator.cs +++ b/Source/Bind/CL/CLGenerator.cs @@ -16,7 +16,7 @@ namespace Bind.CL { glTypemap = null; - wrappersFile = "CL.cs"; + Settings.WrappersFile = "CL.cs"; Settings.FunctionPrefix = "cl"; Settings.ConstantPrefix = "CL_"; diff --git a/Source/Bind/CSharpSpecWriter.cs b/Source/Bind/CSharpSpecWriter.cs index 13b5a1ec..702cd860 100644 --- a/Source/Bind/CSharpSpecWriter.cs +++ b/Source/Bind/CSharpSpecWriter.cs @@ -41,20 +41,8 @@ namespace Bind sealed class CSharpSpecWriter : ISpecWriter { - readonly string wrappersFile; - readonly string enumsFile; - readonly string delegatesFile; - readonly string importsFile; readonly char[] numbers = "0123456789".ToCharArray(); - public CSharpSpecWriter(string wrappersFile, string importsFile, string enumsFile, string delegatesFile) - { - this.wrappersFile = wrappersFile; - this.importsFile = importsFile; - this.enumsFile = enumsFile; - this.delegatesFile = delegatesFile; - } - #region WriteBindings public void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums) @@ -156,10 +144,10 @@ namespace Bind sw.WriteLine("}"); } - string output_enums = Path.Combine(Settings.OutputPath, enumsFile); - string output_delegates = Path.Combine(Settings.OutputPath, delegatesFile); - string output_core = Path.Combine(Settings.OutputPath, importsFile); - string output_wrappers = Path.Combine(Settings.OutputPath, wrappersFile); + string output_enums = Path.Combine(Settings.OutputPath, Settings.EnumsFile); + string output_delegates = Path.Combine(Settings.OutputPath, Settings.DelegatesFile); + string output_core = Path.Combine(Settings.OutputPath, Settings.ImportsFile); + string output_wrappers = Path.Combine(Settings.OutputPath, Settings.WrappersFile); if (File.Exists(output_enums)) File.Delete(output_enums); if (File.Exists(output_delegates)) File.Delete(output_delegates); diff --git a/Source/Bind/ES/ESGenerator.cs b/Source/Bind/ES/ESGenerator.cs index 3a70e3b9..18e2c4ff 100644 --- a/Source/Bind/ES/ESGenerator.cs +++ b/Source/Bind/ES/ESGenerator.cs @@ -27,10 +27,10 @@ namespace Bind.ES glSpecExt = String.Empty; functionOverridesFile = dirName + "/overrides.xml"; - importsFile = "Core.cs"; - delegatesFile = "Delegates.cs"; - enumsFile = "Enums.cs"; - wrappersFile = "ES.cs"; + Settings.ImportsFile = "Core.cs"; + Settings.DelegatesFile = "Delegates.cs"; + Settings.EnumsFile = "Enums.cs"; + Settings.WrappersFile = "ES.cs"; Settings.ImportsClass = "Core"; Settings.DelegatesClass = "Delegates"; diff --git a/Source/Bind/GL2/GL4Generator.cs b/Source/Bind/GL2/GL4Generator.cs index 33cd7149..d1d0a1c3 100644 --- a/Source/Bind/GL2/GL4Generator.cs +++ b/Source/Bind/GL2/GL4Generator.cs @@ -46,10 +46,10 @@ namespace Bind.GL2 glSpecExt = String.Empty; functionOverridesFile = "GL2/gloverrides.xml"; - importsFile = "GLCore.cs"; - delegatesFile = "GLDelegates.cs"; - enumsFile = "GLEnums.cs"; - wrappersFile = "GL.cs"; + Settings.ImportsFile = "GLCore.cs"; + Settings.DelegatesFile = "GLDelegates.cs"; + Settings.EnumsFile = "GLEnums.cs"; + Settings.WrappersFile = "GL.cs"; Settings.ImportsClass = "Core"; Settings.DelegatesClass = "Delegates"; diff --git a/Source/Bind/GL2/Generator.cs b/Source/Bind/GL2/Generator.cs index e23afb31..21cc38f1 100644 --- a/Source/Bind/GL2/Generator.cs +++ b/Source/Bind/GL2/Generator.cs @@ -29,11 +29,6 @@ namespace Bind.GL2 protected static string glSpec = "GL2/gl.spec"; protected static string glSpecExt = ""; - protected static string importsFile = "GLCore.cs"; - protected static string delegatesFile = "GLDelegates.cs"; - protected static string enumsFile = "GLEnums.cs"; - protected static string wrappersFile = "GL.cs"; - protected static string functionOverridesFile = "GL2/gloverrides.xml"; protected static string loadAllFuncName = "LoadAll"; @@ -44,8 +39,7 @@ namespace Bind.GL2 //protected static readonly Dictionary doc_replacements; protected ISpecReader SpecReader = new XmlSpecReader(functionOverridesFile); - protected ISpecWriter SpecWriter = new CSharpSpecWriter(wrappersFile, importsFile, - enumsFile, delegatesFile); + protected ISpecWriter SpecWriter = new CSharpSpecWriter(); #endregion @@ -62,6 +56,11 @@ namespace Bind.GL2 { // Defaults } + + Settings.ImportsFile = "GLCore.cs"; + Settings.DelegatesFile = "GLDelegates.cs"; + Settings.EnumsFile = "GLEnums.cs"; + Settings.WrappersFile = "GL.cs"; } #endregion diff --git a/Source/Bind/Settings.cs b/Source/Bind/Settings.cs index 773728bc..6209de01 100644 --- a/Source/Bind/Settings.cs +++ b/Source/Bind/Settings.cs @@ -33,6 +33,11 @@ namespace Bind public static string ConstantPrefix = "GL_"; public static string EnumPrefix = ""; + public static string ImportsFile = "Core.cs"; + public static string DelegatesFile = "Delegates.cs"; + public static string EnumsFile = "Enums.cs"; + public static string WrappersFile = "GL.cs"; + // TODO: This code is too fragile. // Old enums code: public static string normalEnumsClassOverride = null;