private static void CreateCLSCompliantWrappers(List <Function> wrappers) { // If the function is not CLS-compliant (e.g. it contains unsigned parameters) // we need to create a CLS-Compliant overload. However, we should only do this // iff the opengl function does not contain unsigned/signed overloads itself // to avoid redefinitions. foreach (Function f in wrappers) { Function.Wrappers.AddChecked(f); if (!f.CLSCompliant) { Function cls = new Function(f); cls.Body.Clear(); cls.CreateBody(true); bool modified = false; for (int i = 0; i < f.Parameters.Count; i++) { cls.Parameters[i].CurrentType = cls.Parameters[i].GetCLSCompliantType(); if (cls.Parameters[i].CurrentType != f.Parameters[i].CurrentType) { modified = true; } } if (modified) { Function.Wrappers.AddChecked(cls); } } } }
void CreateWrappers() { List <Function> wrappers = new List <Function>(); if (!NeedsWrapper) { // No special wrapper needed - just call this delegate: Function f = new Function(this); f.CreateBody(false); wrappers.Add(f); } else { Function f = new Function(this); f.WrapReturnType(); f.WrapParameters(wrappers); } // If the function is not CLS-compliant (e.g. it contains unsigned parameters) // we need to create a CLS-Compliant overload. However, we should only do this // iff the opengl function does not contain unsigned/signed overloads itself // to avoid redefinitions. foreach (Function f in wrappers) { Function.Wrappers.AddChecked(f); if (!f.CLSCompliant) { Function cls = new Function(f); cls.Body.Clear(); cls.CreateBody(true); bool somethingChanged = false; for (int i = 0; i < f.Parameters.Count; i++) { cls.Parameters[i].CurrentType = cls.Parameters[i].GetCLSCompliantType(); if (cls.Parameters[i].CurrentType != f.Parameters[i].CurrentType) { somethingChanged = true; } } if (somethingChanged) { Function.Wrappers.AddChecked(cls); } } } }
public void CreateWrappers() { if (this.Name.Contains("ReadPixels")) { } List <Function> wrappers = new List <Function>(); if (!NeedsWrapper) { // No special wrapper needed - just call this delegate: Function f = new Function(this); if (f.ReturnType.CurrentType.ToLower().Contains("void")) { f.Body.Add(String.Format("{0};", f.CallString())); } else { f.Body.Add(String.Format("return {0};", f.CallString())); } wrappers.Add(f); } else { Function f = new Function(this); f.WrapReturnType(); if ((Settings.Compatibility & Settings.Legacy.GenerateAllPermutations) == Settings.Legacy.None) { f.WrapParameters(wrappers); } else { f.WrapParametersComplete(wrappers); } } // If the function is not CLS-compliant (e.g. it contains unsigned parameters) // we need to create a CLS-Compliant overload. However, we should only do this // iff the opengl function does not contain unsigned/signed overloads itself // to avoid redefinitions. foreach (Function f in wrappers) { Bind.Structures.Function.Wrappers.AddChecked(f); //Bind.Structures.Function.Wrappers.Add(f); if (!f.CLSCompliant) { Function cls = new Function(f); cls.Body.Clear(); if (!cls.NeedsWrapper) { cls.Body.Add((f.ReturnType.CurrentType != "void" ? "return " + this.CallString() : this.CallString()) + ";"); } else { cls.CreateBody(true); //cls.Body.AddRange(this.CreateBody(cls, true)); } bool somethingChanged = false; for (int i = 0; i < f.Parameters.Count; i++) { cls.Parameters[i].CurrentType = cls.Parameters[i].GetCLSCompliantType(); if (cls.Parameters[i].CurrentType != f.Parameters[i].CurrentType) { somethingChanged = true; } } if (somethingChanged) { Bind.Structures.Function.Wrappers.AddChecked(cls); } } } }