2008-05-01 Mike Kestner <mkestner@novell.com>
* generator/InterfaceGen.cs: use CName and mangle it. ClassFieldName is not guaranteed to be set now. * generator/Signal.cs: read ClassFieldName from the api xml. Move glue writer lookup inside the block to avoid exceptions for now. svn path=/trunk/gtk-sharp/; revision=102276
This commit is contained in:
parent
0780ed3c0d
commit
399c8e8586
3 changed files with 13 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2008-05-01 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
|
* generator/InterfaceGen.cs: use CName and mangle it. ClassFieldName
|
||||||
|
is not guaranteed to be set now.
|
||||||
|
* generator/Signal.cs: read ClassFieldName from the api xml. Move
|
||||||
|
glue writer lookup inside the block to avoid exceptions for now.
|
||||||
|
|
||||||
2008-04-30 Mike Kestner <mkestner@novell.com>
|
2008-04-30 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
* generator/InterfaceGen.cs:
|
* generator/InterfaceGen.cs:
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace GtkSharp.Generation {
|
||||||
foreach (object member in members) {
|
foreach (object member in members) {
|
||||||
if (member is Signal) {
|
if (member is Signal) {
|
||||||
Signal sig = member as Signal;
|
Signal sig = member as Signal;
|
||||||
sw.WriteLine ("\t\t\tpublic IntPtr {0};", sig.ClassFieldName);
|
sw.WriteLine ("\t\t\tpublic IntPtr {0};", sig.CName.Replace ("\"", "").Replace ("-", "_"));
|
||||||
} else if (member is VirtualMethod) {
|
} else if (member is VirtualMethod) {
|
||||||
VirtualMethod vm = member as VirtualMethod;
|
VirtualMethod vm = member as VirtualMethod;
|
||||||
bool has_target = methods [vm.Name] != null;
|
bool has_target = methods [vm.Name] != null;
|
||||||
|
|
|
@ -123,9 +123,9 @@ namespace GtkSharp.Generation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ClassFieldName {
|
string ClassFieldName {
|
||||||
get {
|
get {
|
||||||
return elem.GetAttribute("cname").Replace ("-", "_");
|
return elem.HasAttribute ("field_name") ? elem.GetAttribute("field_name") : String.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,15 +282,16 @@ namespace GtkSharp.Generation {
|
||||||
private void GenDefaultHandlerDelegate (GenerationInfo gen_info, ClassBase implementor)
|
private void GenDefaultHandlerDelegate (GenerationInfo gen_info, ClassBase implementor)
|
||||||
{
|
{
|
||||||
StreamWriter sw = gen_info.Writer;
|
StreamWriter sw = gen_info.Writer;
|
||||||
StreamWriter glue = gen_info.GlueWriter;
|
StreamWriter glue;
|
||||||
bool use_glue = false;
|
bool use_glue = false;
|
||||||
//bool use_glue = glue != null && implementor == null;
|
//bool use_glue = glue != null && implementor == null && ClassFieldName.Length > 0;
|
||||||
string glue_name = String.Empty;
|
string glue_name = String.Empty;
|
||||||
ManagedCallString call = new ManagedCallString (parms);
|
ManagedCallString call = new ManagedCallString (parms);
|
||||||
sw.WriteLine ("\t\t[GLib.CDeclCallback]");
|
sw.WriteLine ("\t\t[GLib.CDeclCallback]");
|
||||||
sw.WriteLine ("\t\tdelegate " + retval.ToNativeType + " " + Name + "VMDelegate (" + parms.ImportSignature + ");\n");
|
sw.WriteLine ("\t\tdelegate " + retval.ToNativeType + " " + Name + "VMDelegate (" + parms.ImportSignature + ");\n");
|
||||||
|
|
||||||
if (use_glue) {
|
if (use_glue) {
|
||||||
|
glue = gen_info.GlueWriter;
|
||||||
glue_name = String.Format ("{0}sharp_{1}_{2}", container_type.NS.ToLower ().Replace (".", "_"), container_type.Name.ToLower (), ClassFieldName);
|
glue_name = String.Format ("{0}sharp_{1}_{2}", container_type.NS.ToLower ().Replace (".", "_"), container_type.Name.ToLower (), ClassFieldName);
|
||||||
sw.WriteLine ("\t\t[DllImport (\"{0}\")]", gen_info.GluelibName);
|
sw.WriteLine ("\t\t[DllImport (\"{0}\")]", gen_info.GluelibName);
|
||||||
sw.WriteLine ("\t\tstatic extern void {0} (IntPtr gtype, {1}VMDelegate cb);\n", glue_name, Name);
|
sw.WriteLine ("\t\tstatic extern void {0} (IntPtr gtype, {1}VMDelegate cb);\n", glue_name, Name);
|
||||||
|
|
Loading…
Reference in a new issue