From 1cd652998e1bf7a5612dca1acc7197389b1611f2 Mon Sep 17 00:00:00 2001 From: Gabriel Burt Date: Mon, 13 Jul 2009 18:55:08 +0000 Subject: [PATCH] 2009-07-13 Gabriel Burt * generator/GenBase.cs: Add AppendCustom override that you can pass the type name in, used to include .custom for Name + Adapter and Name + Implementor .custom files for interface gen. * generator/InterfaceGen.cs: Use the new AppendCustom override for the Name + Adapter.custom file, and add support for including custom file for the Name + Implementor interface; necessary to manually implement an interface method. svn path=/trunk/gtk-sharp/; revision=137809 --- ChangeLog | 11 +++++++++++ generator/GenBase.cs | 11 ++++++++--- generator/InterfaceGen.cs | 18 +++++++----------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12c985152..f74de0275 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-07-13 Gabriel Burt + + * generator/GenBase.cs: Add AppendCustom override that you can pass the + type name in, used to include .custom for Name + Adapter and Name + + Implementor .custom files for interface gen. + + * generator/InterfaceGen.cs: Use the new AppendCustom override for the + Name + Adapter.custom file, and add support for including custom file for + the Name + Implementor interface; necessary to manually implement an + interface method. + 2009-07-12 Mike Kestner * glib/GType.cs: add ResolveType event and TypeResolutionHandler delegate diff --git a/generator/GenBase.cs b/generator/GenBase.cs index 559e3e203..ed68c5c30 100644 --- a/generator/GenBase.cs +++ b/generator/GenBase.cs @@ -105,14 +105,19 @@ namespace GtkSharp.Generation { return MarshalType; } } - + protected void AppendCustom (StreamWriter sw, string custom_dir) + { + AppendCustom (sw, custom_dir, Name); + } + + protected void AppendCustom (StreamWriter sw, string custom_dir, string type_name) { char sep = Path.DirectorySeparatorChar; - string custom = custom_dir + sep + Name + ".custom"; + string custom = custom_dir + sep + type_name + ".custom"; if (File.Exists(custom)) { sw.WriteLine ("#region Customized extensions"); - sw.WriteLine ("#line 1 \"" + Name + ".custom\""); + sw.WriteLine ("#line 1 \"" + type_name + ".custom\""); FileStream custstream = new FileStream(custom, FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(custstream); sw.WriteLine (sr.ReadToEnd ()); diff --git a/generator/InterfaceGen.cs b/generator/InterfaceGen.cs index d0dc77b84..c97adb24c 100644 --- a/generator/InterfaceGen.cs +++ b/generator/InterfaceGen.cs @@ -252,15 +252,7 @@ namespace GtkSharp.Generation { sw.WriteLine ("#endregion"); - string custom = Path.Combine (gen_info.CustomDir, Name + "Adapter.custom"); - if (File.Exists (custom)) { - sw.WriteLine ("#region Customized extensions"); - sw.WriteLine ("#line 1 \"" + Name + "Adapter.custom\""); - using (StreamReader sr = new StreamReader(new FileStream (custom, FileMode.Open, FileAccess.Read))) - sw.WriteLine (sr.ReadToEnd ()); - - sw.WriteLine ("#endregion"); - } + AppendCustom (sw, gen_info.CustomDir, Name + "Adapter"); sw.WriteLine ("\t}"); sw.WriteLine ("}"); @@ -268,8 +260,9 @@ namespace GtkSharp.Generation { gen_info.Writer = null; } - void GenerateImplementorIface (StreamWriter sw) + void GenerateImplementorIface (GenerationInfo gen_info) { + var sw = gen_info.Writer; if (IsConsumeOnly) return; @@ -305,6 +298,9 @@ namespace GtkSharp.Generation { vm_table.Remove (vm.Name); } } + + AppendCustom (sw, gen_info.CustomDir, Name + "Implementor"); + sw.WriteLine ("\t}"); } @@ -339,7 +335,7 @@ namespace GtkSharp.Generation { AppendCustom (sw, gen_info.CustomDir); sw.WriteLine ("\t}"); - GenerateImplementorIface (sw); + GenerateImplementorIface (gen_info); sw.WriteLine ("#endregion"); sw.WriteLine ("}"); sw.Close ();