mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
2002-01-08 Mike Kestner <mkestner@speakeasy.net>
* generator/CallbackGen.cs : New stub for delegate generation. * generator/InterfaceGen.cs : New stub for interface generation. * generator/Parser.cs : Add the interface and callback element hooks. * generator/SymbolTable.cs : Additions to simple_types hash. svn path=/trunk/gtk-sharp/; revision=1919
This commit is contained in:
parent
e33710f1c3
commit
a9581bd50b
@ -1,3 +1,10 @@
|
|||||||
|
2002-01-08 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
|
* generator/CallbackGen.cs : New stub for delegate generation.
|
||||||
|
* generator/InterfaceGen.cs : New stub for interface generation.
|
||||||
|
* generator/Parser.cs : Add the interface and callback element hooks.
|
||||||
|
* generator/SymbolTable.cs : Additions to simple_types hash.
|
||||||
|
|
||||||
2002-01-07 Mike Kestner <mkestner@speakeasy.net>
|
2002-01-07 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
* generator/ObjectGen.cs : Make parent debug statement more helpful.
|
* generator/ObjectGen.cs : Make parent debug statement more helpful.
|
||||||
|
94
generator/CallbackGen.cs
Normal file
94
generator/CallbackGen.cs
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
// GtkSharp.Generation.CallbackGen.cs - The Callback Generatable.
|
||||||
|
//
|
||||||
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
//
|
||||||
|
// (c) 2001 Mike Kestner
|
||||||
|
|
||||||
|
namespace GtkSharp.Generation {
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
public class CallbackGen : IGeneratable {
|
||||||
|
|
||||||
|
private String ns;
|
||||||
|
private XmlElement elem;
|
||||||
|
|
||||||
|
public CallbackGen (String ns, XmlElement elem) {
|
||||||
|
|
||||||
|
this.ns = ns;
|
||||||
|
this.elem = elem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String Name {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return elem.GetAttribute("name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String CName {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return elem.GetAttribute("cname");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String QualifiedName {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ns + "." + elem.GetAttribute("cname");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String MarshalType {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String CallByName (String var_name)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Generate (SymbolTable table)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists("..\\" + ns.ToLower() + "\\generated")) {
|
||||||
|
Directory.CreateDirectory("..\\"+ns.ToLower()+"\\generated");
|
||||||
|
}
|
||||||
|
String filename = "..\\" + ns.ToLower() + "\\generated\\" + Name + ".cs";
|
||||||
|
|
||||||
|
FileStream stream = new FileStream (filename, FileMode.Create, FileAccess.Write);
|
||||||
|
StreamWriter sw = new StreamWriter (stream);
|
||||||
|
|
||||||
|
sw.WriteLine ("// Generated File. Do not modify.");
|
||||||
|
sw.WriteLine ("// <c> 2001 Mike Kestner");
|
||||||
|
sw.WriteLine ();
|
||||||
|
|
||||||
|
sw.WriteLine ("namespace " + ns + " {");
|
||||||
|
sw.WriteLine ();
|
||||||
|
sw.WriteLine ("\tusing System;");
|
||||||
|
sw.WriteLine ();
|
||||||
|
|
||||||
|
sw.WriteLine ("\tpublic delegate void " + Name + "();");
|
||||||
|
sw.WriteLine ();
|
||||||
|
|
||||||
|
foreach (XmlNode node in elem.ChildNodes) {
|
||||||
|
if (node.Name != "member") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//FIXME: Generate the methods.
|
||||||
|
XmlElement member = (XmlElement) node;
|
||||||
|
}
|
||||||
|
|
||||||
|
sw.WriteLine ("}");
|
||||||
|
sw.Flush();
|
||||||
|
sw.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
97
generator/InterfaceGen.cs
Normal file
97
generator/InterfaceGen.cs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
// GtkSharp.Generation.InterfaceGen.cs - The Interface Generatable.
|
||||||
|
//
|
||||||
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
//
|
||||||
|
// (c) 2001 Mike Kestner
|
||||||
|
|
||||||
|
namespace GtkSharp.Generation {
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
public class InterfaceGen : IGeneratable {
|
||||||
|
|
||||||
|
private String ns;
|
||||||
|
private XmlElement elem;
|
||||||
|
|
||||||
|
public InterfaceGen (String ns, XmlElement elem) {
|
||||||
|
|
||||||
|
this.ns = ns;
|
||||||
|
this.elem = elem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String Name {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return elem.GetAttribute("name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String CName {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return elem.GetAttribute("cname");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String QualifiedName {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ns + "." + elem.GetAttribute("cname");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String MarshalType {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String CallByName (String var_name)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Generate (SymbolTable table)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists("..\\" + ns.ToLower() + "\\generated")) {
|
||||||
|
Directory.CreateDirectory("..\\"+ns.ToLower()+"\\generated");
|
||||||
|
}
|
||||||
|
String filename = "..\\" + ns.ToLower() + "\\generated\\" + Name + ".cs";
|
||||||
|
|
||||||
|
FileStream stream = new FileStream (filename, FileMode.Create, FileAccess.Write);
|
||||||
|
StreamWriter sw = new StreamWriter (stream);
|
||||||
|
|
||||||
|
sw.WriteLine ("// Generated File. Do not modify.");
|
||||||
|
sw.WriteLine ("// <c> 2001 Mike Kestner");
|
||||||
|
sw.WriteLine ();
|
||||||
|
|
||||||
|
sw.WriteLine ("namespace " + ns + " {");
|
||||||
|
sw.WriteLine ();
|
||||||
|
sw.WriteLine ("\tusing System;");
|
||||||
|
sw.WriteLine ();
|
||||||
|
|
||||||
|
sw.WriteLine ("\tpublic interface " + Name + " {");
|
||||||
|
sw.WriteLine ();
|
||||||
|
|
||||||
|
foreach (XmlNode node in elem.ChildNodes) {
|
||||||
|
if (node.Name != "member") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//FIXME: Generate the methods.
|
||||||
|
XmlElement member = (XmlElement) node;
|
||||||
|
}
|
||||||
|
|
||||||
|
sw.WriteLine ("\t}");
|
||||||
|
sw.WriteLine ();
|
||||||
|
sw.WriteLine ("}");
|
||||||
|
|
||||||
|
sw.Flush();
|
||||||
|
sw.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -74,6 +74,7 @@ namespace GtkSharp.Generation {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "callback":
|
case "callback":
|
||||||
|
table.AddType (new CallbackGen (ns_name, elem));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "enum":
|
case "enum":
|
||||||
@ -81,6 +82,7 @@ namespace GtkSharp.Generation {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "interface":
|
case "interface":
|
||||||
|
table.AddType (new InterfaceGen (ns_name, elem));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "object":
|
case "object":
|
||||||
|
@ -46,9 +46,17 @@ namespace GtkSharp.Generation {
|
|||||||
simple_types.Add ("double", "double");
|
simple_types.Add ("double", "double");
|
||||||
simple_types.Add ("gunichar", "String");
|
simple_types.Add ("gunichar", "String");
|
||||||
simple_types.Add ("uint1", "bool");
|
simple_types.Add ("uint1", "bool");
|
||||||
|
simple_types.Add ("GPtrArray", "IntPtr[]");
|
||||||
|
simple_types.Add ("GType", "int");
|
||||||
|
|
||||||
// FIXME: These ought to be handled properly.
|
// FIXME: These ought to be handled properly.
|
||||||
simple_types.Add ("GList", "IntPtr");
|
simple_types.Add ("GList", "IntPtr");
|
||||||
|
simple_types.Add ("GMemChunk", "IntPtr");
|
||||||
|
simple_types.Add ("GTimeVal", "IntPtr");
|
||||||
|
simple_types.Add ("GClosure", "IntPtr");
|
||||||
|
simple_types.Add ("GArray", "IntPtr");
|
||||||
|
simple_types.Add ("GData", "IntPtr");
|
||||||
|
simple_types.Add ("GTypeModule", "IntPtr");
|
||||||
simple_types.Add ("GSList", "IntPtr");
|
simple_types.Add ("GSList", "IntPtr");
|
||||||
simple_types.Add ("GHashTable", "IntPtr");
|
simple_types.Add ("GHashTable", "IntPtr");
|
||||||
simple_types.Add ("va_list", "IntPtr");
|
simple_types.Add ("va_list", "IntPtr");
|
||||||
|
Loading…
Reference in New Issue
Block a user