Read extension list from xml spec; new acronyms.
Instead of hardcoding a list of extensions, extensions are now read directly from the signatures.xml file. Acronyms for new texture formats are now listed.
This commit is contained in:
parent
5cc845713d
commit
5e06c14607
2 changed files with 34 additions and 5 deletions
|
@ -7,6 +7,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Bind.Structures;
|
||||
using Delegate=Bind.Structures.Delegate;
|
||||
|
@ -69,11 +70,34 @@ namespace Bind
|
|||
public static class Utilities
|
||||
{
|
||||
public static readonly char[] Separators = { ' ', '\n', ',', '(', ')', ';', '#' };
|
||||
public static readonly Regex Extensions = new Regex(
|
||||
"ARB|EXT|ATIX|ATI|AMDX|AMD|NV|NVX|SUNX|SUN|SGIS|SGIX|SGI|MESAX|MESA|3DFX|IBM|GREMEDY|HP|INTEL|PGI|INGR|APPLE|OML|I3D|ARM|ANGLE|OES|QCOM|VIV|IMG",
|
||||
RegexOptions.Compiled);
|
||||
public static readonly Regex Acronyms = new Regex(Extensions.ToString() + "|EGL|3TC|DXT|ES|GL|CL|RGBA|BGRA|RGB|BGR|ETC",
|
||||
RegexOptions.Compiled);
|
||||
public static Regex Extensions { get; private set; }
|
||||
public static Regex Acronyms { get; private set; }
|
||||
//public static readonly Regex Extensions = new Regex(
|
||||
// "ARB|EXT|ATIX|ATI|AMDX|AMD|NV|NVX|SUNX|SUN|SGIS|SGIX|SGI|MESAX|MESA|3DFX|IBM|GREMEDY|HP|INTEL|PGI|INGR|APPLE|OML|I3D|ARM|ANGLE|OES|QCOM|VIV|IMG",
|
||||
// RegexOptions.Compiled);
|
||||
//public static readonly Regex Acronyms = new Regex(Extensions.ToString() + "|EGL|3TC|DXT|ES|GL|CL|RGBA|BGRA|RGB|BGR|ETC",
|
||||
// RegexOptions.Compiled);
|
||||
|
||||
public static void InitExtensions(IEnumerable<string> extensions)
|
||||
{
|
||||
var acronyms = new string[]
|
||||
{
|
||||
"EGL", "ES", "GL", "CL",
|
||||
"RGBA", "BGRA", "RGB", "BGR",
|
||||
"SRGB", "YCBCR",
|
||||
"3TC", "DXT", "BPTC", "RGTC",
|
||||
"3DC", "ATC", "ETC",
|
||||
"ANGLE", "MESAX", "MESA",
|
||||
};
|
||||
|
||||
Extensions = new Regex(
|
||||
String.Join("|", extensions.ToArray()),
|
||||
RegexOptions.Compiled);
|
||||
|
||||
Acronyms = new Regex(
|
||||
String.Join("|", extensions.Concat(acronyms).ToArray()),
|
||||
RegexOptions.Compiled);
|
||||
}
|
||||
|
||||
#region internal StreamReader OpenSpecFile(string file)
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ namespace Bind
|
|||
private DelegateCollection ReadDelegates(XPathNavigator specs)
|
||||
{
|
||||
DelegateCollection delegates = new DelegateCollection();
|
||||
var extensions = new List<string>();
|
||||
|
||||
foreach (XPathNavigator node in specs.SelectChildren("function", String.Empty))
|
||||
{
|
||||
|
@ -78,6 +79,9 @@ namespace Bind
|
|||
d.Category = node.GetAttribute("category", String.Empty);
|
||||
d.DeprecatedVersion = node.GetAttribute("deprecated", String.Empty);
|
||||
d.Deprecated = !String.IsNullOrEmpty(d.DeprecatedVersion);
|
||||
d.Extension = node.GetAttribute("extension", String.Empty) ?? "Core";
|
||||
if (!extensions.Contains(d.Extension))
|
||||
extensions.Add(d.Extension);
|
||||
}
|
||||
|
||||
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
|
||||
|
@ -117,6 +121,7 @@ namespace Bind
|
|||
delegates.Add(d);
|
||||
}
|
||||
|
||||
Utilities.InitExtensions(extensions);
|
||||
return delegates;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue