From 4e8c643c39c9832153f2f828c6a1c432d61544ab Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Tue, 12 Oct 2010 17:39:14 +0000 Subject: [PATCH] Added GL4Generator that utilizes xml files instead of spec files. Made GL4Generator the default. Added FuncProcessor that will contain all function transforms. --- Source/Bind/FuncProcessor.cs | 49 +++++++++++++++++++++++++++++++ Source/Bind/GL2/GL4Generator.cs | 34 +++++++++++++++++++++ Source/Bind/Generator.Bind.csproj | 7 +++++ Source/Bind/Main.cs | 2 +- 4 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 Source/Bind/FuncProcessor.cs create mode 100644 Source/Bind/GL2/GL4Generator.cs diff --git a/Source/Bind/FuncProcessor.cs b/Source/Bind/FuncProcessor.cs new file mode 100644 index 00000000..0affec3d --- /dev/null +++ b/Source/Bind/FuncProcessor.cs @@ -0,0 +1,49 @@ +#region License +// +// The Open Toolkit Library License +// +// Copyright (c) 2006 - 2010 the Open Toolkit library. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml.XPath; + +namespace Bind +{ + class FuncProcessor + { + const string Path = "/overrides/replace/function[@name='{0}']"; + XPathDocument Overrides { get; set; } + + public FuncProcessor(XPathDocument overrides) + { + if (overrides == null) + throw new ArgumentNullException("overrides"); + + Overrides = overrides; + } + } +} diff --git a/Source/Bind/GL2/GL4Generator.cs b/Source/Bind/GL2/GL4Generator.cs new file mode 100644 index 00000000..defd5d2e --- /dev/null +++ b/Source/Bind/GL2/GL4Generator.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Bind.GL2 +{ + class GL4Generator : ES.ESGenerator + { + public GL4Generator(string name, string dirname) + : base(name, dirname) + { + glTypemap = "GL2/gl.tm"; + csTypemap = "csharp.tm"; + + enumSpec = "GL2/signatures.xml"; + enumSpecExt = String.Empty; + glSpec = "GL2/signatures.xml"; + glSpecExt = String.Empty; + functionOverridesFile = "GL2/gloverrides.xml"; + + importsFile = "GLCore.cs"; + delegatesFile = "GLDelegates.cs"; + enumsFile = "GLEnums.cs"; + wrappersFile = "GL.cs"; + Settings.ImportsClass = "Core"; + Settings.DelegatesClass = "Delegates"; + + Settings.OutputClass = "GL"; + Settings.OutputNamespace = "OpenTK.Graphics.OpenGL"; + Settings.OutputPath = "../../../Source/OpenTK/Graphics/OpenGL"; + } + } +} diff --git a/Source/Bind/Generator.Bind.csproj b/Source/Bind/Generator.Bind.csproj index c81ed8f2..b15be63f 100644 --- a/Source/Bind/Generator.Bind.csproj +++ b/Source/Bind/Generator.Bind.csproj @@ -139,6 +139,7 @@ Properties\GlobalAssemblyInfo.cs + Code @@ -155,6 +156,7 @@ Code + Code @@ -944,6 +946,11 @@ + + + Designer + + diff --git a/Source/Bind/Main.cs b/Source/Bind/Main.cs index b43aa04e..6f987093 100644 --- a/Source/Bind/Main.cs +++ b/Source/Bind/Main.cs @@ -138,7 +138,7 @@ namespace Bind switch (mode) { case GeneratorMode.GL2: - Generator = new Generator(); + Generator = new GL4Generator("OpenGL", dirName); break; case GeneratorMode.ES10: