Merged fix for [#1098] from branches/1.0.

This commit is contained in:
the_fiddler 2009-11-17 09:33:14 +00:00
parent f12cbf1cd5
commit 35956701ae
5 changed files with 28105 additions and 28044 deletions

View file

@ -608,9 +608,9 @@ namespace Bind.Structures
{
int ret = Name.CompareTo(other.Name);
if (ret == 0)
ret = Parameters.ToString().CompareTo(other.Parameters.ToString());
ret = Parameters.CompareTo(other.Parameters);
if (ret == 0)
ret = ReturnType.ToString().CompareTo(other.ReturnType.ToString());
ret = ReturnType.CompareTo(other.ReturnType);
return ret;
}

View file

@ -15,7 +15,7 @@ namespace Bind.Structures
/// <summary>
/// Represents a single parameter of an opengl function.
/// </summary>
public class Parameter : Type
public class Parameter : Type, IComparable<Parameter>
{
string cache;
bool rebuild;
@ -350,12 +350,24 @@ namespace Bind.Structures
}
#endregion
#region IComparable<Parameter> Members
public int CompareTo(Parameter other)
{
int result = base.CompareTo(other);
if (result == 0)
result = Name.CompareTo(other.Name);
return result;
}
#endregion
}
/// <summary>
/// Holds the parameter list of an opengl function.
/// </summary>
public class ParameterCollection : List<Parameter>
public class ParameterCollection : List<Parameter>, IComparable<ParameterCollection>
{
string cache = String.Empty;
string callStringCache = String.Empty;
@ -642,5 +654,31 @@ namespace Bind.Structures
return true;
return false;
}
#region IComparable<ParameterCollection> Members
public int CompareTo(ParameterCollection other)
{
if (Count < other.Count)
{
return -1;
}
else if (Count > other.Count)
{
return 1;
}
else
{
for (int i = 0; i < Count; i++)
{
int result = this[i].CompareTo(other[i]);
if (result != 0)
return result;
}
return 0;
}
}
#endregion
}
}

View file

@ -11,7 +11,7 @@ using System.Xml.XPath;
namespace Bind.Structures
{
public class Type
public class Type : IComparable<Type>
{
internal static Dictionary<string, string> GLTypes;
internal static Dictionary<string, string> CSTypes;
@ -461,5 +461,28 @@ namespace Bind.Structures
}
#endregion
#region IComparable<Type> Members
public int CompareTo(Type other)
{
// Make sure that Pointer parameters are sorted last to avoid bug [#1098].
// The rest of the comparisons are not important, but they are there to
// guarantee a stable order between program executions.
int result = this.CurrentType.CompareTo(other.CurrentType);
if (result == 0)
result = Pointer.CompareTo(other.Pointer);
if (result == 0)
result = Reference.CompareTo(other.Reference);
if (result == 0)
result = Array.CompareTo(other.Array);
if (result == 0)
result = CLSCompliant.CompareTo(other.CLSCompliant);
if (result == 0)
result = ElementCount.CompareTo(other.ElementCount);
return result;
}
#endregion
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff