diff --git a/Source/Bind/Utilities.cs b/Source/Bind/Utilities.cs index 89463c44..77892662 100644 --- a/Source/Bind/Utilities.cs +++ b/Source/Bind/Utilities.cs @@ -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 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) diff --git a/Source/Bind/XmlSpecReader.cs b/Source/Bind/XmlSpecReader.cs index 13a71278..97adc7e4 100644 --- a/Source/Bind/XmlSpecReader.cs +++ b/Source/Bind/XmlSpecReader.cs @@ -59,6 +59,7 @@ namespace Bind private DelegateCollection ReadDelegates(XPathNavigator specs) { DelegateCollection delegates = new DelegateCollection(); + var extensions = new List(); 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; }