2002-02-10 Mike Kestner <mkestner@speakeasy.net>

* generator/BoxedGen.cs (FromNative): Add explicit cast.
	* generator/ObjectGen.cs (FromNative): Add explicit cast.
	(GenSignal): New.  Partial.  Not hooked in yet.
	* generator/StructBase.cs (GenMethod): return-type is a sub-element,
	  not an attribute.

svn path=/trunk/gtk-sharp/; revision=2304
This commit is contained in:
Mike Kestner 2002-02-10 23:11:25 +00:00
parent 55e63cb433
commit 123557fb68
4 changed files with 48 additions and 6 deletions

View file

@ -1,3 +1,11 @@
2002-02-10 Mike Kestner <mkestner@speakeasy.net>
* generator/BoxedGen.cs (FromNative): Add explicit cast.
* generator/ObjectGen.cs (FromNative): Add explicit cast.
(GenSignal): New. Partial. Not hooked in yet.
* generator/StructBase.cs (GenMethod): return-type is a sub-element,
not an attribute.
2002-02-09 Mike Kestner <mkestner@speakeasy.net> 2002-02-09 Mike Kestner <mkestner@speakeasy.net>
* generator/StructBase.cs (GenMethod): Add handle arg to paramless * generator/StructBase.cs (GenMethod): Add handle arg to paramless

View file

@ -28,7 +28,7 @@ namespace GtkSharp.Generation {
public String FromNative(String var) public String FromNative(String var)
{ {
return "GLib.Boxed.GetBoxed(" + var + ")"; return "(" + QualifiedName + ") GtkSharp.Boxed.GetBoxed(" + var + ")";
} }
public void Generate (SymbolTable table) public void Generate (SymbolTable table)

View file

@ -29,7 +29,7 @@ namespace GtkSharp.Generation {
public String FromNative(String var) public String FromNative(String var)
{ {
return "GLib.Object.GetObject(" + var + ")"; return "(" + QualifiedName + ") GLib.Object.GetObject(" + var + ")";
} }
public void Generate (SymbolTable table) public void Generate (SymbolTable table)
@ -185,7 +185,38 @@ namespace GtkSharp.Generation {
return true; return true;
} }
public bool GenSignal (XmlElement sig, SymbolTable table, StreamWriter sw)
{
String cname = "\"" + sig.GetAttribute("cname") + "\"";
String marsh = "blah"; // SignalHandler.GetName(sig);
if (marsh == "") {
return false;
}
sw.WriteLine("\t\t/// <summary> " + cname + " Event </summary>");
sw.WriteLine("\t\t/// <remarks>");
// FIXME: Generate some signal docs
sw.WriteLine("\t\t/// </remarks>");
sw.WriteLine();
sw.WriteLine("\t\tpublic event EventHandler " + cname + " {");
sw.WriteLine("\t\t\tadd {");
sw.WriteLine("\t\t\t\tif (Events [" + cname + "] == null)");
sw.Write("\t\t\t\t\tSignals[" + cname + "] = new " + marsh);
sw.WriteLine("(this, Handle, " + cname + ", value);");
sw.WriteLine("\t\t\t\tEvents.AddHandler(" + cname + ", value);");
sw.WriteLine("\t\t\t}");
sw.WriteLine("\t\t\tremove {");
sw.WriteLine("\t\t\t\tEvents.RemoveHandler(" + cname + ", value);");
sw.WriteLine("\t\t\t\tif (Events[" + cname + "] == null)");
sw.WriteLine("\t\t\t\t\tSignals.Remove(" + cname + ");");
sw.WriteLine("\t\t\t}");
sw.WriteLine("\t\t}");
sw.WriteLine();
return true;
}
} }
} }

View file

@ -144,11 +144,14 @@ namespace GtkSharp.Generation {
return false; return false;
} }
String rettype = "void"; XmlElement ret_elem = method["return-type"];
if (method.HasAttribute("return-type")) { if (ret_elem == null) {
rettype = method.GetAttribute("return-type"); Console.Write("Missing return type in method ");
return false;
} }
String rettype = ret_elem.GetAttribute("type");
String m_ret = table.GetMarshalType(rettype); String m_ret = table.GetMarshalType(rettype);
String s_ret = table.GetCSType(rettype); String s_ret = table.GetCSType(rettype);
if (m_ret == "" || s_ret == "") { if (m_ret == "" || s_ret == "") {