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:
parent
2918e60a50
commit
e99a131e6a
7 changed files with 74 additions and 7 deletions
11
ChangeLog
11
ChangeLog
|
@ -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>
|
2002-02-02 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
* generator/ObjectGen.cs : Add IntPtr constructor generation. Pass a
|
* generator/ObjectGen.cs : Add IntPtr constructor generation. Pass a
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace GtkSharp.Generation {
|
||||||
public String MarshalType {
|
public String MarshalType {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return QualifiedName;
|
return "IntPtr";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public String CallByName (String var_name)
|
public String CallByName (String var_name)
|
||||||
{
|
{
|
||||||
return var_name + ".RawObject";
|
return var_name + ".Handle";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Generate (SymbolTable table)
|
public void Generate (SymbolTable table)
|
||||||
|
|
|
@ -131,6 +131,22 @@ namespace GtkSharp.Generation {
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlElement elem = (XmlElement) parm;
|
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 += ")";
|
call += ")";
|
||||||
|
@ -141,12 +157,34 @@ namespace GtkSharp.Generation {
|
||||||
{
|
{
|
||||||
isig = "(";
|
isig = "(";
|
||||||
|
|
||||||
|
bool need_comma = false;
|
||||||
|
|
||||||
foreach (XmlNode parm in parms.ChildNodes) {
|
foreach (XmlNode parm in parms.ChildNodes) {
|
||||||
if (parm.Name != "namespace") {
|
if (parm.Name != "parameter") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlElement elem = (XmlElement) parm;
|
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 += ");";
|
isig += ");";
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace GtkSharp.Generation {
|
||||||
public String MarshalType {
|
public String MarshalType {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "IntPtr";
|
return QualifiedName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public String GetMarshalType(String c_type)
|
public String GetMarshalType(String c_type)
|
||||||
{
|
{
|
||||||
|
c_type = Trim(c_type);
|
||||||
if (simple_types.ContainsKey(c_type)) {
|
if (simple_types.ContainsKey(c_type)) {
|
||||||
return (String) simple_types[c_type];
|
return (String) simple_types[c_type];
|
||||||
} else if (complex_types.ContainsKey(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)
|
public bool IsBoxed(String c_type)
|
||||||
{
|
{
|
||||||
if (complex_types.ContainsKey(c_type)) {
|
if (complex_types.ContainsKey(c_type)) {
|
||||||
|
|
|
@ -17,9 +17,13 @@ namespace GtkSamples {
|
||||||
public static int Main (string[] args)
|
public static int Main (string[] args)
|
||||||
{
|
{
|
||||||
Application.Init (ref args);
|
Application.Init (ref args);
|
||||||
Gtk.Window win = new Gtk.Window ("Gtk# Hello World");
|
Console.WriteLine("Creating Window");
|
||||||
win.Deleted += new EventHandler (Window_Delete);
|
Gtk.Window win = new Gtk.Window (Gtk.WindowType.Toplevel);
|
||||||
win.Show ();
|
Console.WriteLine("Setting Title");
|
||||||
|
win.Title = "Gtk# Hello World";
|
||||||
|
// win.Deleted += new EventHandler (Window_Delete);
|
||||||
|
// win.Show ();
|
||||||
|
Console.WriteLine("Entering event loop");
|
||||||
Application.Run ();
|
Application.Run ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue