diff --git a/ChangeLog b/ChangeLog index 0f24f3044..c3e6bc991 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-07-19 Dan Winship + + * generator/Parameters.cs: Remove the AllowComplexRefs flag. + (They're always allowed now.) + + * generator/Signal.cs (GenVirtualMethod): Fix up the use of CSType + vs MarshalType in the ref/out-handling code so that this can + marshal any type. + 2005-07-18 Dan Winship * parser/gapi2xml.pl: Change a few instances of diff --git a/generator/Parameters.cs b/generator/Parameters.cs index fd13d183a..6c6d4db99 100644 --- a/generator/Parameters.cs +++ b/generator/Parameters.cs @@ -310,12 +310,6 @@ namespace GtkSharp.Generation { set { is_static = value; } } - bool allow_complex_refs = true; - public bool AllowComplexRefs { - get { return allow_complex_refs; } - set { allow_complex_refs = value; } - } - bool cleared = false; void Clear () { @@ -350,14 +344,6 @@ namespace GtkSharp.Generation { return false; } - if (p.PassAs != "" && !allow_complex_refs) { - if (!(p.Generatable is BoxedGen) && - !(p.Generatable is SimpleGen)) { - Console.Write("Complex " + p.PassAs + " param " + p.Name + " "); - return false; - } - } - if (p.Generatable is CallbackGen) { has_cb = true; if (i == Count - 3 && diff --git a/generator/Signal.cs b/generator/Signal.cs index 7b0310043..820e64843 100644 --- a/generator/Signal.cs +++ b/generator/Signal.cs @@ -41,7 +41,6 @@ namespace GtkSharp.Generation { name = elem.GetAttribute ("name"); retval = new ReturnValue (elem ["return-type"]); parms = new Parameters (elem["parameters"]); - parms.AllowComplexRefs = false; this.container_type = container_type; } @@ -312,12 +311,12 @@ namespace GtkSharp.Generation { cleanup += "\t\t\t" + p.Name + " = (" + p.CSType + ") vals [" + i + "];\n"; } else { if (p.PassAs == "ref") - sw.WriteLine ("\t\t\tIntPtr " + p.Name + "_ptr = GLib.Marshaller.StructureToPtrAlloc ((" + p.CSType + ") " + p.Name + ");"); + sw.WriteLine ("\t\t\tIntPtr " + p.Name + "_ptr = GLib.Marshaller.StructureToPtrAlloc (" + p.Generatable.CallByName (p.Name) + ");"); else - sw.WriteLine ("\t\t\tIntPtr " + p.Name + "_ptr = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (" + p.CSType + ")));"); + sw.WriteLine ("\t\t\tIntPtr " + p.Name + "_ptr = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (" + p.MarshalType + ")));"); sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value (" + p.Name + "_ptr);"); - cleanup += "\t\t\t" + p.Name + " = (" + p.CSType + ") Marshal.PtrToStructure (" + p.Name + "_ptr, typeof (" + p.CSType + "));\n"; + cleanup += "\t\t\t" + p.Name + " = " + p.Generatable.FromNative ("(" + p.MarshalType + ") Marshal.PtrToStructure (" + p.Name + "_ptr, typeof (" + p.MarshalType + "))") + ";\n"; cleanup += "\t\t\tMarshal.FreeHGlobal (" + p.Name + "_ptr);\n"; } } else if (p.IsLength && parms [i - 1].IsString)