2009-07-13 Gabriel Burt <gabriel.burt@gmail.com>

* 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
This commit is contained in:
Gabriel Burt 2009-07-13 18:55:08 +00:00
parent c339d40680
commit 1cd652998e
3 changed files with 26 additions and 14 deletions

View file

@ -1,3 +1,14 @@
2009-07-13 Gabriel Burt <gabriel.burt@gmail.com>
* 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 <mkestner@novell.com>
* glib/GType.cs: add ResolveType event and TypeResolutionHandler delegate

View file

@ -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 ());

View file

@ -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 ();