mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-08 22:20:43 +00:00
Fixed IntPtr processing - real pointers (with object overloads) are now differentiated from plain IntPtr parameters (e.g. offsets). Fixed Tao bindings generation.
This commit is contained in:
parent
fdb89a25df
commit
6c86f654ed
|
@ -76,7 +76,7 @@ namespace Bind.Structures
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the CLSCompliant property. True if the delegate is not CLSCompliant.
|
/// Gets the CLSCompliant property. True if the delegate is not CLSCompliant.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CLSCompliant
|
public virtual bool CLSCompliant
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -341,7 +341,7 @@ namespace Bind.Structures
|
||||||
|
|
||||||
public void CreateWrappers()
|
public void CreateWrappers()
|
||||||
{
|
{
|
||||||
if (this.Name.Contains("GetBoolean"))
|
if (this.Name.Contains("ReadPixels"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,8 @@ namespace Bind.Structures
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
//if ((Settings.Compatibility & Settings.Legacy.NoPublicUnsafeFunctions) != Settings.Legacy.None)
|
if ((Settings.Compatibility & Settings.Legacy.NoPublicUnsafeFunctions) != Settings.Legacy.None)
|
||||||
// return false;
|
return false;
|
||||||
|
|
||||||
return base.Unsafe;
|
return base.Unsafe;
|
||||||
}
|
}
|
||||||
|
@ -526,18 +526,20 @@ namespace Bind.Structures
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (!f.Unsafe && (fixed_statements.Count > 0 || fixed_statements.Count > 0))
|
if (!f.Unsafe || fixed_statements.Count > 0)
|
||||||
if (fixed_statements.Count > 0)
|
|
||||||
{
|
{
|
||||||
f.Body.Add("unsafe");
|
f.Body.Add("unsafe");
|
||||||
f.Body.Add("{");
|
f.Body.Add("{");
|
||||||
f.Body.Indent();
|
f.Body.Indent();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fixed_statements.Count > 0)
|
||||||
|
{
|
||||||
f.Body.AddRange(fixed_statements);
|
f.Body.AddRange(fixed_statements);
|
||||||
f.Body.Add("{");
|
f.Body.Add("{");
|
||||||
f.Body.Indent();
|
f.Body.Indent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle_statements.Count > 0)
|
if (handle_statements.Count > 0)
|
||||||
{
|
{
|
||||||
f.Body.AddRange(handle_statements);
|
f.Body.AddRange(handle_statements);
|
||||||
|
@ -594,11 +596,14 @@ namespace Bind.Structures
|
||||||
f.Body.Add("}");
|
f.Body.Add("}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fixed_statements.Count > 0)
|
if (!f.Unsafe || fixed_statements.Count > 0)
|
||||||
{
|
{
|
||||||
f.Body.Unindent();
|
f.Body.Unindent();
|
||||||
f.Body.Add("}");
|
f.Body.Add("}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fixed_statements.Count > 0)
|
||||||
|
{
|
||||||
f.Body.Unindent();
|
f.Body.Unindent();
|
||||||
f.Body.Add("}");
|
f.Body.Add("}");
|
||||||
}
|
}
|
||||||
|
@ -705,6 +710,10 @@ namespace Bind.Structures
|
||||||
/// <param name="f">The Function to add.</param>
|
/// <param name="f">The Function to add.</param>
|
||||||
public void AddChecked(Function f)
|
public void AddChecked(Function f)
|
||||||
{
|
{
|
||||||
|
if (f.Name.Contains("Bitmap"))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
if (Bind.Structures.Function.Wrappers.ContainsKey(f.Extension))
|
if (Bind.Structures.Function.Wrappers.ContainsKey(f.Extension))
|
||||||
{
|
{
|
||||||
int index = Bind.Structures.Function.Wrappers[f.Extension].IndexOf(f);
|
int index = Bind.Structures.Function.Wrappers[f.Extension].IndexOf(f);
|
||||||
|
|
|
@ -264,7 +264,7 @@ namespace Bind.Structures
|
||||||
Pointer = false;
|
Pointer = false;
|
||||||
WrapperType = WrapperTypes.None;
|
WrapperType = WrapperTypes.None;
|
||||||
}
|
}
|
||||||
else if (CurrentType.ToLower().Contains("void")) /*|| CurrentType.Contains("IntPtr"))*/
|
else if (CurrentType.ToLower().Contains("void") || PreviousType.ToLower().Contains("void")) /*|| CurrentType.Contains("IntPtr"))*/
|
||||||
{
|
{
|
||||||
CurrentType = "IntPtr";
|
CurrentType = "IntPtr";
|
||||||
Pointer = false;
|
Pointer = false;
|
||||||
|
@ -407,7 +407,9 @@ namespace Bind.Structures
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the parameter declaration string.
|
/// Gets the parameter declaration string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="override_unsafe_setting">If true, unsafe types will be used even if the Settings.Compatibility.NoPublicUnsafeFunctions flag is set.</param>
|
/// <param name="override_unsafe_setting">
|
||||||
|
/// If true, unsafe types will be used even if the Settings.Compatibility.NoPublicUnsafeFunctions flag is set.
|
||||||
|
/// </param>
|
||||||
/// <returns>The parameter list of an opengl function in the form ( [parameters] )</returns>
|
/// <returns>The parameter list of an opengl function in the form ( [parameters] )</returns>
|
||||||
public string ToString(bool override_unsafe_setting)
|
public string ToString(bool override_unsafe_setting)
|
||||||
{
|
{
|
||||||
|
|
|
@ -156,7 +156,14 @@ namespace Bind.Structures
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
bool compliant = !(CurrentType.Contains("UInt") || CurrentType.Contains("SByte"));
|
bool compliant = !(CurrentType.Contains("UInt") || CurrentType.Contains("SByte"));
|
||||||
return compliant && (!Pointer || CurrentType.Contains("IntPtr"));
|
if (Pointer)
|
||||||
|
{
|
||||||
|
compliant &= CurrentType.Contains("IntPtr"); // IntPtr's are CLSCompliant.
|
||||||
|
// If the NoPublicUnsageFunctions is set, the pointer will be CLSCompliant.
|
||||||
|
compliant |= (Settings.Compatibility & Settings.Legacy.NoPublicUnsafeFunctions) != Settings.Legacy.None;
|
||||||
|
}
|
||||||
|
return compliant;
|
||||||
|
//return compliant && (!Pointer || CurrentType.Contains("IntPtr"));
|
||||||
//return compliant && !(Pointer && ((Settings.Compatibility & Settings.Legacy.NoPublicUnsafeFunctions) == Settings.Legacy.None));
|
//return compliant && !(Pointer && ((Settings.Compatibility & Settings.Legacy.NoPublicUnsafeFunctions) == Settings.Legacy.None));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -334,7 +341,7 @@ namespace Bind.Structures
|
||||||
Bind.Structures.Type.CSTypes.ContainsKey(CurrentType) ?
|
Bind.Structures.Type.CSTypes.ContainsKey(CurrentType) ?
|
||||||
Bind.Structures.Type.CSTypes[CurrentType] : CurrentType;
|
Bind.Structures.Type.CSTypes[CurrentType] : CurrentType;
|
||||||
|
|
||||||
if (CurrentType == "IntPtr")
|
if (CurrentType == "IntPtr" && String.IsNullOrEmpty(PreviousType))
|
||||||
Pointer = false;
|
Pointer = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue