Added GL4Generator that utilizes xml files instead of spec files.

Made GL4Generator the default.
Added FuncProcessor that will contain all function transforms.
This commit is contained in:
the_fiddler 2010-10-12 17:39:14 +00:00
parent bdbd50dd08
commit 4e8c643c39
4 changed files with 91 additions and 1 deletions

View file

@ -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;
}
}
}

View file

@ -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";
}
}
}

View file

@ -139,6 +139,7 @@
<Compile Include="..\GlobalAssemblyInfo.cs"> <Compile Include="..\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link> <Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile> </Compile>
<Compile Include="FuncProcessor.cs" />
<Compile Include="GL2\GL4Generator.cs" /> <Compile Include="GL2\GL4Generator.cs" />
<Compile Include="IBind.cs"> <Compile Include="IBind.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
@ -155,6 +156,7 @@
<Compile Include="BindStreamWriter.cs"> <Compile Include="BindStreamWriter.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="EnumProcessor.cs" />
<Compile Include="Utilities.cs"> <Compile Include="Utilities.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
@ -944,6 +946,11 @@
<None Include="Specifications\License.txt"> <None Include="Specifications\License.txt">
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="Specifications\GL2\signatures.xml">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup> <PropertyGroup>
<PreBuildEvent> <PreBuildEvent>

View file

@ -138,7 +138,7 @@ namespace Bind
switch (mode) switch (mode)
{ {
case GeneratorMode.GL2: case GeneratorMode.GL2:
Generator = new Generator(); Generator = new GL4Generator("OpenGL", dirName);
break; break;
case GeneratorMode.ES10: case GeneratorMode.ES10: