diff --git a/src/Generator.Converter/GLXmlParser.cs b/src/Generator.Converter/GLXmlParser.cs index 5cbfdd52..3798f969 100644 --- a/src/Generator.Converter/GLXmlParser.cs +++ b/src/Generator.Converter/GLXmlParser.cs @@ -47,8 +47,6 @@ namespace OpenTK.Convert static readonly Regex ExtensionRegex = new Regex( @"3DFX|(?!(?<=[1-4])D)[A-Z]{2,}$", RegexOptions.Compiled); - string EnumPrefix { get { return Prefix.ToUpper() + "_"; } } - string FuncPrefix { get { return Prefix; } } public GLXmlParser() { @@ -448,16 +446,6 @@ namespace OpenTK.Convert return ret; } - string TrimName(string name) - { - if (name.StartsWith(EnumPrefix)) - return name.Remove(0, EnumPrefix.Length); - else if (name.StartsWith(FuncPrefix)) - return name.Remove(0, FuncPrefix.Length); - else - return name; - } - static string Join(string left, string right) { if (!String.IsNullOrEmpty(left) && !String.IsNullOrEmpty(right)) diff --git a/src/Generator.Converter/Main.cs b/src/Generator.Converter/Main.cs index 6ccdb10d..9f3dec20 100644 --- a/src/Generator.Converter/Main.cs +++ b/src/Generator.Converter/Main.cs @@ -68,15 +68,12 @@ namespace OpenTK.Convert { bool showHelp = false; string prefix = "gl"; - string version = null; string path = null; OptionSet opts = new OptionSet { { "p=", "The {PREFIX} to remove from parsed functions and constants. " + "Defaults to \"" + prefix + "\".", v => prefix = v }, - { "v:", "The {VERSION} of the specification being parsed.", - v => version = v }, { "o:", "The {PATH} to the output file.", v => path = v }, { "?|h|help", "Show this message and exit.", @@ -86,7 +83,7 @@ namespace OpenTK.Convert var app = Path.GetFileName(Environment.GetCommandLineArgs()[0]); if (showHelp) { - Console.WriteLine("usage: {0} -p:PREFIX -v:VERSION SPECIFICATIONS", app); + Console.WriteLine("usage: {0} -p:PREFIX SPECIFICATIONS", app); Console.WriteLine(); Console.WriteLine("Options:"); opts.WriteOptionDescriptions(Console.Out); @@ -101,7 +98,7 @@ namespace OpenTK.Convert return; } - Parser parser = new GLXmlParser { Prefix = prefix, Version = version }; + Parser parser = new GLXmlParser { Prefix = prefix }; var sigs = headers.Select(h => parser.Parse(h)).ToList(); diff --git a/src/Generator.Converter/Parser.cs b/src/Generator.Converter/Parser.cs index 6f955cae..0bf5c899 100644 --- a/src/Generator.Converter/Parser.cs +++ b/src/Generator.Converter/Parser.cs @@ -33,9 +33,8 @@ namespace OpenTK.Convert { // Defines a prefix that should be removed from methods and tokens in the XML files, e.g. "gl", "cl", etc. public string Prefix { get; set; } - - // Defines the version of the spec files (optional). - public string Version { get; set; } + public string EnumPrefix { get { return Prefix.ToUpper() + "_"; } } + public string FuncPrefix { get { return Prefix; } } // Implements the parsing logic for a specific input file. public abstract IEnumerable Parse(string[] lines); @@ -82,5 +81,15 @@ namespace OpenTK.Convert return Parse(contents); } + + public string TrimName(string name) + { + if (name.StartsWith(EnumPrefix)) + return name.Remove(0, EnumPrefix.Length); + else if (name.StartsWith(FuncPrefix)) + return name.Remove(0, FuncPrefix.Length); + else + return name; + } } }