Synced with gl3 branch.

This commit is contained in:
the_fiddler 2007-08-01 22:28:54 +00:00
parent 00da3bf3f4
commit 2b871325ea
4 changed files with 15523 additions and 3136 deletions

View file

@ -33,6 +33,7 @@ namespace Bind.GL2
Bind.Structures.Delegate.Initialize(); Bind.Structures.Delegate.Initialize();
// Process enums and delegates - create wrappers. // Process enums and delegates - create wrappers.
Trace.WriteLine("Processing specs, please wait...");
this.Translate(); this.Translate();
// Write // Write

View file

@ -867,41 +867,26 @@ namespace Bind.Structures
// to avoid redefinitions. // to avoid redefinitions.
foreach (Function f in wrappers) 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; 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 &= createCLS &=
String.IsNullOrEmpty(f.TrimmedName) || String.IsNullOrEmpty(f.TrimmedName) ||
nameWithoutExtension.EndsWith("u") && nameWithoutExtension.Substring(nameWithoutExtension.Length - 3).Contains("u") &&
!nameWithoutExtension.EndsWith("b"); !nameWithoutExtension.Substring(nameWithoutExtension.Length - 3).Contains("b");*/
if (createCLS) if (createCLS)
{ {
Function clsFunction = f.GetCLSCompliantFunction(Bind.Structures.Type.CSTypes); Function clsFunction = f.GetCLSCompliantFunction();
// avoid redefinitions if (clsFunction != null)
if (clsFunction.Parameters.ToString(true) != f.Parameters.ToString(true)) Bind.Structures.Function.Wrappers.AddChecked(clsFunction);
{
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);
}
} }
Bind.Structures.Function.Wrappers.Add(f);
} }
} }
} }

View file

@ -8,6 +8,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Diagnostics;
namespace Bind.Structures namespace Bind.Structures
{ {
@ -104,7 +105,7 @@ namespace Bind.Structures
string trimmedName; string trimmedName;
/// <summary> /// <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> /// </summary>
public string TrimmedName public string TrimmedName
{ {
@ -204,15 +205,21 @@ namespace Bind.Structures
#region public Function GetCLSCompliantFunction(Dictionary<string, string> CSTypes) #region public Function GetCLSCompliantFunction(Dictionary<string, string> CSTypes)
public Function GetCLSCompliantFunction(Dictionary<string, string> CSTypes) public Function GetCLSCompliantFunction()
{ {
Function f = new Function(this); Function f = new Function(this);
bool somethingChanged = false;
for (int i = 0; i < f.Parameters.Count; i++) for (int i = 0; i < f.Parameters.Count; i++)
{ {
f.Parameters[i].CurrentType = f.Parameters[i].GetCLSCompliantType(); 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(); f.Body.Clear();
if (!f.NeedsWrapper) if (!f.NeedsWrapper)
{ {
@ -293,6 +300,37 @@ namespace Bind.Structures
this.Add(f); 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 #endregion

File diff suppressed because it is too large Load diff