diff --git a/ChangeLog b/ChangeLog index ee02893de..3530aacf3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-12-12 Mike Kestner + + * 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 * gnome/gnome-api.xml : regen'd diff --git a/generator/CallbackGen.cs b/generator/CallbackGen.cs index ab072d026..28e54f1fc 100644 --- a/generator/CallbackGen.cs +++ b/generator/CallbackGen.cs @@ -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 diff --git a/generator/MethodBody.cs b/generator/MethodBody.cs index 372e3ff55..880469188 100644 --- a/generator/MethodBody.cs +++ b/generator/MethodBody.cs @@ -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);