Permalink
Browse files

Fixed bug in acronym capitalization handling, when multiple acronyms …

…exist in the same enum.

git-svn-id: https://opentk.svn.sourceforge.net/svnroot/opentk/trunk@3103 ebc5dd9b-fb1d-0410-b6f8-d24c324e9604
  • Loading branch information...
1 parent a60e8e2 commit 4ce2dad5124de2d5b1235c4574a4b93738480b1f the_fiddler committed Dec 5, 2011
Showing with 3 additions and 2 deletions.
  1. +2 −2 Source/Bind/EnumProcessor.cs
  2. +1 −0 Source/Bind/Utilities.cs
@@ -101,9 +101,10 @@ public static string TranslateEnumName(string name)
// Split on IHV names, to ensure that characters appearing after these name are uppercase.
var match = Utilities.Acronyms.Match(name);
+ int offset = 0; // Everytime we insert a match, we must increase offset to compensate.
while (match.Success)
{
- int insert_pos = match.Index + match.Length;
+ int insert_pos = match.Index + match.Length + offset++;
translator.Insert(insert_pos, "_");
match = match.NextMatch();
}
@@ -117,7 +118,6 @@ public static string TranslateEnumName(string name)
// 4. if current char is lowercase, respect next char case.
bool is_after_underscore_or_number = true;
bool is_previous_uppercase = false;
- int pos = 0;
foreach (char c in name)
{
char char_to_add;
View
@@ -74,6 +74,7 @@ public static class Utilities
RegexOptions.Compiled);
public static readonly Regex Acronyms = new Regex(Extensions.ToString() + "|EGL|3TC|DXT|ES|RGBA|BGRA|RGB|BGR|ETC",
RegexOptions.Compiled);
+
#region internal StreamReader OpenSpecFile(string file)
internal static StreamReader OpenSpecFile(string folder, string file)

0 comments on commit 4ce2dad

Please sign in to comment.