mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-17 03:44:53 +02:00
2002-10-10 Mike Kestner <mkestner@speakeasy.net>
* generator/CallbackGen.cs : some fixes * generator/Parameters.cs (CreateSignature): handle void params svn path=/trunk/gtk-sharp/; revision=8156
This commit is contained in:
parent
df69cbac6f
commit
3b1dd1079b
@ -1,3 +1,8 @@
|
|||||||
|
2002-10-10 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
|
* generator/CallbackGen.cs : some fixes
|
||||||
|
* generator/Parameters.cs (CreateSignature): handle void params
|
||||||
|
|
||||||
2002-10-10 Miguel de Icaza <miguel@ximian.com>
|
2002-10-10 Miguel de Icaza <miguel@ximian.com>
|
||||||
|
|
||||||
* gtk/ThreadNotify.cs: Avoid multiple notifications.
|
* gtk/ThreadNotify.cs: Avoid multiple notifications.
|
||||||
|
@ -94,7 +94,7 @@ namespace GtkSharp.Generation {
|
|||||||
sw.WriteLine ("\t\t{");
|
sw.WriteLine ("\t\t{");
|
||||||
int count = (parms != null) ? parms.Count : 0;
|
int count = (parms != null) ? parms.Count : 0;
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
sw.WriteLine ("\t\t\tobject[] _args = new object[{0}];", count - 1);
|
sw.WriteLine ("\t\t\tobject[] _args = new object[{0}];", count);
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
bool need_sep = false;
|
bool need_sep = false;
|
||||||
string call_str = "";
|
string call_str = "";
|
||||||
@ -102,7 +102,7 @@ namespace GtkSharp.Generation {
|
|||||||
{
|
{
|
||||||
string parm_name = parms[i].Name;
|
string parm_name = parms[i].Name;
|
||||||
string ctype = parms[i].CType;
|
string ctype = parms[i].CType;
|
||||||
if (ctype == "gpointer" && (parm_name.EndsWith ("data") || parm_name.EndsWith ("data_or_owner")))
|
if ((i == count - 1) && ctype == "gpointer" && (parm_name.EndsWith ("data") || parm_name.EndsWith ("data_or_owner")))
|
||||||
continue;
|
continue;
|
||||||
string cstype = parms[i].CSType;
|
string cstype = parms[i].CSType;
|
||||||
// FIXME: Too much code copy/pasted here. Refactor?
|
// FIXME: Too much code copy/pasted here. Refactor?
|
||||||
|
@ -21,13 +21,18 @@ namespace GtkSharp.Generation {
|
|||||||
|
|
||||||
public string CType {
|
public string CType {
|
||||||
get {
|
get {
|
||||||
return elem.GetAttribute("type");
|
string type = elem.GetAttribute("type");
|
||||||
|
if (type == "void*")
|
||||||
|
type = "gpointer";
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CSType {
|
public string CSType {
|
||||||
get {
|
get {
|
||||||
string cstype = SymbolTable.GetCSType( elem.GetAttribute("type"));
|
string cstype = SymbolTable.GetCSType( elem.GetAttribute("type"));
|
||||||
|
if (cstype == "void")
|
||||||
|
cstype = "System.IntPtr";
|
||||||
if (elem.HasAttribute("array"))
|
if (elem.HasAttribute("array"))
|
||||||
cstype += "[]";
|
cstype += "[]";
|
||||||
return cstype;
|
return cstype;
|
||||||
@ -36,7 +41,10 @@ namespace GtkSharp.Generation {
|
|||||||
|
|
||||||
public string MarshalType {
|
public string MarshalType {
|
||||||
get {
|
get {
|
||||||
return SymbolTable.GetMarshalType( elem.GetAttribute("type"));
|
string type = SymbolTable.GetMarshalType( elem.GetAttribute("type"));
|
||||||
|
if (type == "void")
|
||||||
|
type = "System.IntPtr";
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +196,11 @@ namespace GtkSharp.Generation {
|
|||||||
XmlElement p_elem = (XmlElement) parm;
|
XmlElement p_elem = (XmlElement) parm;
|
||||||
string type = p_elem.GetAttribute("type");
|
string type = p_elem.GetAttribute("type");
|
||||||
string cs_type = SymbolTable.GetCSType(type);
|
string cs_type = SymbolTable.GetCSType(type);
|
||||||
|
if (cs_type == "void")
|
||||||
|
cs_type = "System.IntPtr";
|
||||||
string m_type = SymbolTable.GetMarshalType(type);
|
string m_type = SymbolTable.GetMarshalType(type);
|
||||||
|
if (m_type == "void")
|
||||||
|
m_type = "System.IntPtr";
|
||||||
string name = MangleName(p_elem.GetAttribute("name"));
|
string name = MangleName(p_elem.GetAttribute("name"));
|
||||||
string call_parm, call_parm_name;
|
string call_parm, call_parm_name;
|
||||||
|
|
||||||
@ -262,14 +274,14 @@ namespace GtkSharp.Generation {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(type == "GError**" || (has_callback && type == "gpointer" && (name.EndsWith ("data") || name.EndsWith ("data_or_owner"))))) {
|
if (!(type == "GError**" || (has_callback && (type == "gpointer" || type == "void*") && (i == Count - 1) && (name.EndsWith ("data") || name.EndsWith ("data_or_owner"))))) {
|
||||||
signature += (cs_type + " " + name);
|
signature += (cs_type + " " + name);
|
||||||
signature_types += cs_type;
|
signature_types += cs_type;
|
||||||
last_was_user_data = false;
|
last_was_user_data = false;
|
||||||
} else if (type == "GError**") {
|
} else if (type == "GError**") {
|
||||||
call_parm = call_parm.Replace (name, "error");
|
call_parm = call_parm.Replace (name, "error");
|
||||||
last_was_user_data = false;
|
last_was_user_data = false;
|
||||||
} else if (type == "gpointer" && (name.EndsWith ("data") || name.EndsWith ("data_or_owner"))) {
|
} else if ((type == "gpointer" || type == "void*") && (i == Count - 1) && (name.EndsWith ("data") || name.EndsWith ("data_or_owner"))) {
|
||||||
call_parm = "IntPtr.Zero";
|
call_parm = "IntPtr.Zero";
|
||||||
last_was_user_data = true;
|
last_was_user_data = true;
|
||||||
} else
|
} else
|
||||||
|
Loading…
Reference in New Issue
Block a user