mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 20:15:31 +00:00
Applied Barlog's 02_Bind_2172_ShortenQualifierReferences patch.
This commit is contained in:
parent
6581d66007
commit
41f4adb09e
|
@ -7,13 +7,15 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Bind.Structures;
|
||||
using Enum=Bind.Structures.Enum;
|
||||
|
||||
namespace Bind
|
||||
{
|
||||
class BindStreamWriter : StreamWriter
|
||||
{
|
||||
int indent_level = 0;
|
||||
Regex splitLines = new Regex(System.Environment.NewLine, RegexOptions.Compiled);
|
||||
Regex splitLines = new Regex(Environment.NewLine, RegexOptions.Compiled);
|
||||
//Regex splitLines = new Regex("(\r\n|\n\r|\n|\r)", RegexOptions.Compiled);
|
||||
|
||||
public BindStreamWriter(string file)
|
||||
|
@ -59,13 +61,13 @@ namespace Bind
|
|||
base.WriteLine(value);
|
||||
}
|
||||
|
||||
public void Write(Bind.Structures.Enum e)
|
||||
public void Write(Enum e)
|
||||
{
|
||||
foreach (string s in splitLines.Split(e.ToString()))
|
||||
WriteLine(s.TrimEnd('\r', '\n'));
|
||||
}
|
||||
|
||||
public void Write(Bind.Structures.Function f)
|
||||
public void Write(Function f)
|
||||
{
|
||||
foreach (string s in splitLines.Split(f.ToString()))
|
||||
WriteLine(s);
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.XPath;
|
||||
using Bind.GL2;
|
||||
using Bind.Structures;
|
||||
using Delegate=Bind.Structures.Delegate;
|
||||
using Enum=Bind.Structures.Enum;
|
||||
|
||||
namespace Bind.CL
|
||||
{
|
||||
class CLGenerator : Bind.GL2.Generator
|
||||
class CLGenerator : Generator
|
||||
{
|
||||
public CLGenerator(string name)
|
||||
{
|
||||
|
@ -41,7 +44,7 @@ namespace Bind.CL
|
|||
Settings.Compatibility |= Settings.Legacy.NoDebugHelpers;
|
||||
}
|
||||
|
||||
public override Bind.Structures.DelegateCollection ReadDelegates(System.IO.StreamReader specFile)
|
||||
public override DelegateCollection ReadDelegates(StreamReader specFile)
|
||||
{
|
||||
DelegateCollection delegates = new DelegateCollection();
|
||||
|
||||
|
@ -51,7 +54,7 @@ namespace Bind.CL
|
|||
|
||||
foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty))
|
||||
{
|
||||
Bind.Structures.Delegate d = new Bind.Structures.Delegate();
|
||||
Delegate d = new Delegate();
|
||||
d.Name = node.GetAttribute("name", String.Empty);
|
||||
//d.Extension = node.GetAttribute("extension");
|
||||
d.Version = node.GetAttribute("version", String.Empty);
|
||||
|
@ -96,18 +99,18 @@ namespace Bind.CL
|
|||
return base.ReadCSTypeMap(specFile);
|
||||
}
|
||||
|
||||
public override Bind.Structures.EnumCollection ReadEnums(StreamReader specFile)
|
||||
public override EnumCollection ReadEnums(StreamReader specFile)
|
||||
{
|
||||
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
|
||||
|
||||
EnumCollection enums = new EnumCollection();
|
||||
Bind.Structures.Enum all = new Bind.Structures.Enum(Settings.CompleteEnumName);
|
||||
Enum all = new Enum(Settings.CompleteEnumName);
|
||||
XPathDocument doc = new XPathDocument(specFile);
|
||||
XPathNavigator nav = doc.CreateNavigator().SelectSingleNode("/signatures");
|
||||
|
||||
foreach (XPathNavigator node in nav.SelectChildren("enum", String.Empty))
|
||||
{
|
||||
Bind.Structures.Enum e = new Bind.Structures.Enum(node.GetAttribute("name", String.Empty));
|
||||
Enum e = new Enum(node.GetAttribute("name", String.Empty));
|
||||
if (String.IsNullOrEmpty(e.Name))
|
||||
throw new InvalidOperationException(String.Format("Empty name for enum element {0}", node.ToString()));
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Bind
|
|||
static readonly Regex remove_mathml = new Regex(@"<(mml:math)[^>]*?>(?:.|\n)*?</\s*\1\s*>",
|
||||
RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
|
||||
|
||||
static readonly XslCompiledTransform xslt = new System.Xml.Xsl.XslCompiledTransform();
|
||||
static readonly XslCompiledTransform xslt = new XslCompiledTransform();
|
||||
static readonly XmlReaderSettings settings = new XmlReaderSettings();
|
||||
|
||||
public DocProcessor(string transform_file)
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.XPath;
|
||||
using Bind.GL2;
|
||||
using Bind.Structures;
|
||||
using Delegate=Bind.Structures.Delegate;
|
||||
using Enum=Bind.Structures.Enum;
|
||||
|
||||
namespace Bind.ES
|
||||
{
|
||||
class ESGenerator : Bind.GL2.Generator
|
||||
class ESGenerator : Generator
|
||||
{
|
||||
public ESGenerator(string name)
|
||||
{
|
||||
|
@ -34,7 +37,7 @@ namespace Bind.ES
|
|||
Settings.OutputPath = Path.Combine(Directory.GetParent(Settings.OutputPath).FullName, name);
|
||||
}
|
||||
|
||||
public override Bind.Structures.DelegateCollection ReadDelegates(System.IO.StreamReader specFile)
|
||||
public override DelegateCollection ReadDelegates(StreamReader specFile)
|
||||
{
|
||||
DelegateCollection delegates = new DelegateCollection();
|
||||
|
||||
|
@ -44,7 +47,7 @@ namespace Bind.ES
|
|||
|
||||
foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty))
|
||||
{
|
||||
Bind.Structures.Delegate d = new Bind.Structures.Delegate();
|
||||
Delegate d = new Delegate();
|
||||
d.Name = node.GetAttribute("name", String.Empty);
|
||||
//d.Extension = node.GetAttribute("extension");
|
||||
d.Version = node.GetAttribute("version", String.Empty);
|
||||
|
@ -89,10 +92,10 @@ namespace Bind.ES
|
|||
return base.ReadCSTypeMap(specFile);
|
||||
}
|
||||
|
||||
public override Bind.Structures.EnumCollection ReadEnums(StreamReader specFile)
|
||||
public override EnumCollection ReadEnums(StreamReader specFile)
|
||||
{
|
||||
EnumCollection enums = new EnumCollection();
|
||||
Bind.Structures.Enum all = new Bind.Structures.Enum(Settings.CompleteEnumName);
|
||||
Enum all = new Enum(Settings.CompleteEnumName);
|
||||
XPathDocument doc = new XPathDocument(specFile);
|
||||
XPathNavigator nav = doc.CreateNavigator().SelectSingleNode("/signatures");
|
||||
|
||||
|
@ -100,7 +103,7 @@ namespace Bind.ES
|
|||
|
||||
foreach (XPathNavigator node in nav.SelectChildren("enum", String.Empty))
|
||||
{
|
||||
Bind.Structures.Enum e = new Bind.Structures.Enum(node.GetAttribute("name", String.Empty));
|
||||
Enum e = new Enum(node.GetAttribute("name", String.Empty));
|
||||
if (String.IsNullOrEmpty(e.Name))
|
||||
throw new InvalidOperationException(String.Format("Empty name for enum element {0}", node.ToString()));
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@ using System.IO;
|
|||
using System.Text.RegularExpressions;
|
||||
using System.Xml.XPath;
|
||||
using Bind.Structures;
|
||||
using Delegate=Bind.Structures.Delegate;
|
||||
using Enum=Bind.Structures.Enum;
|
||||
using Type=Bind.Structures.Type;
|
||||
|
||||
namespace Bind.GL2
|
||||
{
|
||||
|
@ -67,16 +70,16 @@ namespace Bind.GL2
|
|||
// new Regex(@"(Coord1|Attrib(I?)1(u?)|Stream1|Uniform2(u?)|(Point|Convolution|Transform|Sprite|List|Combiner|Tex)Parameter|Fog(Coord)?.*|VertexWeight|(Fragment)?Light(Model)?|Material|ReplacementCodeu?b?|Tex(Gen|Env)|Indexu?|TextureParameter.v)",
|
||||
// RegexOptions.Compiled);
|
||||
|
||||
Bind.Structures.Type.Initialize(glTypemap, csTypemap);
|
||||
Bind.Structures.Enum.Initialize(enumSpec, enumSpecExt);
|
||||
Bind.Structures.Enum.GLEnums.Translate(new XPathDocument(Path.Combine(Settings.InputPath, functionOverridesFile)));
|
||||
Bind.Structures.Function.Initialize();
|
||||
Bind.Structures.Delegate.Initialize(glSpec, glSpecExt);
|
||||
Type.Initialize(glTypemap, csTypemap);
|
||||
Enum.Initialize(enumSpec, enumSpecExt);
|
||||
Enum.GLEnums.Translate(new XPathDocument(Path.Combine(Settings.InputPath, functionOverridesFile)));
|
||||
Function.Initialize();
|
||||
Delegate.Initialize(glSpec, glSpecExt);
|
||||
|
||||
this.WriteBindings(
|
||||
Bind.Structures.Delegate.Delegates,
|
||||
Bind.Structures.Function.Wrappers,
|
||||
Bind.Structures.Enum.GLEnums);
|
||||
Delegate.Delegates,
|
||||
Function.Wrappers,
|
||||
Enum.GLEnums);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -112,7 +115,7 @@ namespace Bind.GL2
|
|||
{
|
||||
// Get next OpenGL function
|
||||
|
||||
Bind.Structures.Delegate d = new Bind.Structures.Delegate();
|
||||
Delegate d = new Delegate();
|
||||
|
||||
// Get function name:
|
||||
d.Name = line.Split(Utilities.Separators, StringSplitOptions.RemoveEmptyEntries)[0];
|
||||
|
@ -184,7 +187,7 @@ namespace Bind.GL2
|
|||
EnumCollection enums = new EnumCollection();
|
||||
|
||||
// complete_enum contains all opengl enumerants.
|
||||
Bind.Structures.Enum complete_enum = new Bind.Structures.Enum();
|
||||
Enum complete_enum = new Enum();
|
||||
complete_enum.Name = Settings.CompleteEnumName;
|
||||
|
||||
do
|
||||
|
@ -203,7 +206,7 @@ namespace Bind.GL2
|
|||
continue;
|
||||
|
||||
// Declare a new enumerant
|
||||
Bind.Structures.Enum e = new Bind.Structures.Enum();
|
||||
Enum e = new Enum();
|
||||
e.Name = Char.IsDigit(words[0][0]) ? Settings.ConstantPrefix + words[0] : words[0];
|
||||
|
||||
// And fill in the values for this enumerant
|
||||
|
@ -393,7 +396,7 @@ namespace Bind.GL2
|
|||
|
||||
#region private string NextValidLine(StreamReader sr)
|
||||
|
||||
private string NextValidLine(System.IO.StreamReader sr)
|
||||
private string NextValidLine(StreamReader sr)
|
||||
{
|
||||
string line;
|
||||
|
||||
|
@ -471,7 +474,7 @@ namespace Bind.GL2
|
|||
sw.WriteLine("{");
|
||||
|
||||
sw.Indent();
|
||||
WriteEnums(sw, Bind.Structures.Enum.GLEnums);
|
||||
WriteEnums(sw, Enum.GLEnums);
|
||||
sw.Unindent();
|
||||
|
||||
if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None)
|
||||
|
@ -495,7 +498,7 @@ namespace Bind.GL2
|
|||
sw.WriteLine("using System.Runtime.InteropServices;");
|
||||
|
||||
sw.WriteLine("#pragma warning disable 0649");
|
||||
WriteDelegates(sw, Bind.Structures.Delegate.Delegates);
|
||||
WriteDelegates(sw, Delegate.Delegates);
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
|
@ -512,7 +515,7 @@ namespace Bind.GL2
|
|||
sw.WriteLine("using System;");
|
||||
sw.WriteLine("using System.Runtime.InteropServices;");
|
||||
|
||||
WriteImports(sw, Bind.Structures.Delegate.Delegates);
|
||||
WriteImports(sw, Delegate.Delegates);
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
|
@ -529,7 +532,7 @@ namespace Bind.GL2
|
|||
sw.WriteLine("using System;");
|
||||
sw.WriteLine("using System.Runtime.InteropServices;");
|
||||
|
||||
WriteWrappers(sw, Bind.Structures.Function.Wrappers, Bind.Structures.Type.CSTypes);
|
||||
WriteWrappers(sw, Function.Wrappers, Type.CSTypes);
|
||||
|
||||
sw.Unindent();
|
||||
sw.WriteLine("}");
|
||||
|
@ -571,7 +574,7 @@ namespace Bind.GL2
|
|||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
|
||||
foreach (Bind.Structures.Delegate d in delegates.Values)
|
||||
foreach (Delegate d in delegates.Values)
|
||||
{
|
||||
sw.WriteLine("[System.Security.SuppressUnmanagedCodeSecurity()]");
|
||||
sw.WriteLine("internal {0};", d.ToString());
|
||||
|
@ -609,7 +612,7 @@ namespace Bind.GL2
|
|||
sw.Indent();
|
||||
//sw.WriteLine("static {0}() {1} {2}", Settings.ImportsClass, "{", "}"); // Disable BeforeFieldInit
|
||||
sw.WriteLine();
|
||||
foreach (Bind.Structures.Delegate d in delegates.Values)
|
||||
foreach (Delegate d in delegates.Values)
|
||||
{
|
||||
sw.WriteLine("[System.Security.SuppressUnmanagedCodeSecurity()]");
|
||||
sw.WriteLine(
|
||||
|
@ -753,7 +756,7 @@ namespace Bind.GL2
|
|||
sw.Indent();
|
||||
}
|
||||
|
||||
foreach (Bind.Structures.Enum @enum in enums.Values)
|
||||
foreach (Enum @enum in enums.Values)
|
||||
{
|
||||
sw.Write(@enum);
|
||||
sw.WriteLine();
|
||||
|
@ -769,7 +772,7 @@ namespace Bind.GL2
|
|||
else
|
||||
{
|
||||
// Tao legacy mode: dump all enums as constants in GLClass.
|
||||
foreach (Bind.Structures.Constant c in enums[Settings.CompleteEnumName].ConstantCollection.Values)
|
||||
foreach (Constant c in enums[Settings.CompleteEnumName].ConstantCollection.Values)
|
||||
{
|
||||
// Print constants avoiding circular definitions
|
||||
if (c.Name != c.Value)
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
#endregion
|
||||
|
||||
using System.Diagnostics;
|
||||
using Bind.Structures;
|
||||
|
||||
namespace Bind.Glu
|
||||
{
|
||||
class Generator : Bind.GL2.Generator
|
||||
class Generator : GL2.Generator
|
||||
{
|
||||
string enumSpecAux = null;// = "GL2\\enum.spec";
|
||||
|
||||
|
@ -50,19 +51,19 @@ namespace Bind.Glu
|
|||
|
||||
public override void Process()
|
||||
{
|
||||
Bind.Structures.Type.Initialize(glTypemap, csTypemap);
|
||||
Bind.Structures.Enum.Initialize(enumSpec, enumSpecExt, enumSpecAux);
|
||||
Bind.Structures.Function.Initialize();
|
||||
Bind.Structures.Delegate.Initialize(glSpec, glSpecExt);
|
||||
Type.Initialize(glTypemap, csTypemap);
|
||||
Enum.Initialize(enumSpec, enumSpecExt, enumSpecAux);
|
||||
Function.Initialize();
|
||||
Delegate.Initialize(glSpec, glSpecExt);
|
||||
|
||||
// Process enums and delegates - create wrappers.
|
||||
Trace.WriteLine("Processing specs, please wait...");
|
||||
//this.Translate();
|
||||
|
||||
this.WriteBindings(
|
||||
Bind.Structures.Delegate.Delegates,
|
||||
Bind.Structures.Function.Wrappers,
|
||||
Bind.Structures.Enum.GLEnums);
|
||||
Delegate.Delegates,
|
||||
Function.Wrappers,
|
||||
Enum.GLEnums);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
#endregion
|
||||
|
||||
using System.Diagnostics;
|
||||
using Bind.Structures;
|
||||
|
||||
namespace Bind.Glx
|
||||
{
|
||||
class Generator : Bind.GL2.Generator
|
||||
class Generator : GL2.Generator
|
||||
{
|
||||
#region --- Constructors ---
|
||||
|
||||
|
@ -47,19 +48,19 @@ namespace Bind.Glx
|
|||
|
||||
public override void Process()
|
||||
{
|
||||
Bind.Structures.Type.Initialize(glTypemap, csTypemap);
|
||||
Bind.Structures.Enum.Initialize(enumSpec, enumSpecExt);
|
||||
Bind.Structures.Function.Initialize();
|
||||
Bind.Structures.Delegate.Initialize(glSpec, glSpecExt);
|
||||
Type.Initialize(glTypemap, csTypemap);
|
||||
Enum.Initialize(enumSpec, enumSpecExt);
|
||||
Function.Initialize();
|
||||
Delegate.Initialize(glSpec, glSpecExt);
|
||||
|
||||
// Process enums and delegates - create wrappers.
|
||||
Trace.WriteLine("Processing specs, please wait...");
|
||||
//this.Translate();
|
||||
|
||||
this.WriteBindings(
|
||||
Bind.Structures.Delegate.Delegates,
|
||||
Bind.Structures.Function.Wrappers,
|
||||
Bind.Structures.Enum.GLEnums);
|
||||
Delegate.Delegates,
|
||||
Function.Wrappers,
|
||||
Enum.GLEnums);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Bind.Structures;
|
||||
|
||||
namespace Bind
|
||||
{
|
||||
interface ISpecReader
|
||||
{
|
||||
Bind.Structures.DelegateCollection ReadDelegates(StreamReader specFile);
|
||||
Bind.Structures.EnumCollection ReadEnums(StreamReader specFile);
|
||||
DelegateCollection ReadDelegates(StreamReader specFile);
|
||||
EnumCollection ReadEnums(StreamReader specFile);
|
||||
Dictionary<string, string> ReadTypeMap(StreamReader specFile);
|
||||
Dictionary<string, string> ReadCSTypeMap(StreamReader specFile);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,11 @@
|
|||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Security;
|
||||
using Bind.CL;
|
||||
using Bind.ES;
|
||||
using Bind.GL2;
|
||||
|
||||
namespace Bind
|
||||
{
|
||||
|
@ -40,7 +44,7 @@ namespace Bind
|
|||
Trace.AutoFlush = true;
|
||||
|
||||
Console.WriteLine("OpenGL binding generator {0} for OpenTK.",
|
||||
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
||||
Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
||||
Console.WriteLine("For comments, bugs and suggestions visit http://opentk.sourceforge.net");
|
||||
//Console.WriteLine(" - the OpenTK team ;-)");
|
||||
Console.WriteLine();
|
||||
|
@ -122,40 +126,40 @@ namespace Bind
|
|||
|
||||
try
|
||||
{
|
||||
long ticks = System.DateTime.Now.Ticks;
|
||||
long ticks = DateTime.Now.Ticks;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case GeneratorMode.GL2:
|
||||
Generator = new Bind.GL2.Generator();
|
||||
Generator = new Generator();
|
||||
break;
|
||||
|
||||
case GeneratorMode.ES10:
|
||||
Generator = new Bind.ES.ESGenerator("ES10");
|
||||
Generator = new ESGenerator("ES10");
|
||||
break;
|
||||
|
||||
case GeneratorMode.ES11:
|
||||
Generator = new Bind.ES.ESGenerator("ES11");
|
||||
Generator = new ESGenerator("ES11");
|
||||
break;
|
||||
|
||||
case GeneratorMode.ES20:
|
||||
Generator = new Bind.ES.ESGenerator("ES20");
|
||||
Generator = new ESGenerator("ES20");
|
||||
break;
|
||||
|
||||
case GeneratorMode.CL10:
|
||||
Generator = new Bind.CL.CLGenerator("CL10");
|
||||
Generator = new CLGenerator("CL10");
|
||||
break;
|
||||
|
||||
case GeneratorMode.Wgl:
|
||||
Generator = new Bind.Wgl.Generator();
|
||||
Generator = new Wgl.Generator();
|
||||
break;
|
||||
|
||||
case GeneratorMode.Glu:
|
||||
Generator = new Bind.Glu.Generator();
|
||||
Generator = new Glu.Generator();
|
||||
break;
|
||||
|
||||
case GeneratorMode.Glx:
|
||||
Generator = new Bind.Glx.Generator();
|
||||
Generator = new Glx.Generator();
|
||||
break;
|
||||
|
||||
case GeneratorMode.GL3:
|
||||
|
@ -170,7 +174,7 @@ namespace Bind
|
|||
|
||||
Generator.Process();
|
||||
|
||||
ticks = System.DateTime.Now.Ticks - ticks;
|
||||
ticks = DateTime.Now.Ticks - ticks;
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0);
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace Bind
|
|||
{
|
||||
get
|
||||
{
|
||||
if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None)
|
||||
if ((Compatibility & Legacy.NestedEnums) != Legacy.None)
|
||||
return OutputNamespace + "." + OutputClass + "." + NestedEnumsClass;
|
||||
else
|
||||
return String.IsNullOrEmpty(EnumsNamespace) ? OutputNamespace : OutputNamespace + "." + EnumsNamespace;
|
||||
|
@ -68,7 +68,7 @@ namespace Bind
|
|||
{
|
||||
get
|
||||
{
|
||||
if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None)
|
||||
if ((Compatibility & Legacy.NestedEnums) != Legacy.None)
|
||||
return OutputNamespace + "." + GLClass + "." + NestedEnumsClass;
|
||||
else
|
||||
return OutputNamespace + "." + EnumsNamespace;
|
||||
|
@ -143,8 +143,8 @@ namespace Bind
|
|||
/// <summary>True if multiple tokens should be dropped (e.g. FooARB, FooEXT and FooSGI).</summary>
|
||||
public static bool DropMultipleTokens
|
||||
{
|
||||
get { return (Settings.Compatibility & Legacy.NoDropMultipleTokens) == Legacy.None; }
|
||||
set { if (value) Settings.Compatibility |= Legacy.NoDropMultipleTokens; else Settings.Compatibility &= ~Legacy.NoDropMultipleTokens; }
|
||||
get { return (Compatibility & Legacy.NoDropMultipleTokens) == Legacy.None; }
|
||||
set { if (value) Compatibility |= Legacy.NoDropMultipleTokens; else Compatibility &= ~Legacy.NoDropMultipleTokens; }
|
||||
}
|
||||
|
||||
public static string WindowsGDI = "OpenTK.Platform.Windows.API";
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace Bind.Structures
|
||||
|
@ -73,7 +75,7 @@ namespace Bind.Structures
|
|||
{
|
||||
value = value.Trim();
|
||||
|
||||
if (value.ToLower() == " 0xffffffffffffffff") System.Diagnostics.Debugger.Break();
|
||||
if (value.ToLower() == " 0xffffffffffffffff") Debugger.Break();
|
||||
// Check whether this value is a number and make sure the Unchecked property is set correctly.
|
||||
ulong number;
|
||||
if (value.ToLower().StartsWith("0x"))
|
||||
|
@ -84,7 +86,7 @@ namespace Bind.Structures
|
|||
if (value.ToLower().EndsWith("u"))
|
||||
value = value.Substring(0, value.Length - 1);
|
||||
}
|
||||
if (UInt64.TryParse(value.ToLower().Replace("0x", String.Empty), System.Globalization.NumberStyles.AllowHexSpecifier, null, out number))
|
||||
if (UInt64.TryParse(value.ToLower().Replace("0x", String.Empty), NumberStyles.AllowHexSpecifier, null, out number))
|
||||
{
|
||||
// The value is a number, check if it should be unchecked.
|
||||
if (number > 0x7FFFFFFF)
|
||||
|
|
|
@ -42,14 +42,14 @@ namespace Bind.Structures
|
|||
{
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, glSpec))
|
||||
{
|
||||
Delegates = Bind.MainClass.Generator.ReadDelegates(sr);
|
||||
Delegates = MainClass.Generator.ReadDelegates(sr);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(glSpecExt))
|
||||
{
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, glSpecExt))
|
||||
{
|
||||
foreach (Delegate d in Bind.MainClass.Generator.ReadDelegates(sr).Values)
|
||||
foreach (Delegate d in MainClass.Generator.ReadDelegates(sr).Values)
|
||||
{
|
||||
Utilities.Merge(Delegates, d);
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ namespace Bind.Structures
|
|||
// to avoid redefinitions.
|
||||
foreach (Function f in wrappers)
|
||||
{
|
||||
Bind.Structures.Function.Wrappers.AddChecked(f);
|
||||
Function.Wrappers.AddChecked(f);
|
||||
|
||||
if (!f.CLSCompliant)
|
||||
{
|
||||
|
@ -454,7 +454,7 @@ namespace Bind.Structures
|
|||
}
|
||||
|
||||
if (somethingChanged)
|
||||
Bind.Structures.Function.Wrappers.AddChecked(cls);
|
||||
Function.Wrappers.AddChecked(cls);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ namespace Bind.Structures
|
|||
Initialize(enumFile, enumextFile);
|
||||
|
||||
if (!String.IsNullOrEmpty(auxFile))
|
||||
using (System.IO.StreamReader sr = new System.IO.StreamReader(Path.Combine(Settings.InputPath, auxFile)))
|
||||
using (StreamReader sr = new StreamReader(Path.Combine(Settings.InputPath, auxFile)))
|
||||
{
|
||||
AuxEnums = Bind.MainClass.Generator.ReadEnums(sr);
|
||||
AuxEnums = MainClass.Generator.ReadEnums(sr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace Bind.Structures
|
|||
{
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, enumFile))
|
||||
{
|
||||
GLEnums = Bind.MainClass.Generator.ReadEnums(sr);
|
||||
GLEnums = MainClass.Generator.ReadEnums(sr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ namespace Bind.Structures
|
|||
{
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, enumextFile))
|
||||
{
|
||||
foreach (Bind.Structures.Enum e in Bind.MainClass.Generator.ReadEnums(sr).Values)
|
||||
foreach (Enum e in MainClass.Generator.ReadEnums(sr).Values)
|
||||
{
|
||||
//enums.Add(e.Name, e);
|
||||
Utilities.Merge(GLEnums, e);
|
||||
|
|
|
@ -686,27 +686,27 @@ namespace Bind.Structures
|
|||
/// <param name="f">The Function to add.</param>
|
||||
public void AddChecked(Function f)
|
||||
{
|
||||
if (Bind.Structures.Function.Wrappers.ContainsKey(f.Extension))
|
||||
if (Function.Wrappers.ContainsKey(f.Extension))
|
||||
{
|
||||
int index = Bind.Structures.Function.Wrappers[f.Extension].IndexOf(f);
|
||||
int index = Function.Wrappers[f.Extension].IndexOf(f);
|
||||
if (index == -1)
|
||||
{
|
||||
Bind.Structures.Function.Wrappers.Add(f);
|
||||
Function.Wrappers.Add(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Function existing = Bind.Structures.Function.Wrappers[f.Extension][index];
|
||||
Function existing = Function.Wrappers[f.Extension][index];
|
||||
if ((existing.Parameters.HasUnsignedParameters && !unsignedFunctions.IsMatch(existing.Name) && unsignedFunctions.IsMatch(f.Name)) ||
|
||||
(!existing.Parameters.HasUnsignedParameters && unsignedFunctions.IsMatch(existing.Name) && !unsignedFunctions.IsMatch(f.Name)))
|
||||
{
|
||||
Bind.Structures.Function.Wrappers[f.Extension].RemoveAt(index);
|
||||
Bind.Structures.Function.Wrappers[f.Extension].Add(f);
|
||||
Function.Wrappers[f.Extension].RemoveAt(index);
|
||||
Function.Wrappers[f.Extension].Add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Bind.Structures.Function.Wrappers.Add(f);
|
||||
Function.Wrappers.Add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,14 +28,14 @@ namespace Bind.Structures
|
|||
{
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, glTypes))
|
||||
{
|
||||
GLTypes = Bind.MainClass.Generator.ReadTypeMap(sr);
|
||||
GLTypes = MainClass.Generator.ReadTypeMap(sr);
|
||||
}
|
||||
}
|
||||
if (CSTypes == null)
|
||||
{
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, csTypes))
|
||||
{
|
||||
CSTypes = Bind.MainClass.Generator.ReadCSTypeMap(sr);
|
||||
CSTypes = MainClass.Generator.ReadCSTypeMap(sr);
|
||||
}
|
||||
}
|
||||
typesLoaded = true;
|
||||
|
@ -378,8 +378,8 @@ namespace Bind.Structures
|
|||
}
|
||||
|
||||
CurrentType =
|
||||
Bind.Structures.Type.CSTypes.ContainsKey(CurrentType) ?
|
||||
Bind.Structures.Type.CSTypes[CurrentType] : CurrentType;
|
||||
CSTypes.ContainsKey(CurrentType) ?
|
||||
CSTypes[CurrentType] : CurrentType;
|
||||
|
||||
// Make sure that enum parameters follow enum overrides, i.e.
|
||||
// if enum ErrorCodes is overriden to ErrorCode, then parameters
|
||||
|
|
|
@ -9,6 +9,8 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Bind.Structures;
|
||||
using Delegate=Bind.Structures.Delegate;
|
||||
using Enum=Bind.Structures.Enum;
|
||||
|
||||
namespace Bind
|
||||
{
|
||||
|
@ -125,7 +127,7 @@ namespace Bind
|
|||
/// </summary>
|
||||
/// <param name="enums"></param>
|
||||
/// <param name="t"></param>
|
||||
internal static void Merge(EnumCollection enums, Bind.Structures.Enum t)
|
||||
internal static void Merge(EnumCollection enums, Enum t)
|
||||
{
|
||||
if (!enums.ContainsKey(t.Name))
|
||||
{
|
||||
|
@ -133,8 +135,8 @@ namespace Bind
|
|||
}
|
||||
else
|
||||
{
|
||||
Bind.Structures.Enum e = enums[t.Name];
|
||||
foreach (Bind.Structures.Constant c in t.ConstantCollection.Values)
|
||||
Enum e = enums[t.Name];
|
||||
foreach (Constant c in t.ConstantCollection.Values)
|
||||
{
|
||||
Merge(e, c);
|
||||
}
|
||||
|
@ -153,7 +155,7 @@ namespace Bind
|
|||
/// <param name="s"></param>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
internal static Bind.Structures.Enum Merge(Bind.Structures.Enum s, Bind.Structures.Constant t)
|
||||
internal static Enum Merge(Enum s, Constant t)
|
||||
{
|
||||
if (!s.ConstantCollection.ContainsKey(t.Name))
|
||||
{
|
||||
|
@ -184,7 +186,7 @@ namespace Bind
|
|||
/// </summary>
|
||||
/// <param name="enums"></param>
|
||||
/// <param name="t"></param>
|
||||
internal static void Merge(DelegateCollection delegates, Bind.Structures.Delegate t)
|
||||
internal static void Merge(DelegateCollection delegates, Delegate t)
|
||||
{
|
||||
if (!delegates.ContainsKey(t.Name))
|
||||
{
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
#endregion
|
||||
|
||||
using System.Diagnostics;
|
||||
using Bind.Structures;
|
||||
|
||||
namespace Bind.Wgl
|
||||
{
|
||||
class Generator : Bind.GL2.Generator
|
||||
class Generator : GL2.Generator
|
||||
{
|
||||
#region --- Constructors ---
|
||||
|
||||
|
@ -46,19 +47,19 @@ namespace Bind.Wgl
|
|||
|
||||
public override void Process()
|
||||
{
|
||||
Bind.Structures.Type.Initialize(glTypemap, csTypemap);
|
||||
Bind.Structures.Enum.Initialize(enumSpec, enumSpecExt);
|
||||
Bind.Structures.Function.Initialize();
|
||||
Bind.Structures.Delegate.Initialize(glSpec, glSpecExt);
|
||||
Type.Initialize(glTypemap, csTypemap);
|
||||
Enum.Initialize(enumSpec, enumSpecExt);
|
||||
Function.Initialize();
|
||||
Delegate.Initialize(glSpec, glSpecExt);
|
||||
|
||||
// Process enums and delegates - create wrappers.
|
||||
Trace.WriteLine("Processing specs, please wait...");
|
||||
//this.Translate();
|
||||
|
||||
this.WriteBindings(
|
||||
Bind.Structures.Delegate.Delegates,
|
||||
Bind.Structures.Function.Wrappers,
|
||||
Bind.Structures.Enum.GLEnums);
|
||||
Delegate.Delegates,
|
||||
Function.Wrappers,
|
||||
Enum.GLEnums);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue