mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
2008-03-21 Mike Kestner <mkestner@novell.com>
* bootstrap-2.12: bump svn version * generator/CallbackGen.cs: add dnotify support to invoker. Store and respond with incoming UserData params. Start using __prefixed private vars to avoid collisions with parameters, like the 'result' params in gio. * generator/ManagedCallString.cs: use new data/dnotify invoker ctors. * generator/MethodBody.cs: * generator/Parameters.cs: don't link "out" length params to preceding strings. * generator/VMSignature.cs: don't require UserData to be last param, since it can have things like error after it. svn path=/trunk/gtk-sharp/; revision=98782
This commit is contained in:
parent
c030d70107
commit
de56504f8b
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2008-03-21 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
|
* bootstrap-2.12: bump svn version
|
||||||
|
* generator/CallbackGen.cs: add dnotify support to invoker.
|
||||||
|
Store and respond with incoming UserData params. Start using
|
||||||
|
__prefixed private vars to avoid collisions with parameters,
|
||||||
|
like the 'result' params in gio.
|
||||||
|
* generator/ManagedCallString.cs: use new data/dnotify invoker
|
||||||
|
ctors.
|
||||||
|
* generator/MethodBody.cs:
|
||||||
|
* generator/Parameters.cs: don't link "out" length params to
|
||||||
|
preceding strings.
|
||||||
|
* generator/VMSignature.cs: don't require UserData to be last
|
||||||
|
param, since it can have things like error after it.
|
||||||
|
|
||||||
2008-03-21 Mike Kestner <mkestner@novell.com>
|
2008-03-21 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
* gtk/Gtk.metadata: s/GtkDestroyNotify/GDestroyNotify in vms too.
|
* gtk/Gtk.metadata: s/GtkDestroyNotify/GDestroyNotify in vms too.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Run this to set configure.in up for an API version.
|
# Run this to set configure.in up for an API version.
|
||||||
|
|
||||||
GTK_SHARP_VERSION=2.12.0
|
GTK_SHARP_VERSION=2.12.1
|
||||||
ASSEMBLY_VERSION=2.12.0.0
|
ASSEMBLY_VERSION=2.12.0.0
|
||||||
POLICY_VERSIONS="2.4 2.6 2.8 2.10"
|
POLICY_VERSIONS="2.4 2.6 2.8 2.10"
|
||||||
GTK_REQUIRED_VERSION=2.12.0
|
GTK_REQUIRED_VERSION=2.12.0
|
||||||
|
@ -122,7 +122,7 @@ namespace GtkSharp.Generation {
|
|||||||
p.CallName = p.Name;
|
p.CallName = p.Name;
|
||||||
result [i] = p.CallString;
|
result [i] = p.CallString;
|
||||||
if (p.IsUserData)
|
if (p.IsUserData)
|
||||||
result [i] = "IntPtr.Zero";
|
result [i] = "__data";
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.Join (", ", result);
|
return String.Join (", ", result);
|
||||||
@ -139,10 +139,25 @@ namespace GtkSharp.Generation {
|
|||||||
sw.WriteLine ("\tinternal class " + Name + "Invoker {");
|
sw.WriteLine ("\tinternal class " + Name + "Invoker {");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
sw.WriteLine ("\t\t" + Name + "Native native_cb;");
|
sw.WriteLine ("\t\t" + Name + "Native native_cb;");
|
||||||
|
sw.WriteLine ("\t\tIntPtr __data;");
|
||||||
|
sw.WriteLine ("\t\tGLib.DestroyNotify __notify;");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
sw.WriteLine ("\t\tinternal " + Name + "Invoker (" + Name + "Native native_cb)");
|
sw.WriteLine ("\t\t~" + Name + "Invoker ()");
|
||||||
|
sw.WriteLine ("\t\t{");
|
||||||
|
sw.WriteLine ("\t\t\tif (__notify == null)");
|
||||||
|
sw.WriteLine ("\t\t\t\treturn;");
|
||||||
|
sw.WriteLine ("\t\t\t__notify (__data);");
|
||||||
|
sw.WriteLine ("\t\t}");
|
||||||
|
sw.WriteLine ();
|
||||||
|
sw.WriteLine ("\t\tinternal " + Name + "Invoker (" + Name + "Native native_cb) : this (native_cb, IntPtr.Zero, null) {}");
|
||||||
|
sw.WriteLine ();
|
||||||
|
sw.WriteLine ("\t\tinternal " + Name + "Invoker (" + Name + "Native native_cb, IntPtr data) : this (native_cb, data, null) {}");
|
||||||
|
sw.WriteLine ();
|
||||||
|
sw.WriteLine ("\t\tinternal " + Name + "Invoker (" + Name + "Native native_cb, IntPtr data, GLib.DestroyNotify notify)");
|
||||||
sw.WriteLine ("\t\t{");
|
sw.WriteLine ("\t\t{");
|
||||||
sw.WriteLine ("\t\t\tthis.native_cb = native_cb;");
|
sw.WriteLine ("\t\t\tthis.native_cb = native_cb;");
|
||||||
|
sw.WriteLine ("\t\t\t__data = data;");
|
||||||
|
sw.WriteLine ("\t\t\t__notify = notify;");
|
||||||
sw.WriteLine ("\t\t}");
|
sw.WriteLine ("\t\t}");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
sw.WriteLine ("\t\tinternal " + QualifiedName + " Handler {");
|
sw.WriteLine ("\t\tinternal " + QualifiedName + " Handler {");
|
||||||
|
@ -30,6 +30,8 @@ namespace GtkSharp.Generation {
|
|||||||
ArrayList parms = new ArrayList ();
|
ArrayList parms = new ArrayList ();
|
||||||
ArrayList special = new ArrayList ();
|
ArrayList special = new ArrayList ();
|
||||||
string error_param = null;
|
string error_param = null;
|
||||||
|
string user_data_param = null;
|
||||||
|
string destroy_param = null;
|
||||||
|
|
||||||
public ManagedCallString (Parameters parms)
|
public ManagedCallString (Parameters parms)
|
||||||
{
|
{
|
||||||
@ -37,10 +39,14 @@ namespace GtkSharp.Generation {
|
|||||||
Parameter p = parms [i];
|
Parameter p = parms [i];
|
||||||
if (p.IsLength && parms [i-1].IsString)
|
if (p.IsLength && parms [i-1].IsString)
|
||||||
continue;
|
continue;
|
||||||
else if (p.Scope == "notified")
|
else if (p.Scope == "notified") {
|
||||||
|
user_data_param = parms[i+1].Name;
|
||||||
|
destroy_param = parms[i+2].Name;
|
||||||
i += 2;
|
i += 2;
|
||||||
|
} else if (p.IsUserData && parms [i-1].Generatable is CallbackGen) {
|
||||||
else if (p is ErrorParameter) {
|
user_data_param = p.Name;
|
||||||
|
continue;
|
||||||
|
} else if (p is ErrorParameter) {
|
||||||
error_param = p.Name;
|
error_param = p.Name;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -70,7 +76,12 @@ namespace GtkSharp.Generation {
|
|||||||
IGeneratable igen = p.Generatable;
|
IGeneratable igen = p.Generatable;
|
||||||
|
|
||||||
if (igen is CallbackGen) {
|
if (igen is CallbackGen) {
|
||||||
ret += indent + String.Format ("{0} {1}_invoker = new {0} ({1});\n", (igen as CallbackGen).InvokerName, p.Name);
|
if (user_data_param == null)
|
||||||
|
ret += indent + String.Format ("{0} {1}_invoker = new {0} ({1});\n", (igen as CallbackGen).InvokerName, p.Name);
|
||||||
|
else if (destroy_param == null)
|
||||||
|
ret += indent + String.Format ("{0} {1}_invoker = new {0} ({1}, {2});\n", (igen as CallbackGen).InvokerName, p.Name, user_data_param);
|
||||||
|
else
|
||||||
|
ret += indent + String.Format ("{0} {1}_invoker = new {0} ({1}, {2}, {3});\n", (igen as CallbackGen).InvokerName, p.Name, user_data_param, destroy_param);
|
||||||
} else {
|
} else {
|
||||||
ret += indent + igen.QualifiedName + " my" + p.Name;
|
ret += indent + igen.QualifiedName + " my" + p.Name;
|
||||||
if (p.PassAs == "ref")
|
if (p.PassAs == "ref")
|
||||||
|
@ -52,7 +52,7 @@ namespace GtkSharp.Generation {
|
|||||||
|
|
||||||
bool is_prop = is_set && i == 0;
|
bool is_prop = is_set && i == 0;
|
||||||
|
|
||||||
if (i > 0 && parameters [i - 1].IsString && p.IsLength) {
|
if (i > 0 && parameters [i - 1].IsString && p.IsLength && p.PassAs == String.Empty) {
|
||||||
string string_name = (i == 1 && is_set) ? "value" : parameters [i - 1].Name;
|
string string_name = (i == 1 && is_set) ? "value" : parameters [i - 1].Name;
|
||||||
result[i] = igen.CallByName (CastFromInt (p.CSType) + "System.Text.Encoding.UTF8.GetByteCount (" + string_name + ")");
|
result[i] = igen.CallByName (CastFromInt (p.CSType) + "System.Text.Encoding.UTF8.GetByteCount (" + string_name + ")");
|
||||||
continue;
|
continue;
|
||||||
|
@ -541,7 +541,7 @@ namespace GtkSharp.Generation {
|
|||||||
{
|
{
|
||||||
int idx = param_list.IndexOf (p);
|
int idx = param_list.IndexOf (p);
|
||||||
|
|
||||||
if (idx > 0 && p.IsLength && this [idx - 1].IsString)
|
if (idx > 0 && p.IsLength && p.PassAs == String.Empty && this [idx - 1].IsString)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (p.IsCount && ((idx > 0 && this [idx - 1].IsArray) ||
|
if (p.IsCount && ((idx > 0 && this [idx - 1].IsArray) ||
|
||||||
|
@ -42,7 +42,7 @@ namespace GtkSharp.Generation {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
has_cb = has_cb || p.Generatable is CallbackGen;
|
has_cb = has_cb || p.Generatable is CallbackGen;
|
||||||
if (p.IsUserData && has_cb && (i == parms.Count - 1))
|
if (p.IsUserData && has_cb)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (p.CType == "GError**")
|
if (p.CType == "GError**")
|
||||||
|
@ -38,6 +38,7 @@ namespace GtkSharp.Generation {
|
|||||||
this.elem = elem;
|
this.elem = elem;
|
||||||
retval = new ReturnValue (elem ["return-type"]);
|
retval = new ReturnValue (elem ["return-type"]);
|
||||||
parms = new Parameters (elem["parameters"]);
|
parms = new Parameters (elem["parameters"]);
|
||||||
|
parms.HideData = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsGetter {
|
public bool IsGetter {
|
||||||
@ -96,11 +97,11 @@ namespace GtkSharp.Generation {
|
|||||||
} else
|
} else
|
||||||
sw.WriteLine ("\t\t\t\t" + call_string + ";");
|
sw.WriteLine ("\t\t\t\t" + call_string + ";");
|
||||||
} else
|
} else
|
||||||
sw.WriteLine ("\t\t\t\t" + retval.ToNativeType + " result = " + retval.ToNative (call_string) + ";");
|
sw.WriteLine ("\t\t\t\t" + retval.ToNativeType + " __result = " + retval.ToNative (call_string) + ";");
|
||||||
bool fatal = parms.HasOutParam || !retval.IsVoid;
|
bool fatal = parms.HasOutParam || !retval.IsVoid;
|
||||||
sw.Write (call.Finish ("\t\t\t\t"));
|
sw.Write (call.Finish ("\t\t\t\t"));
|
||||||
if (!retval.IsVoid)
|
if (!retval.IsVoid)
|
||||||
sw.WriteLine ("\t\t\t\treturn result;");
|
sw.WriteLine ("\t\t\t\treturn __result;");
|
||||||
|
|
||||||
sw.WriteLine ("\t\t\t} catch (Exception e) {");
|
sw.WriteLine ("\t\t\t} catch (Exception e) {");
|
||||||
sw.WriteLine ("\t\t\t\tGLib.ExceptionManager.RaiseUnhandledException (e, " + (fatal ? "true" : "false") + ");");
|
sw.WriteLine ("\t\t\t\tGLib.ExceptionManager.RaiseUnhandledException (e, " + (fatal ? "true" : "false") + ");");
|
||||||
|
Loading…
Reference in New Issue
Block a user