mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 08:23:19 +02:00
95 lines
1.9 KiB
C#
95 lines
1.9 KiB
C#
![]() |
// 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();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|