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 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK", "Source\OpenTK\OpenTK.csproj", "{A37A7E14-0000-0000-0000-000000000000}" 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 EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Compatibility", "Source\Compatibility\OpenTK.Compatibility.csproj", "{62C0DB35-0000-0000-0000-000000000000}" 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 EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Examples", "Source\Examples\OpenTK.Examples.csproj", "{868E37B3-0000-0000-0000-000000000000}" 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 EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.GLControl", "Source\GLControl\OpenTK.GLControl.csproj", "{A625BE88-0000-0000-0000-000000000000}" 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 EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Installer.Nsis", "Installers\Nsis\Build.Installer.Nsis.csproj", "{ADC34399-7613-44D2-90B2-19250F06FE7A}" 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 EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Docs", "Documentation\Build.Docs.csproj", "{650C6F3D-33B5-4216-9536-956AB42C0624}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Docs", "Documentation\Build.Docs.csproj", "{650C6F3D-33B5-4216-9536-956AB42C0624}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Bind", "Source\Bind\Generator.Bind.csproj", "{31D19132-0000-0000-0000-000000000000}" 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 EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Convert", "Source\Converter\Generator.Convert.csproj", "{5FDFF4B6-0000-0000-0000-000000000000}" 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 EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.UpdateVersion", "Source\Build.UpdateVersion\Build.UpdateVersion.csproj", "{75DC22B1-113F-4A66-96B9-2FF8208C10E8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.UpdateVersion", "Source\Build.UpdateVersion\Build.UpdateVersion.csproj", "{75DC22B1-113F-4A66-96B9-2FF8208C10E8}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Installer.Zip", "Installers\Zip\Build.Installer.Zip.csproj", "{ADC34399-7613-44D2-90B2-19250F06FE7B}" 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -132,7 +94,7 @@ Global
{ADC34399-7613-44D2-90B2-19250F06FE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU {ADC34399-7613-44D2-90B2-19250F06FE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Source\Examples\OpenTK.Examples.csproj StartupItem = Source\Converter\Generator.Convert.csproj
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE 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> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Commandlineparameters>-p:gl -v:44 -t:xml -o:gl4.xml gl.xml</Commandlineparameters>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<BaseAddress>285212672</BaseAddress> <BaseAddress>285212672</BaseAddress>
@ -161,6 +162,7 @@
</None> </None>
<None Include="Readme.txt"> <None Include="Readme.txt">
</None> </None>
<Compile Include="GLXmlParser.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>

View file

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