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>
|
||||
|
||||
* configure.in.in:
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace GtkSharp.Generation {
|
|||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
public class EnumGen : GenBase {
|
||||
|
||||
|
@ -39,13 +40,13 @@ namespace GtkSharp.Generation {
|
|||
|
||||
string result = "\t\t" + member.GetAttribute("name");
|
||||
if (member.HasAttribute ("value")) {
|
||||
string value = member.GetAttribute("value");
|
||||
if (value.EndsWith("U")) {
|
||||
enum_type = " : uint";
|
||||
value = value.TrimEnd('U');
|
||||
} else if (value.EndsWith("L")) {
|
||||
enum_type = " : long";
|
||||
value = value.TrimEnd('L');
|
||||
string value = member.GetAttribute ("value").Trim ();
|
||||
foreach (Match match in Regex.Matches (value, "[0-9]+([UL]{1,2})", RegexOptions.IgnoreCase)) {
|
||||
switch (match.Groups[1].Value.ToUpper ()) {
|
||||
case "U": enum_type = " : uint"; break;
|
||||
case "L": enum_type = " : long"; break;
|
||||
case "UL": enum_type = " : ulong"; break;
|
||||
}
|
||||
}
|
||||
result += " = " + value;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue