Generator now trims 'v' suffixes from all functions and marks resulting non cls-compliant overloads as such.
Bumped version number.
This commit is contained in:
parent
2f355a8bb5
commit
58faedc0fd
4 changed files with 78 additions and 7 deletions
|
@ -64,9 +64,9 @@ namespace Bind.GL2
|
|||
{
|
||||
// Matches functions that cannot have their trailing 'v' trimmed for CLS-Compliance reasons.
|
||||
// Built through trial and error :)
|
||||
Function.endingsAddV =
|
||||
new Regex(@"(Coord1|Attrib(I?)1(u?)|Stream1|Uniform2(u?)|(Point|Convolution|Transform|Sprite|List|Combiner|Tex)Parameter|Fog(Coord)?.*|VertexWeight|(Fragment)?Light(Model)?|Material|ReplacementCodeu?b?|Tex(Gen|Env)|Indexu?|TextureParameter.v)",
|
||||
RegexOptions.Compiled);
|
||||
//Function.endingsAddV =
|
||||
// new Regex(@"(Coord1|Attrib(I?)1(u?)|Stream1|Uniform2(u?)|(Point|Convolution|Transform|Sprite|List|Combiner|Tex)Parameter|Fog(Coord)?.*|VertexWeight|(Fragment)?Light(Model)?|Material|ReplacementCodeu?b?|Tex(Gen|Env)|Indexu?|TextureParameter.v)",
|
||||
// RegexOptions.Compiled);
|
||||
|
||||
Bind.Structures.Type.Initialize(glTypemap, csTypemap);
|
||||
Bind.Structures.Enum.Initialize(enumSpec, enumSpecExt);
|
||||
|
|
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.9.9.8")]
|
||||
[assembly: AssemblyFileVersion("0.9.9.8")]
|
||||
[assembly: AssemblyVersion("0.9.9.9")]
|
||||
[assembly: AssemblyFileVersion("0.9.9.9")]
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace Bind.Structures
|
|||
internal static DelegateCollection Delegates;
|
||||
|
||||
private static bool delegatesLoaded;
|
||||
bool? cls_compliance_overriden;
|
||||
|
||||
#region internal static void Initialize(string glSpec, string glSpecExt)
|
||||
|
||||
|
@ -44,6 +45,8 @@ namespace Bind.Structures
|
|||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine("Marking CLS compliance for wrappers.");
|
||||
MarkCLSCompliance(Function.Wrappers);
|
||||
delegatesLoaded = true;
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +83,9 @@ namespace Bind.Structures
|
|||
{
|
||||
get
|
||||
{
|
||||
if (cls_compliance_overriden != null)
|
||||
return (bool)cls_compliance_overriden;
|
||||
|
||||
if (Unsafe)
|
||||
return false;
|
||||
|
||||
|
@ -93,6 +99,10 @@ namespace Bind.Structures
|
|||
}
|
||||
return true;
|
||||
}
|
||||
set
|
||||
{
|
||||
cls_compliance_overriden = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -341,9 +351,52 @@ namespace Bind.Structures
|
|||
|
||||
#region --- Wrapper Creation ---
|
||||
|
||||
#region public IEnumerable<Function> CreateWrappers()
|
||||
#region MarkCLSCompliance
|
||||
|
||||
public void CreateWrappers()
|
||||
static void MarkCLSCompliance(FunctionCollection collection)
|
||||
{
|
||||
foreach (List<Function> wrappers in Function.Wrappers.Values)
|
||||
{
|
||||
for (int i = 0; i < wrappers.Count; i++)
|
||||
{
|
||||
for (int j = i + 1; j < wrappers.Count; j++)
|
||||
{
|
||||
if (wrappers[i].TrimmedName == wrappers[j].TrimmedName && wrappers[i].Parameters.Count == wrappers[j].Parameters.Count)
|
||||
{
|
||||
bool function_i_is_problematic = false;
|
||||
bool function_j_is_problematic = false;
|
||||
|
||||
int k;
|
||||
for (k = 0; k < wrappers[i].Parameters.Count; k++)
|
||||
{
|
||||
if (wrappers[i].Parameters[k].CurrentType != wrappers[j].Parameters[k].CurrentType)
|
||||
break;
|
||||
|
||||
if (wrappers[i].Parameters[k].DiffersOnlyOnReference(wrappers[j].Parameters[k]))
|
||||
if (wrappers[i].Parameters[k].Reference)
|
||||
function_i_is_problematic = true;
|
||||
else
|
||||
function_j_is_problematic = true;
|
||||
}
|
||||
|
||||
if (k == wrappers[i].Parameters.Count)
|
||||
{
|
||||
if (function_i_is_problematic)
|
||||
wrappers[i].CLSCompliant = false;
|
||||
if (function_j_is_problematic)
|
||||
wrappers[j].CLSCompliant = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateWrappers
|
||||
|
||||
void CreateWrappers()
|
||||
{
|
||||
List<Function> wrappers = new List<Function>();
|
||||
if (!NeedsWrapper)
|
||||
|
|
|
@ -186,6 +186,24 @@ namespace Bind.Structures
|
|||
|
||||
#endregion
|
||||
|
||||
#region public bool DiffersOnlyOnReference
|
||||
|
||||
// Returns true if this parameter differs only on reference compared to another parameter, i.e:
|
||||
// returns true for 'int' & 'ref int'
|
||||
// returns true for 'ref float' & 'float'
|
||||
// returns false 'int' & 'int*'
|
||||
// returns false 'int' & 'int[]'
|
||||
// returns false 'int' & 'float'
|
||||
public bool DiffersOnlyOnReference(Parameter other)
|
||||
{
|
||||
return
|
||||
CurrentType == other.CurrentType &&
|
||||
(Reference && !(other.Reference || other.Array > 0 || other.Pointer) ||
|
||||
other.Reference && !(Reference || Array > 0 || Pointer));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public override string ToString()
|
||||
|
||||
public override string ToString()
|
||||
|
|
Loading…
Reference in a new issue