Moved overrides file to Settings class.

This commit is contained in:
the_fiddler 2010-12-03 09:02:55 +00:00
parent c3bfa7dc9a
commit 2dd61c6afd
5 changed files with 15 additions and 21 deletions

View file

@ -25,7 +25,7 @@ namespace Bind.ES
enumSpecExt = String.Empty;
glSpec = dirName + "/signatures.xml";
glSpecExt = String.Empty;
functionOverridesFile = dirName + "/overrides.xml";
Settings.OverridesFile = dirName + "/overrides.xml";
Settings.ImportsFile = "Core.cs";
Settings.DelegatesFile = "Delegates.cs";

View file

@ -44,7 +44,7 @@ namespace Bind.GL2
enumSpecExt = String.Empty;
glSpec = "GL2/signatures.xml";
glSpecExt = String.Empty;
functionOverridesFile = "GL2/gloverrides.xml";
Settings.OverridesFile = "GL2/gloverrides.xml";
Settings.ImportsFile = "GLCore.cs";
Settings.DelegatesFile = "GLDelegates.cs";

View file

@ -29,8 +29,6 @@ namespace Bind.GL2
protected static string glSpec = "GL2/gl.spec";
protected static string glSpecExt = "";
protected static string functionOverridesFile = "GL2/gloverrides.xml";
protected static string loadAllFuncName = "LoadAll";
protected static Regex enumToDotNet = new Regex("_[a-z|A-Z]?", RegexOptions.Compiled);
@ -38,7 +36,7 @@ namespace Bind.GL2
protected static readonly char[] numbers = "0123456789".ToCharArray();
//protected static readonly Dictionary<string, string> doc_replacements;
protected ISpecReader SpecReader = new XmlSpecReader(functionOverridesFile);
protected ISpecReader SpecReader = new XmlSpecReader();
protected ISpecWriter SpecWriter = new CSharpSpecWriter();
#endregion
@ -69,19 +67,20 @@ namespace Bind.GL2
public virtual void Process()
{
var overrides = new XPathDocument(Path.Combine(Settings.InputPath, functionOverridesFile));
var overrides = new XPathDocument(Path.Combine(Settings.InputPath, Settings.OverridesFile));
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, glTypemap))
{
Type.GLTypes = SpecReader.ReadTypeMap(sr);
}
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, csTypemap))
{
Type.CSTypes = SpecReader.ReadCSTypeMap(sr);
}
var enums = SpecReader.ReadEnums(new StreamReader(Path.Combine(Settings.InputPath, enumSpec)));
var delegates = SpecReader.ReadDelegates(new StreamReader(Path.Combine(Settings.InputPath, glSpec)));
EnumCollection enums;
using (var sr = new StreamReader(Path.Combine(Settings.InputPath, enumSpec)))
enums = SpecReader.ReadEnums(sr);
DelegateCollection delegates;
using (var sr = new StreamReader(Path.Combine(Settings.InputPath, glSpec)))
delegates = SpecReader.ReadDelegates(sr);
enums = new EnumProcessor(overrides).Process(enums);
var wrappers = new FuncProcessor(overrides).Process(delegates, enums);

View file

@ -26,6 +26,7 @@ namespace Bind
public static string DocPath = DefaultDocPath;
public static string DocFile = DefaultDocFile;
public static string LicenseFile = DefaultLicenseFile;
public static string OverridesFile = "GL2/gloverrides.xml";
public static string GLClass = "GL"; // Needed by Glu for the AuxEnumsClass. Can be set through -gl:"xxx".
public static string OutputClass = "GL"; // The real output class. Can be set through -class:"xxx".

View file

@ -40,19 +40,12 @@ namespace Bind
class XmlSpecReader : ISpecReader
{
readonly string functionOverridesFile;
public XmlSpecReader(string functionOverridesFile)
{
this.functionOverridesFile = functionOverridesFile;
}
public DelegateCollection ReadDelegates(StreamReader specFile)
{
DelegateCollection delegates = new DelegateCollection();
XPathDocument specs = new XPathDocument(specFile);
XPathDocument overrides = new XPathDocument(new StreamReader(
Path.Combine(Settings.InputPath, functionOverridesFile)));
Path.Combine(Settings.InputPath, Settings.OverridesFile)));
foreach (XPathNavigator nav in new XPathNavigator[] {
specs.CreateNavigator().SelectSingleNode("/signatures"),
@ -208,7 +201,8 @@ namespace Bind
EnumCollection enums = new EnumCollection();
Enum all = new Enum() { Name = Settings.CompleteEnumName };
XPathDocument specs = new XPathDocument(specFile);
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
XPathDocument overrides = new XPathDocument(new StreamReader(
Path.Combine(Settings.InputPath, Settings.OverridesFile)));
foreach (XPathNavigator nav in new XPathNavigator[] {
specs.CreateNavigator().SelectSingleNode("/signatures"),