Initial work on new gl xml spec support.

This commit is contained in:
thefiddler 2013-10-21 18:28:01 +02:00
parent 4dfcf39d26
commit 581919cb1c
4 changed files with 52 additions and 40 deletions

View file

@ -2,62 +2,24 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK", "Source\OpenTK\OpenTK.csproj", "{A37A7E14-0000-0000-0000-000000000000}"
ProjectSection(ProjectDependencies) = postProject
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Compatibility", "Source\Compatibility\OpenTK.Compatibility.csproj", "{62C0DB35-0000-0000-0000-000000000000}"
ProjectSection(ProjectDependencies) = postProject
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Examples", "Source\Examples\OpenTK.Examples.csproj", "{868E37B3-0000-0000-0000-000000000000}"
ProjectSection(ProjectDependencies) = postProject
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.GLControl", "Source\GLControl\OpenTK.GLControl.csproj", "{A625BE88-0000-0000-0000-000000000000}"
ProjectSection(ProjectDependencies) = postProject
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Installer.Nsis", "Installers\Nsis\Build.Installer.Nsis.csproj", "{ADC34399-7613-44D2-90B2-19250F06FE7A}"
ProjectSection(ProjectDependencies) = postProject
{A37A7E14-0000-0000-0000-000000000000} = {A37A7E14-0000-0000-0000-000000000000}
{31D19132-0000-0000-0000-000000000000} = {31D19132-0000-0000-0000-000000000000}
{62C0DB35-0000-0000-0000-000000000000} = {62C0DB35-0000-0000-0000-000000000000}
{650C6F3D-33B5-4216-9536-956AB42C0624} = {650C6F3D-33B5-4216-9536-956AB42C0624}
{A625BE88-0000-0000-0000-000000000000} = {A625BE88-0000-0000-0000-000000000000}
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
{868E37B3-0000-0000-0000-000000000000} = {868E37B3-0000-0000-0000-000000000000}
{5FDFF4B6-0000-0000-0000-000000000000} = {5FDFF4B6-0000-0000-0000-000000000000}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Docs", "Documentation\Build.Docs.csproj", "{650C6F3D-33B5-4216-9536-956AB42C0624}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Bind", "Source\Bind\Generator.Bind.csproj", "{31D19132-0000-0000-0000-000000000000}"
ProjectSection(ProjectDependencies) = postProject
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Convert", "Source\Converter\Generator.Convert.csproj", "{5FDFF4B6-0000-0000-0000-000000000000}"
ProjectSection(ProjectDependencies) = postProject
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.UpdateVersion", "Source\Build.UpdateVersion\Build.UpdateVersion.csproj", "{75DC22B1-113F-4A66-96B9-2FF8208C10E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Installer.Zip", "Installers\Zip\Build.Installer.Zip.csproj", "{ADC34399-7613-44D2-90B2-19250F06FE7B}"
ProjectSection(ProjectDependencies) = postProject
{A37A7E14-0000-0000-0000-000000000000} = {A37A7E14-0000-0000-0000-000000000000}
{31D19132-0000-0000-0000-000000000000} = {31D19132-0000-0000-0000-000000000000}
{62C0DB35-0000-0000-0000-000000000000} = {62C0DB35-0000-0000-0000-000000000000}
{650C6F3D-33B5-4216-9536-956AB42C0624} = {650C6F3D-33B5-4216-9536-956AB42C0624}
{A625BE88-0000-0000-0000-000000000000} = {A625BE88-0000-0000-0000-000000000000}
{75DC22B1-113F-4A66-96B9-2FF8208C10E8} = {75DC22B1-113F-4A66-96B9-2FF8208C10E8}
{868E37B3-0000-0000-0000-000000000000} = {868E37B3-0000-0000-0000-000000000000}
{5FDFF4B6-0000-0000-0000-000000000000} = {5FDFF4B6-0000-0000-0000-000000000000}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -132,7 +94,7 @@ Global
{ADC34399-7613-44D2-90B2-19250F06FE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Source\Examples\OpenTK.Examples.csproj
StartupItem = Source\Converter\Generator.Convert.csproj
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Xml.Linq;
namespace CHeaderToXML
{
class GLXmlParser : Parser
{
public GLXmlParser()
{
}
public override IEnumerable<XElement> Parse(string[] lines)
{
var input = XDocument.Parse(String.Join(" ", lines));
// Enumerations
var groups = input.Root
.Elements("groups")
.Elements("group");
foreach (var group in groups)
{
var e = new XElement("enum");
e.Name = group.Attribute("name").Value;
foreach (var token in group.Elements("enum"))
{
if (token.Attribute("value") != null)
{
e.Add(new XElement("token",
new XAttribute("name", token.Attribute("name")),
new XAttribute("value", token.Attribute("value"))));
}
else
{
e.Add(new XElement("use",
new XAttribute("token", token.Attribute("name"))));
}
}
yield return e;
}
}
}
}

View file

@ -56,6 +56,7 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DebugType>full</DebugType>
<Commandlineparameters>-p:gl -v:44 -t:xml -o:gl4.xml gl.xml</Commandlineparameters>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<BaseAddress>285212672</BaseAddress>
@ -161,6 +162,7 @@
</None>
<None Include="Readme.txt">
</None>
<Compile Include="GLXmlParser.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>

View file

@ -63,7 +63,8 @@ namespace CHeaderToXML
enum HeaderType
{
Header,
Spec
Spec,
Xml
}
class EntryPoint
@ -112,6 +113,7 @@ namespace CHeaderToXML
Parser parser =
type == HeaderType.Header ? new ESCLParser { Prefix = prefix, Version = version } :
type == HeaderType.Spec ? new GLParser { Prefix = prefix, Version = version } :
type == HeaderType.Xml ? new GLXmlParser { Prefix = prefix, Version = version } :
(Parser)null;
var sigs = headers.Select(h => parser.Parse(h)).ToList();