* GL2/Generator.cs: Improved handling for 'u' and 'ull' suffixes in

OpenGL constants.
This commit is contained in:
the_fiddler 2009-08-03 23:06:05 +00:00
parent 920d737f1f
commit 5a0357ee06

View file

@ -244,6 +244,14 @@ namespace Bind.GL2
c.Name = words[0]; c.Name = words[0];
uint number; uint number;
// Trim the unsigned or long specifiers used in C constants ('u' or 'ull').
if (words[2].ToLower().StartsWith("0x"))
{
if (words[2].ToLower().EndsWith("ull"))
words[2] = words[2].Substring(0, words[2].Length - 3);
if (words[2].ToLower().EndsWith("u"))
words[2] = words[2].Substring(0, words[2].Length - 1);
}
if (UInt32.TryParse(words[2].Replace("0x", String.Empty), System.Globalization.NumberStyles.AllowHexSpecifier, null, out number)) if (UInt32.TryParse(words[2].Replace("0x", String.Empty), System.Globalization.NumberStyles.AllowHexSpecifier, null, out number))
{ {
// The value is a number, check if it should be unchecked. // The value is a number, check if it should be unchecked.
@ -629,8 +637,6 @@ namespace Bind.GL2
//sw.WriteLine("static {0}() {1} {2}", Settings.ImportsClass, "{", "}"); // Disable BeforeFieldInit //sw.WriteLine("static {0}() {1} {2}", Settings.ImportsClass, "{", "}"); // Disable BeforeFieldInit
sw.WriteLine(); sw.WriteLine();
foreach (Bind.Structures.Delegate d in delegates.Values) foreach (Bind.Structures.Delegate d in delegates.Values)
{
if (String.IsNullOrEmpty(d.Extension) || d.Extension == "Core")
{ {
sw.WriteLine("[System.Security.SuppressUnmanagedCodeSecurity()]"); sw.WriteLine("[System.Security.SuppressUnmanagedCodeSecurity()]");
sw.WriteLine( sw.WriteLine(
@ -642,7 +648,6 @@ namespace Bind.GL2
); );
sw.WriteLine("internal extern static {0};", d.DeclarationString()); sw.WriteLine("internal extern static {0};", d.DeclarationString());
} }
}
sw.Unindent(); sw.Unindent();
sw.WriteLine("}"); sw.WriteLine("}");
sw.Unindent(); sw.Unindent();