* 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.

svn path=/trunk/gtk-sharp/; revision=47412
This commit is contained in:
Dan Winship 2005-07-19 15:27:08 +00:00
parent fbcb47f5e6
commit 6b31c3542f
3 changed files with 12 additions and 18 deletions

View File

@ -1,3 +1,12 @@
2005-07-19 Dan Winship <danw@novell.com>
* 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 <danw@novell.com>
* parser/gapi2xml.pl: Change a few instances of

View File

@ -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 &&

View File

@ -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)