mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-09 20:35:41 +00:00
commit
a21549aa71
|
@ -47,8 +47,6 @@ namespace OpenTK.Convert
|
||||||
static readonly Regex ExtensionRegex = new Regex(
|
static readonly Regex ExtensionRegex = new Regex(
|
||||||
@"3DFX|(?!(?<=[1-4])D)[A-Z]{2,}$",
|
@"3DFX|(?!(?<=[1-4])D)[A-Z]{2,}$",
|
||||||
RegexOptions.Compiled);
|
RegexOptions.Compiled);
|
||||||
string EnumPrefix { get { return Prefix.ToUpper() + "_"; } }
|
|
||||||
string FuncPrefix { get { return Prefix; } }
|
|
||||||
|
|
||||||
public GLXmlParser()
|
public GLXmlParser()
|
||||||
{
|
{
|
||||||
|
@ -448,16 +446,6 @@ namespace OpenTK.Convert
|
||||||
return ret;
|
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)
|
static string Join(string left, string right)
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(left) && !String.IsNullOrEmpty(right))
|
if (!String.IsNullOrEmpty(left) && !String.IsNullOrEmpty(right))
|
||||||
|
|
|
@ -68,15 +68,12 @@ namespace OpenTK.Convert
|
||||||
{
|
{
|
||||||
bool showHelp = false;
|
bool showHelp = false;
|
||||||
string prefix = "gl";
|
string prefix = "gl";
|
||||||
string version = null;
|
|
||||||
string path = null;
|
string path = null;
|
||||||
OptionSet opts = new OptionSet
|
OptionSet opts = new OptionSet
|
||||||
{
|
{
|
||||||
{ "p=", "The {PREFIX} to remove from parsed functions and constants. " +
|
{ "p=", "The {PREFIX} to remove from parsed functions and constants. " +
|
||||||
"Defaults to \"" + prefix + "\".",
|
"Defaults to \"" + prefix + "\".",
|
||||||
v => prefix = v },
|
v => prefix = v },
|
||||||
{ "v:", "The {VERSION} of the specification being parsed.",
|
|
||||||
v => version = v },
|
|
||||||
{ "o:", "The {PATH} to the output file.",
|
{ "o:", "The {PATH} to the output file.",
|
||||||
v => path = v },
|
v => path = v },
|
||||||
{ "?|h|help", "Show this message and exit.",
|
{ "?|h|help", "Show this message and exit.",
|
||||||
|
@ -86,7 +83,7 @@ namespace OpenTK.Convert
|
||||||
var app = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
|
var app = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
|
||||||
if (showHelp)
|
if (showHelp)
|
||||||
{
|
{
|
||||||
Console.WriteLine("usage: {0} -p:PREFIX -v:VERSION SPECIFICATIONS", app);
|
Console.WriteLine("usage: {0} -p:PREFIX SPECIFICATIONS", app);
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine("Options:");
|
Console.WriteLine("Options:");
|
||||||
opts.WriteOptionDescriptions(Console.Out);
|
opts.WriteOptionDescriptions(Console.Out);
|
||||||
|
@ -101,7 +98,7 @@ namespace OpenTK.Convert
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Parser parser = new GLXmlParser { Prefix = prefix, Version = version };
|
Parser parser = new GLXmlParser { Prefix = prefix };
|
||||||
|
|
||||||
var sigs = headers.Select(h => parser.Parse(h)).ToList();
|
var sigs = headers.Select(h => parser.Parse(h)).ToList();
|
||||||
|
|
||||||
|
|
|
@ -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.
|
// 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; }
|
public string Prefix { get; set; }
|
||||||
|
public string EnumPrefix { get { return Prefix.ToUpper() + "_"; } }
|
||||||
// Defines the version of the spec files (optional).
|
public string FuncPrefix { get { return Prefix; } }
|
||||||
public string Version { get; set; }
|
|
||||||
|
|
||||||
// Implements the parsing logic for a specific input file.
|
// Implements the parsing logic for a specific input file.
|
||||||
public abstract IEnumerable<XElement> Parse(string[] lines);
|
public abstract IEnumerable<XElement> Parse(string[] lines);
|
||||||
|
@ -82,5 +81,15 @@ namespace OpenTK.Convert
|
||||||
|
|
||||||
return Parse(contents);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue