2003-12-12 Mike Kestner <mkestner@ximian.com>

* generator/CallbackGen.cs : kill some redundant generation
	* generator/MethodBody.cs : pass array parameters as arrays of
	the corresponding native type.

svn path=/trunk/gtk-sharp/; revision=21083
This commit is contained in:
Mike Kestner 2003-12-12 22:56:28 +00:00
parent 406320a945
commit 027410def9
3 changed files with 16 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2003-12-12 Mike Kestner <mkestner@ximian.com>
* generator/CallbackGen.cs : kill some redundant generation
* generator/MethodBody.cs : pass array parameters as arrays of
the corresponding native type.
2003-12-12 Mike Kestner <mkestner@ximian.com>
* gnome/gnome-api.xml : regen'd

View File

@ -125,10 +125,6 @@ namespace GtkSharp.Generation {
} else
sw.WriteLine(" = " + table.FromNative (ctype, parm_name) + ";");
if ((parm_wrapper != null && ((parm_wrapper is OpaqueGen))) || table.IsManuallyWrapped (ctype)) {
sw.WriteLine("\t\t\tif (_arg" + idx + " == null)");
sw.WriteLine("\t\t\t\t_arg{0} = new {1}({2});", idx, cstype, parm_name);
}
if (need_sep)
call_str += ", ";
else

View File

@ -57,11 +57,12 @@ namespace GtkSharp.Generation {
result[i] = CallArrayLength (parameters[i + 1], p);
continue;
}
}
if (i > 0 && parameters [i - 1].IsString && p.IsLength) {
} else if (i > 0 && parameters [i - 1].IsString && p.IsLength) {
result[i] = CastFromInt (p.CSType) + parameters [i - 1].Name + ".Length";
continue;
} else if (p.IsArray && p.MarshalType != p.CSType) {
result[i] = (is_set && i == 0 ? "native_value" : "native_" + p.Name);
continue;
}
string call_parm = p.CallByName (is_set && i == 0 ? "value" : p.Name);
@ -120,6 +121,12 @@ namespace GtkSharp.Generation {
if (p.PassAs == "out" && gen is EnumGen)
sw.WriteLine(indent + "\t\t\tint " + name + "_as_int;");
if (p.IsArray && p.MarshalType != p.CSType) {
sw.WriteLine(indent + "\t\t\t{0}[] native_{1} = new {0} [{1}.Length];", p.MarshalType.TrimEnd('[', ']'), name);
sw.WriteLine(indent + "\t\t\tfor (int i = 0; i < {0}.Length; i++)", name);
sw.WriteLine(indent + "\t\t\t\tnative_{0} [i] = {1};", name, p.CallByName (name + "[i]"));
}
if (gen is CallbackGen) {
CallbackGen cbgen = gen as CallbackGen;
string wrapper = cbgen.GenWrapper(impl_ns, gen_info);