2009-05-28 Aaron Bockover <abockover@novell.com>
* generator/EnumGen.cs: Fix enum generator to properly parse integer values with type modifier suffixes (UL, L, U), and not accidentally munge named values that happen to end in one of these suffixes svn path=/trunk/gtk-sharp/; revision=134980
This commit is contained in:
parent
6ee95063ab
commit
9d215affce
2 changed files with 18 additions and 11 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2009-05-28 Aaron Bockover <abockover@novell.com>
|
||||||
|
|
||||||
|
* generator/EnumGen.cs: Fix enum generator to properly parse integer
|
||||||
|
values with type modifier suffixes (UL, L, U), and not accidentally
|
||||||
|
munge named values that happen to end in one of these suffixes
|
||||||
|
|
||||||
2009-05-18 Stephane Delcroix <sdelcroix@novell.com>
|
2009-05-18 Stephane Delcroix <sdelcroix@novell.com>
|
||||||
|
|
||||||
* configure.in.in:
|
* configure.in.in:
|
||||||
|
|
|
@ -25,6 +25,7 @@ namespace GtkSharp.Generation {
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
public class EnumGen : GenBase {
|
public class EnumGen : GenBase {
|
||||||
|
|
||||||
|
@ -39,13 +40,13 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
string result = "\t\t" + member.GetAttribute("name");
|
string result = "\t\t" + member.GetAttribute("name");
|
||||||
if (member.HasAttribute ("value")) {
|
if (member.HasAttribute ("value")) {
|
||||||
string value = member.GetAttribute("value");
|
string value = member.GetAttribute ("value").Trim ();
|
||||||
if (value.EndsWith("U")) {
|
foreach (Match match in Regex.Matches (value, "[0-9]+([UL]{1,2})", RegexOptions.IgnoreCase)) {
|
||||||
enum_type = " : uint";
|
switch (match.Groups[1].Value.ToUpper ()) {
|
||||||
value = value.TrimEnd('U');
|
case "U": enum_type = " : uint"; break;
|
||||||
} else if (value.EndsWith("L")) {
|
case "L": enum_type = " : long"; break;
|
||||||
enum_type = " : long";
|
case "UL": enum_type = " : ulong"; break;
|
||||||
value = value.TrimEnd('L');
|
}
|
||||||
}
|
}
|
||||||
result += " = " + value;
|
result += " = " + value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue