mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
![Mike Kestner](/assets/img/avatar_default.png)
2002-05-23 Mike Kestner <mkestner@speakeasy.net> * generator/BoxedGen.cs : Update for Static SymbolTable * generator/CallbackGen.cs : Use GenBase and Parameters classes * generator/CodeGenerator.cs : Update for Static SymbolTable * generator/Ctor.cs : code from StructBase using Parameters class * generator/EnumGen.cs : Use GenBase * generator/GenBase.cs : Abstract Stream Writer creation, stream boilerplate, and common *Name properties * generator/IGeneratable.cs : Update for Static SymbolTable * generator/InterfaceGen.cs : Use GenBase * generator/Method.cs : code from StructBase using Parameters class * generator/ObjectGen.cs : Major refactoring. Use GenBase. Build tables of Member generatables at construct time to facilitate future name collision resolution logic. * generator/Parameters.cs : new generatable to abstract duplicated parameter parsing logic. * generator/Parser.cs : Update for Static SymbolTable * generator/Property.cs : code from ObjectGen * generator/Signal.cs : code from ObjectGen * generator/SignalHandler.cs : Update for Static SymbolTable * generator/StructBase.cs : Update for Static SymbolTable * generator/StructGen.cs : Update for Static SymbolTable * generator/SymbolTable.cs : Make all methods and private members static. There is no reason to ever have multiple tables. svn path=/trunk/gtk-sharp/; revision=4895
77 lines
1.6 KiB
C#
77 lines
1.6 KiB
C#
// GtkSharp.Generation.CallbackGen.cs - The Callback Generatable.
|
|
//
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
//
|
|
// (c) 2002 Mike Kestner
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
using System;
|
|
using System.IO;
|
|
using System.Xml;
|
|
|
|
public class CallbackGen : GenBase, IGeneratable {
|
|
|
|
private Parameters parms;
|
|
|
|
public CallbackGen (String ns, XmlElement elem) : base (ns, elem)
|
|
{
|
|
if (elem ["parameters"] != null)
|
|
parms = new Parameters (elem ["parameters"]);
|
|
}
|
|
|
|
public String MarshalType {
|
|
get
|
|
{
|
|
return QualifiedName;
|
|
}
|
|
}
|
|
|
|
public String CallByName (String var_name)
|
|
{
|
|
return var_name;
|
|
}
|
|
|
|
public String FromNative(String var)
|
|
{
|
|
return var;
|
|
}
|
|
|
|
public void Generate ()
|
|
{
|
|
XmlElement ret_elem = Elem["return-type"];
|
|
if (ret_elem == null) {
|
|
Console.WriteLine("No return type in callback " + CName);
|
|
Statistics.ThrottledCount++;
|
|
return;
|
|
}
|
|
|
|
string rettype = ret_elem.GetAttribute("type");
|
|
string s_ret = SymbolTable.GetCSType(rettype);
|
|
if (s_ret == "") {
|
|
Console.WriteLine("rettype: " + rettype + " in callback " + CName);
|
|
Statistics.ThrottledCount++;
|
|
return;
|
|
}
|
|
|
|
if ((parms != null) && !parms.Validate ()) {
|
|
Console.WriteLine(" in callback " + CName);
|
|
Statistics.ThrottledCount++;
|
|
return;
|
|
}
|
|
|
|
StreamWriter sw = CreateWriter ();
|
|
|
|
string sig = "";
|
|
if (parms != null)
|
|
sig = parms.Signature;
|
|
|
|
sw.WriteLine ("\tpublic delegate " + s_ret + " " + Name + "(" + sig + ");");
|
|
|
|
CloseWriter (sw);
|
|
Statistics.CBCount++;
|
|
}
|
|
}
|
|
}
|
|
|