Synced with gl3 branch.
This commit is contained in:
parent
d5022b1b56
commit
c5ad62c12b
4 changed files with 15523 additions and 3136 deletions
|
@ -33,6 +33,7 @@ namespace Bind.GL2
|
|||
Bind.Structures.Delegate.Initialize();
|
||||
|
||||
// Process enums and delegates - create wrappers.
|
||||
Trace.WriteLine("Processing specs, please wait...");
|
||||
this.Translate();
|
||||
|
||||
// Write
|
||||
|
|
|
@ -867,41 +867,26 @@ namespace Bind.Structures
|
|||
// to avoid redefinitions.
|
||||
foreach (Function f in wrappers)
|
||||
{
|
||||
if (this.Name.Contains("Weightub"))
|
||||
Bind.Structures.Function.Wrappers.AddChecked(f);
|
||||
|
||||
if (this.Name.Contains("Bitmap"))
|
||||
{
|
||||
}
|
||||
|
||||
bool createCLS = !f.CLSCompliant;
|
||||
//createCLS &= String.IsNullOrEmpty(f.TrimmedName);
|
||||
string nameWithoutExtension = Utilities.StripGL2Extension(f.Name).TrimEnd('v');
|
||||
|
||||
/*string nameWithoutExtension = Utilities.StripGL2Extension(f.Name).TrimEnd('v');
|
||||
createCLS &=
|
||||
String.IsNullOrEmpty(f.TrimmedName) ||
|
||||
nameWithoutExtension.EndsWith("u") &&
|
||||
!nameWithoutExtension.EndsWith("b");
|
||||
nameWithoutExtension.Substring(nameWithoutExtension.Length - 3).Contains("u") &&
|
||||
!nameWithoutExtension.Substring(nameWithoutExtension.Length - 3).Contains("b");*/
|
||||
|
||||
if (createCLS)
|
||||
{
|
||||
Function clsFunction = f.GetCLSCompliantFunction(Bind.Structures.Type.CSTypes);
|
||||
// avoid redefinitions
|
||||
if (clsFunction.Parameters.ToString(true) != f.Parameters.ToString(true))
|
||||
{
|
||||
bool defined = false;
|
||||
if (Bind.Structures.Function.Wrappers.ContainsKey(f.Extension))
|
||||
{
|
||||
foreach (Function fun in Bind.Structures.Function.Wrappers[clsFunction.Extension])
|
||||
{
|
||||
if (clsFunction.Name == fun.Name &&
|
||||
clsFunction.Parameters.ToString() == fun.Parameters.ToString())
|
||||
defined = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined)
|
||||
Bind.Structures.Function.Wrappers.Add(clsFunction);
|
||||
//wrappers.Add(f);
|
||||
}
|
||||
Function clsFunction = f.GetCLSCompliantFunction();
|
||||
if (clsFunction != null)
|
||||
Bind.Structures.Function.Wrappers.AddChecked(clsFunction);
|
||||
}
|
||||
Bind.Structures.Function.Wrappers.Add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Bind.Structures
|
||||
{
|
||||
|
@ -104,7 +105,7 @@ namespace Bind.Structures
|
|||
|
||||
string trimmedName;
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the opengl function, trimming the excess 234dfubsiv endings..
|
||||
/// Gets or sets the name of the opengl function, trimming the excess 234dfubsiv endings.
|
||||
/// </summary>
|
||||
public string TrimmedName
|
||||
{
|
||||
|
@ -204,15 +205,21 @@ namespace Bind.Structures
|
|||
|
||||
#region public Function GetCLSCompliantFunction(Dictionary<string, string> CSTypes)
|
||||
|
||||
public Function GetCLSCompliantFunction(Dictionary<string, string> CSTypes)
|
||||
public Function GetCLSCompliantFunction()
|
||||
{
|
||||
Function f = new Function(this);
|
||||
|
||||
bool somethingChanged = false;
|
||||
for (int i = 0; i < f.Parameters.Count; i++)
|
||||
{
|
||||
f.Parameters[i].CurrentType = f.Parameters[i].GetCLSCompliantType();
|
||||
if (f.Parameters[i].CurrentType != this.Parameters[i].CurrentType)
|
||||
somethingChanged = true;
|
||||
}
|
||||
|
||||
if (!somethingChanged)
|
||||
return null;
|
||||
|
||||
f.Body.Clear();
|
||||
if (!f.NeedsWrapper)
|
||||
{
|
||||
|
@ -293,6 +300,37 @@ namespace Bind.Structures
|
|||
this.Add(f);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the function to the collection, if a function with the same
|
||||
/// name and parameters doesn't already exist.
|
||||
/// </summary>
|
||||
/// <param name="f">The Function to add.</param>
|
||||
public void AddChecked(Function f)
|
||||
{
|
||||
bool exists = false;
|
||||
if (Bind.Structures.Function.Wrappers.ContainsKey(f.Extension))
|
||||
{
|
||||
Function fun = Bind.Structures.Function.Wrappers[f.Extension]
|
||||
.Find(delegate(Function target)
|
||||
{
|
||||
return
|
||||
!String.IsNullOrEmpty(target.TrimmedName) &&
|
||||
target.TrimmedName == f.TrimmedName &&
|
||||
target.Parameters.ToString(true) == f.Parameters.ToString(true);
|
||||
});
|
||||
if (fun != null)
|
||||
{
|
||||
exists = true;
|
||||
/*Debug.WriteLine("Function redefinition:");
|
||||
Debug.WriteLine(fun.ToString());
|
||||
Debug.WriteLine(f.ToString());*/
|
||||
}
|
||||
}
|
||||
|
||||
if (!exists)
|
||||
Bind.Structures.Function.Wrappers.Add(f);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue