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

* generator/BoxedGen.cs : Marshal as IntPtr using Raw prop.
	* generator/ObjectGen.cs : Use Handle for marshaling.
	* generator/StructBase.cs (CallByName): Fill out the stub.
	(GetImportSig): Fill out the stub.
	* generator/StructGen.cs (MarshalType): Use QualifiedName.
	* generator/SymbolTable.cs (GetMarshalType): Trim type.
	(CallByName): New. Provides calling syntax.
	* sample/HelloWorld.cs : Make it compile.

svn path=/trunk/gtk-sharp/; revision=2253
This commit is contained in:
Mike Kestner 2002-02-06 20:09:14 +00:00
parent 2918e60a50
commit e99a131e6a
7 changed files with 74 additions and 7 deletions

View file

@ -1,3 +1,14 @@
2002-02-06 Mike Kestner <mkestner@speakeasy.net>
* generator/BoxedGen.cs : Marshal as IntPtr using Raw prop.
* generator/ObjectGen.cs : Use Handle for marshaling.
* generator/StructBase.cs (CallByName): Fill out the stub.
(GetImportSig): Fill out the stub.
* generator/StructGen.cs (MarshalType): Use QualifiedName.
* generator/SymbolTable.cs (GetMarshalType): Trim type.
(CallByName): New. Provides calling syntax.
* sample/HelloWorld.cs : Make it compile.
2002-02-02 Mike Kestner <mkestner@speakeasy.net>
* generator/ObjectGen.cs : Add IntPtr constructor generation. Pass a

View file

@ -17,7 +17,7 @@ namespace GtkSharp.Generation {
public String MarshalType {
get
{
return QualifiedName;
return "IntPtr";
}
}

View file

@ -24,7 +24,7 @@ namespace GtkSharp.Generation {
public String CallByName (String var_name)
{
return var_name + ".RawObject";
return var_name + ".Handle";
}
public void Generate (SymbolTable table)

View file

@ -131,6 +131,22 @@ namespace GtkSharp.Generation {
}
XmlElement elem = (XmlElement) parm;
String type = elem.GetAttribute("type");
String name = elem.GetAttribute("name");
name = MangleName(name);
String call_parm = table.CallByName(type, name);
if (call_parm == "") {
Console.Write("Name: " + name + " Type: " + type + " ");
return false;
}
if (need_comma) {
call += ", ";
} else {
need_comma = true;
}
call += call_parm;
}
call += ")";
@ -141,12 +157,34 @@ namespace GtkSharp.Generation {
{
isig = "(";
bool need_comma = false;
foreach (XmlNode parm in parms.ChildNodes) {
if (parm.Name != "namespace") {
if (parm.Name != "parameter") {
continue;
}
XmlElement elem = (XmlElement) parm;
String type = elem.GetAttribute("type");
String m_type = table.GetMarshalType(type);
String name = elem.GetAttribute("name");
name = MangleName(name);
if ((m_type == "") || (name == "")) {
Console.Write("Name: " + name + " Type: " + type + " ");
return false;
}
if (elem.HasAttribute("array")) {
m_type += "[]";
}
if (need_comma) {
isig += ", ";
} else {
need_comma = true;
}
isig += (m_type + " " + name);
}
isig += ");";

View file

@ -17,7 +17,7 @@ namespace GtkSharp.Generation {
public String MarshalType {
get
{
return "IntPtr";
return QualifiedName;
}
}

View file

@ -115,6 +115,7 @@ namespace GtkSharp.Generation {
public String GetMarshalType(String c_type)
{
c_type = Trim(c_type);
if (simple_types.ContainsKey(c_type)) {
return (String) simple_types[c_type];
} else if (complex_types.ContainsKey(c_type)) {
@ -125,6 +126,19 @@ namespace GtkSharp.Generation {
}
}
public String CallByName(String c_type, String var_name)
{
c_type = Trim(c_type);
if (simple_types.ContainsKey(c_type)) {
return var_name;
} else if (complex_types.ContainsKey(c_type)) {
IGeneratable gen = (IGeneratable) complex_types[c_type];
return gen.CallByName(var_name);
} else {
return "";
}
}
public bool IsBoxed(String c_type)
{
if (complex_types.ContainsKey(c_type)) {

View file

@ -17,9 +17,13 @@ namespace GtkSamples {
public static int Main (string[] args)
{
Application.Init (ref args);
Gtk.Window win = new Gtk.Window ("Gtk# Hello World");
win.Deleted += new EventHandler (Window_Delete);
win.Show ();
Console.WriteLine("Creating Window");
Gtk.Window win = new Gtk.Window (Gtk.WindowType.Toplevel);
Console.WriteLine("Setting Title");
win.Title = "Gtk# Hello World";
// win.Deleted += new EventHandler (Window_Delete);
// win.Show ();
Console.WriteLine("Entering event loop");
Application.Run ();
return 0;
}