2007-09-19 Mike Kestner <mkestner@novell.com>
* generator/VirtualMethod.cs: refactor delegate generation into GenerateCallback and add [CDeclCallback] which was missing. * generator/InterfaceGen.cs: kill GenerateDelegates. They are now generated by VirtualMethod.GenerateCallback. svn path=/trunk/gtk-sharp/; revision=86026
This commit is contained in:
parent
2c82cec395
commit
74458aa03a
3 changed files with 12 additions and 20 deletions
|
@ -1,3 +1,10 @@
|
|||
2007-09-19 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* generator/VirtualMethod.cs: refactor delegate generation into
|
||||
GenerateCallback and add [CDeclCallback] which was missing.
|
||||
* generator/InterfaceGen.cs: kill GenerateDelegates. They are now
|
||||
generated by VirtualMethod.GenerateCallback.
|
||||
|
||||
2007-09-14 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* generator/CallbackGen.cs (GenInvoker): null check the sig field
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||
//
|
||||
// Copyright (c) 2001-2003 Mike Kestner
|
||||
// Copyright (c) 2004 Novell, Inc.
|
||||
// Copyright (c) 2004, 2007 Novell, Inc.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of version 2 of the GNU General Public
|
||||
|
@ -75,18 +75,6 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
void GenerateDelegates (StreamWriter sw)
|
||||
{
|
||||
if (vms.Count == 0)
|
||||
return;
|
||||
|
||||
foreach (VirtualMethod vm in vms) {
|
||||
if (vm.IsValid)
|
||||
sw.WriteLine ("\t\t" + vm.NativeDelegate);
|
||||
}
|
||||
sw.WriteLine ();
|
||||
}
|
||||
|
||||
void GenerateIfaceStruct (StreamWriter sw)
|
||||
{
|
||||
sw.WriteLine ("\t\tstatic " + IfaceName + " iface;");
|
||||
|
@ -184,7 +172,6 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\tinternal class " + Name + "Adapter : GLib.GInterfaceAdapter {");
|
||||
sw.WriteLine ();
|
||||
|
||||
GenerateDelegates (sw);
|
||||
GenerateIfaceStruct (sw);
|
||||
GenerateStaticCtor (sw);
|
||||
GenerateCallbacks (sw);
|
||||
|
|
|
@ -83,12 +83,6 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
public string NativeDelegate {
|
||||
get {
|
||||
return "delegate " + MarshalReturnType + " " + Name + "Delegate (" + parms.ImportSignature + ");";
|
||||
}
|
||||
}
|
||||
|
||||
public void GenerateCallback (StreamWriter sw)
|
||||
{
|
||||
if (!Validate ())
|
||||
|
@ -102,6 +96,10 @@ namespace GtkSharp.Generation {
|
|||
call_string = "__obj." + (Name.StartsWith ("Get") ? Name.Substring (3) : Name);
|
||||
else if (IsSetter)
|
||||
call_string = "__obj." + Name.Substring (3) + " = " + call;
|
||||
|
||||
sw.WriteLine ("\t\t[GLib.CDeclCallback]");
|
||||
sw.WriteLine ("\t\tdelegate " + MarshalReturnType + " " + Name + "Delegate (" + parms.ImportSignature + ");");
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\t\tstatic " + MarshalReturnType + " " + Name + "Callback (" + parms.ImportSignature + ")");
|
||||
sw.WriteLine ("\t\t{");
|
||||
sw.WriteLine ("\t\t\t" + type + " __obj = GLib.Object.GetObject (" + name + ", false) as " + type + ";");
|
||||
|
|
Loading…
Reference in a new issue