diff --git a/Source/Bind/GL2/Generator.cs b/Source/Bind/GL2/Generator.cs index 50ce2472..81a90b49 100644 --- a/Source/Bind/GL2/Generator.cs +++ b/Source/Bind/GL2/Generator.cs @@ -31,7 +31,7 @@ namespace Bind.GL2 protected static string enumsFile = "GLEnums.cs"; protected static string wrappersFile = "GL.cs"; - protected static readonly string functionOverridesFile = "GL2/gloverrides.xml"; + protected static string functionOverridesFile = "GL2/gloverrides.xml"; protected static string loadAllFuncName = "LoadAll"; @@ -39,10 +39,6 @@ namespace Bind.GL2 protected static readonly char[] numbers = "0123456789".ToCharArray(); //protected static readonly Dictionary doc_replacements; - - DocProcessor doc_processor = new DocProcessor(Path.Combine(Settings.DocPath, Settings.DocFile)); - XPathDocument function_overrides = new XPathDocument(Path.Combine(Settings.InputPath, functionOverridesFile)); - #endregion #region --- Constructors --- @@ -103,9 +99,10 @@ namespace Bind.GL2 { Console.WriteLine("Reading function specs."); - //List delegates = new List(); DelegateCollection delegates = new DelegateCollection(); + XPathDocument function_overrides = new XPathDocument(Path.Combine(Settings.InputPath, functionOverridesFile)); + do { string line = NextValidLine(specFile); @@ -699,7 +696,10 @@ namespace Bind.GL2 path = Path.Combine(Settings.DocPath, "gl" + f.TrimmedName.TrimEnd(numbers) + ".xml"); if (File.Exists(path)) + { + DocProcessor doc_processor = new DocProcessor(Path.Combine(Settings.DocPath, Settings.DocFile)); sw.WriteLine(doc_processor.ProcessFile(path)); + } } catch (FileNotFoundException) { } diff --git a/Source/Bind/Main.cs b/Source/Bind/Main.cs index dac87a68..331dbb0a 100644 --- a/Source/Bind/Main.cs +++ b/Source/Bind/Main.cs @@ -21,6 +21,9 @@ namespace Bind Unknown, GL2, GL3, + GLES10, + GLES11, + GLES20, Wgl, Glx, Glu, @@ -70,8 +73,14 @@ namespace Bind break; case "mode": string arg = b[1].ToLower(); - if (arg.StartsWith("gl")) + if (arg == "gl" || arg == "gl2") mode = GeneratorMode.GL2; + else if (arg == "gles10") + mode = GeneratorMode.GLES10; + else if (arg == "gles11") + mode = GeneratorMode.GLES11; + else if (arg == "gles20") + mode = GeneratorMode.GLES20; else throw new NotImplementedException(); break; @@ -124,6 +133,18 @@ namespace Bind Generator = new Bind.GL2.Generator(); break; + case GeneratorMode.GLES10: + Generator = new Bind.GLES.GlesGenerator("GLES10"); + break; + + case GeneratorMode.GLES11: + Generator = new Bind.GLES.GlesGenerator("GLES11"); + break; + + case GeneratorMode.GLES20: + Generator = new Bind.GLES.GlesGenerator("GLES20"); + break; + case GeneratorMode.Wgl: Generator = new Bind.Wgl.Generator(); break; diff --git a/Source/Bind/Settings.cs b/Source/Bind/Settings.cs index 53ed0fb1..9bcfdd4b 100644 --- a/Source/Bind/Settings.cs +++ b/Source/Bind/Settings.cs @@ -15,10 +15,10 @@ namespace Bind // Disable BeforeFieldInit. static Settings() { } - public const string DefaultInputPath = "../../../Source/Bind/Specifications"; - public const string DefaultOutputPath = "../../../Source/OpenTK/Graphics/GL"; + public const string DefaultInputPath = "../../Source/Bind/Specifications"; + public const string DefaultOutputPath = "../../Source/OpenTK/Graphics/GL"; public const string DefaultOutputNamespace = "OpenTK.Graphics"; - public const string DefaultDocPath = "../../../Source/Bind/Specifications/Docs"; + public const string DefaultDocPath = "../../Source/Bind/Specifications/Docs"; public const string DefaultDocFile = "ToInlineDocs.xslt"; public const string DefaultLicenseFile = "License.txt"; diff --git a/Source/Bind/Specifications/GLES10/functions.xml b/Source/Bind/Specifications/GLES10/functions.xml index 5f7079ff..05603d57 100644 --- a/Source/Bind/Specifications/GLES10/functions.xml +++ b/Source/Bind/Specifications/GLES10/functions.xml @@ -1,76 +1,76 @@  - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -80,7 +80,7 @@ - + @@ -91,7 +91,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -111,74 +111,74 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -186,7 +186,7 @@ - + @@ -194,135 +194,135 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -330,7 +330,7 @@ - + @@ -338,29 +338,29 @@ - + - + - + - + - + - + - + - + @@ -369,85 +369,85 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -458,17 +458,17 @@ - + - + - + @@ -479,23 +479,23 @@ - + - + - + - + diff --git a/Source/Bind/Specifications/GLES11/functions.xml b/Source/Bind/Specifications/GLES11/functions.xml index 2500e475..26ff314c 100644 --- a/Source/Bind/Specifications/GLES11/functions.xml +++ b/Source/Bind/Specifications/GLES11/functions.xml @@ -55,7 +55,7 @@ - + @@ -456,7 +456,7 @@ - + diff --git a/Source/Bind/Specifications/GLES11/overrides.xml b/Source/Bind/Specifications/GLES11/overrides.xml new file mode 100644 index 00000000..140a9359 --- /dev/null +++ b/Source/Bind/Specifications/GLES11/overrides.xml @@ -0,0 +1,3 @@ + + + diff --git a/Source/Bind/Specifications/GLES20/functions.xml b/Source/Bind/Specifications/GLES20/functions.xml index e43eccfd..3c2fe076 100644 --- a/Source/Bind/Specifications/GLES20/functions.xml +++ b/Source/Bind/Specifications/GLES20/functions.xml @@ -1,117 +1,117 @@  - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -122,7 +122,7 @@ - + @@ -134,7 +134,7 @@ - + @@ -145,7 +145,7 @@ - + @@ -156,106 +156,106 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -263,35 +263,35 @@ - + - + - + - + - + - + - + @@ -301,7 +301,7 @@ - + @@ -311,198 +311,198 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -512,29 +512,29 @@ - + - + - + - + - + @@ -542,49 +542,49 @@ - + - + - + - + - + - + - + - + @@ -596,31 +596,31 @@ - + - + - + - + - + @@ -632,79 +632,79 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -712,13 +712,13 @@ - + - + @@ -726,75 +726,75 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -802,12 +802,12 @@ - + - + @@ -816,7 +816,7 @@ - + diff --git a/Source/Bind/Specifications/GLES20/overrides.xml b/Source/Bind/Specifications/GLES20/overrides.xml new file mode 100644 index 00000000..140a9359 --- /dev/null +++ b/Source/Bind/Specifications/GLES20/overrides.xml @@ -0,0 +1,3 @@ + + + diff --git a/Source/Bind/Specifications/csharp.tm b/Source/Bind/Specifications/csharp.tm index 72543fb6..0e7dad32 100644 --- a/Source/Bind/Specifications/csharp.tm +++ b/Source/Bind/Specifications/csharp.tm @@ -3,7 +3,6 @@ GLsizei, Int32 GLsizeiptr, IntPtr GLintptr, IntPtr # GLenum, Int32 -GLenum, All GLboolean, bool # Boolean # Int32 GLbitfield, UInt32 # GLvoid*, IntPtr diff --git a/Source/Bind/Structures/Delegate.cs b/Source/Bind/Structures/Delegate.cs index 637e4e3e..07711a9d 100644 --- a/Source/Bind/Structures/Delegate.cs +++ b/Source/Bind/Structures/Delegate.cs @@ -613,8 +613,7 @@ namespace Bind.Structures if (overrides == null) throw new ArgumentNullException("overrides"); - XPathNavigator navigator = overrides.CreateNavigator(); - string path = "/override/function[@name='{0}' and @extension='{1}']"; + string path = "/overrides/function[@name='{0}' and @extension='{1}']"; string name = TrimName(Name, false); XPathNavigator function_override = overrides.CreateNavigator().SelectSingleNode(String.Format(path, name, Extension)); TranslateReturnType(function_override); diff --git a/Source/Bind/Structures/Enum.cs b/Source/Bind/Structures/Enum.cs index 91b0dc3b..1cbef38e 100644 --- a/Source/Bind/Structures/Enum.cs +++ b/Source/Bind/Structures/Enum.cs @@ -117,6 +117,9 @@ namespace Bind.Structures public static string TranslateName(string name) { + if (String.IsNullOrEmpty(name)) + return name; + if (Utilities.Keywords.Contains(name)) return name; diff --git a/Source/Bind/Structures/Parameter.cs b/Source/Bind/Structures/Parameter.cs index dffc33ca..bf38c5b4 100644 --- a/Source/Bind/Structures/Parameter.cs +++ b/Source/Bind/Structures/Parameter.cs @@ -64,6 +64,11 @@ namespace Bind.Structures { if (_name != value) { + if (value.StartsWith("*")) + { + Pointer = true; + value = value.TrimStart("*".ToCharArray()); + } _name = value; rebuild = true; } @@ -333,6 +338,9 @@ namespace Bind.Structures if (Reference) WrapperType |= WrapperTypes.ReferenceParameter; + if (Name == "params") + Name = "@params"; + // This causes problems with bool arrays //if (CurrentType.ToLower().Contains("bool")) // WrapperType = WrapperTypes.BoolParameter; diff --git a/Source/Bind/Structures/Type.cs b/Source/Bind/Structures/Type.cs index 012bb2aa..95991560 100644 --- a/Source/Bind/Structures/Type.cs +++ b/Source/Bind/Structures/Type.cs @@ -334,14 +334,14 @@ namespace Bind.Structures else CurrentType = s; } - - CurrentType = - Bind.Structures.Type.CSTypes.ContainsKey(CurrentType) ? - Bind.Structures.Type.CSTypes[CurrentType] : CurrentType; - - if (CurrentType == "IntPtr" && String.IsNullOrEmpty(PreviousType)) - Pointer = false; } + + CurrentType = + Bind.Structures.Type.CSTypes.ContainsKey(CurrentType) ? + Bind.Structures.Type.CSTypes[CurrentType] : CurrentType; + + if (CurrentType == "IntPtr" && String.IsNullOrEmpty(PreviousType)) + Pointer = false; } #endregion