2002-01-05 12:45:55 +00:00
|
|
|
// GtkSharp.Generation.SymbolTable.cs - The Symbol Table Class.
|
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
2003-05-19 02:45:17 +00:00
|
|
|
// (c) 2001-2003 Mike Kestner
|
2002-01-05 12:45:55 +00:00
|
|
|
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
public class SymbolTable {
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
static SymbolTable table = null;
|
|
|
|
|
|
|
|
Hashtable alias = new Hashtable ();
|
|
|
|
Hashtable types = new Hashtable ();
|
2002-01-05 12:45:55 +00:00
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public static SymbolTable Table {
|
|
|
|
get {
|
|
|
|
if (table == null)
|
|
|
|
table = new SymbolTable ();
|
|
|
|
|
|
|
|
return table;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public SymbolTable ()
|
2002-01-05 13:24:13 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
Hashtable alias = new Hashtable ();
|
|
|
|
Hashtable types = new Hashtable ();
|
|
|
|
|
|
|
|
AddType (new SimpleGen ("void", "void"));
|
|
|
|
AddType (new SimpleGen ("gboolean", "bool"));
|
|
|
|
AddType (new SimpleGen ("gint", "int"));
|
|
|
|
AddType (new SimpleGen ("guint", "uint"));
|
|
|
|
AddType (new SimpleGen ("glong", "long"));
|
|
|
|
AddType (new SimpleGen ("gshort", "short"));
|
|
|
|
AddType (new SimpleGen ("gushort", "ushort"));
|
|
|
|
AddType (new SimpleGen ("guint32", "uint"));
|
|
|
|
AddType (new SimpleGen ("guint64", "ulong"));
|
2003-05-29 Rachel Hestilow <rachel@nullenvoid.com>
* gconf/Value.cs: Update to use new string marshalling.
* generator/StringGen.cs, ConstStringGen.cs: Added.
* generator/IGeneratable.cs: Add new method ToNativeReturn.
* generator/CallbackGen.cs: Implement ToNativeReturn. Call
ToNativeReturn for the return statement. Fix a couple of
places where s_ret was being used incorrectly for m_ret.
* generator/ClassGen.cs, EnumGen.cs, ManualGen.cs,
SimpleGen.cs, StructBase.cs: Implement ToNativeReturn.
* generator/SignalHandler.cs: Call ToNativeReturn for the
return statement, instead of CallByName.
* generator/SymbolTable.cs: Use StringGen for gchar, char,
and gunichar, and ConstStringGen for their const variants.
Add a new method wrapper for ToNativeReturn.
(Trim): Add a special-case for const strings so that the
const is not stripped. Otherwise there is no way of
resolving the const case.
* glade/XML.custom: Update to use new string marshalling.
* glib/Marshaller.cs: Added.
* glib/GException.cs, Markup.cs, ObjectManager.cs,
Value.cs: Update to use new string marshalling.
* glib/Object.cs: Remove old g_type_name DllImport
as it is no longer used.
* glue/fileselection.c (gtksharp_file_selection_get_fileop_entry):
Mark this as const return.
* gtk/ColorSelection.custom, FileSelection.custom,
SelectionData.custom: Update to use new string marshalling.
svn path=/trunk/gtk-sharp/; revision=15286
2003-06-10 18:09:47 +00:00
|
|
|
// Const returned strings must be generated
|
|
|
|
// differently from memory-managed strings
|
|
|
|
AddType (new ConstStringGen ("const-gchar"));
|
2003-10-09 23:14:12 +00:00
|
|
|
AddType (new ConstStringGen ("const-xmlChar"));
|
2003-05-29 Rachel Hestilow <rachel@nullenvoid.com>
* gconf/Value.cs: Update to use new string marshalling.
* generator/StringGen.cs, ConstStringGen.cs: Added.
* generator/IGeneratable.cs: Add new method ToNativeReturn.
* generator/CallbackGen.cs: Implement ToNativeReturn. Call
ToNativeReturn for the return statement. Fix a couple of
places where s_ret was being used incorrectly for m_ret.
* generator/ClassGen.cs, EnumGen.cs, ManualGen.cs,
SimpleGen.cs, StructBase.cs: Implement ToNativeReturn.
* generator/SignalHandler.cs: Call ToNativeReturn for the
return statement, instead of CallByName.
* generator/SymbolTable.cs: Use StringGen for gchar, char,
and gunichar, and ConstStringGen for their const variants.
Add a new method wrapper for ToNativeReturn.
(Trim): Add a special-case for const strings so that the
const is not stripped. Otherwise there is no way of
resolving the const case.
* glade/XML.custom: Update to use new string marshalling.
* glib/Marshaller.cs: Added.
* glib/GException.cs, Markup.cs, ObjectManager.cs,
Value.cs: Update to use new string marshalling.
* glib/Object.cs: Remove old g_type_name DllImport
as it is no longer used.
* glue/fileselection.c (gtksharp_file_selection_get_fileop_entry):
Mark this as const return.
* gtk/ColorSelection.custom, FileSelection.custom,
SelectionData.custom: Update to use new string marshalling.
svn path=/trunk/gtk-sharp/; revision=15286
2003-06-10 18:09:47 +00:00
|
|
|
AddType (new ConstStringGen ("const-char"));
|
|
|
|
AddType (new StringGen ("gchar"));
|
2003-05-19 02:45:17 +00:00
|
|
|
AddType (new SimpleGen ("gfloat", "float"));
|
|
|
|
AddType (new SimpleGen ("gdouble", "double"));
|
|
|
|
AddType (new SimpleGen ("gint8", "sbyte"));
|
|
|
|
AddType (new SimpleGen ("guint8", "byte"));
|
|
|
|
AddType (new SimpleGen ("gint16", "short"));
|
|
|
|
AddType (new SimpleGen ("gint32", "int"));
|
|
|
|
AddType (new SimpleGen ("gint64", "long"));
|
|
|
|
AddType (new SimpleGen ("guint16", "ushort"));
|
|
|
|
AddType (new SimpleGen ("guint1", "bool"));
|
|
|
|
AddType (new SimpleGen ("gpointer", "IntPtr"));
|
|
|
|
AddType (new SimpleGen ("guchar", "byte"));
|
2003-11-07 18:14:35 +00:00
|
|
|
AddType (new SimpleGen ("short", "short"));
|
2003-05-19 02:45:17 +00:00
|
|
|
AddType (new SimpleGen ("long", "long"));
|
2003-06-07 17:22:12 +00:00
|
|
|
AddType (new SimpleGen ("ulong", "ulong"));
|
2003-05-19 02:45:17 +00:00
|
|
|
AddType (new SimpleGen ("gulong", "ulong"));
|
|
|
|
AddType (new SimpleGen ("GQuark", "int"));
|
|
|
|
AddType (new SimpleGen ("int", "int"));
|
2003-05-29 Rachel Hestilow <rachel@nullenvoid.com>
* gconf/Value.cs: Update to use new string marshalling.
* generator/StringGen.cs, ConstStringGen.cs: Added.
* generator/IGeneratable.cs: Add new method ToNativeReturn.
* generator/CallbackGen.cs: Implement ToNativeReturn. Call
ToNativeReturn for the return statement. Fix a couple of
places where s_ret was being used incorrectly for m_ret.
* generator/ClassGen.cs, EnumGen.cs, ManualGen.cs,
SimpleGen.cs, StructBase.cs: Implement ToNativeReturn.
* generator/SignalHandler.cs: Call ToNativeReturn for the
return statement, instead of CallByName.
* generator/SymbolTable.cs: Use StringGen for gchar, char,
and gunichar, and ConstStringGen for their const variants.
Add a new method wrapper for ToNativeReturn.
(Trim): Add a special-case for const strings so that the
const is not stripped. Otherwise there is no way of
resolving the const case.
* glade/XML.custom: Update to use new string marshalling.
* glib/Marshaller.cs: Added.
* glib/GException.cs, Markup.cs, ObjectManager.cs,
Value.cs: Update to use new string marshalling.
* glib/Object.cs: Remove old g_type_name DllImport
as it is no longer used.
* glue/fileselection.c (gtksharp_file_selection_get_fileop_entry):
Mark this as const return.
* gtk/ColorSelection.custom, FileSelection.custom,
SelectionData.custom: Update to use new string marshalling.
svn path=/trunk/gtk-sharp/; revision=15286
2003-06-10 18:09:47 +00:00
|
|
|
AddType (new StringGen ("char"));
|
2003-05-19 02:45:17 +00:00
|
|
|
AddType (new SimpleGen ("double", "double"));
|
|
|
|
AddType (new SimpleGen ("float", "float"));
|
2003-05-29 Rachel Hestilow <rachel@nullenvoid.com>
* gconf/Value.cs: Update to use new string marshalling.
* generator/StringGen.cs, ConstStringGen.cs: Added.
* generator/IGeneratable.cs: Add new method ToNativeReturn.
* generator/CallbackGen.cs: Implement ToNativeReturn. Call
ToNativeReturn for the return statement. Fix a couple of
places where s_ret was being used incorrectly for m_ret.
* generator/ClassGen.cs, EnumGen.cs, ManualGen.cs,
SimpleGen.cs, StructBase.cs: Implement ToNativeReturn.
* generator/SignalHandler.cs: Call ToNativeReturn for the
return statement, instead of CallByName.
* generator/SymbolTable.cs: Use StringGen for gchar, char,
and gunichar, and ConstStringGen for their const variants.
Add a new method wrapper for ToNativeReturn.
(Trim): Add a special-case for const strings so that the
const is not stripped. Otherwise there is no way of
resolving the const case.
* glade/XML.custom: Update to use new string marshalling.
* glib/Marshaller.cs: Added.
* glib/GException.cs, Markup.cs, ObjectManager.cs,
Value.cs: Update to use new string marshalling.
* glib/Object.cs: Remove old g_type_name DllImport
as it is no longer used.
* glue/fileselection.c (gtksharp_file_selection_get_fileop_entry):
Mark this as const return.
* gtk/ColorSelection.custom, FileSelection.custom,
SelectionData.custom: Update to use new string marshalling.
svn path=/trunk/gtk-sharp/; revision=15286
2003-06-10 18:09:47 +00:00
|
|
|
AddType (new StringGen ("gunichar"));
|
2003-05-19 02:45:17 +00:00
|
|
|
AddType (new SimpleGen ("uint1", "bool"));
|
2003-07-11 02:00:13 +00:00
|
|
|
AddType (new SimpleGen ("GC", "IntPtr"));
|
2003-05-19 02:45:17 +00:00
|
|
|
AddType (new SimpleGen ("GPtrArray", "IntPtr[]"));
|
2003-12-15 16:59:25 +00:00
|
|
|
AddType (new ManualGen ("GType", "GLib.GType", "Val"));
|
2003-05-19 02:45:17 +00:00
|
|
|
AddType (new SimpleGen ("GError", "IntPtr"));
|
2002-07-02 03:35:07 +00:00
|
|
|
// gsize is a system-specific typedef in glibconfig.h,
|
|
|
|
// but this should work for now
|
2003-05-19 02:45:17 +00:00
|
|
|
AddType (new SimpleGen ("gsize", "uint"));
|
|
|
|
AddType (new SimpleGen ("gssize", "int"));
|
|
|
|
AddType (new SimpleGen ("size_t", "int"));
|
2002-01-05 13:24:13 +00:00
|
|
|
|
|
|
|
// FIXME: These ought to be handled properly.
|
2003-05-19 02:45:17 +00:00
|
|
|
AddType (new SimpleGen ("GMemChunk", "IntPtr"));
|
|
|
|
AddType (new SimpleGen ("GTimeVal", "IntPtr"));
|
|
|
|
AddType (new SimpleGen ("GClosure", "IntPtr"));
|
|
|
|
AddType (new SimpleGen ("GArray", "IntPtr"));
|
|
|
|
AddType (new SimpleGen ("GData", "IntPtr"));
|
|
|
|
AddType (new SimpleGen ("GTypeModule", "GLib.Object"));
|
|
|
|
AddType (new SimpleGen ("GHashTable", "System.IntPtr"));
|
|
|
|
AddType (new SimpleGen ("va_list", "IntPtr"));
|
|
|
|
AddType (new SimpleGen ("GParamSpec", "IntPtr"));
|
|
|
|
AddType (new SimpleGen ("gconstpointer", "IntPtr"));
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
|
2003-12-15 16:59:25 +00:00
|
|
|
AddType (new ManualGen ("GSList", "GLib.SList"));
|
|
|
|
AddType (new ManualGen ("GList", "GLib.List"));
|
|
|
|
AddType (new ManualGen ("GValue", "GLib.Value"));
|
|
|
|
AddType (new ManualGen ("GObject", "GLib.Object"));
|
2002-01-05 13:24:13 +00:00
|
|
|
}
|
|
|
|
|
2003-10-03 22:11:47 +00:00
|
|
|
public void AddType (IGeneratable gen)
|
2002-05-26 16:23:40 +00:00
|
|
|
{
|
2003-10-03 22:11:47 +00:00
|
|
|
types [gen.CName] = gen;
|
2002-05-26 16:23:40 +00:00
|
|
|
}
|
|
|
|
|
2003-10-03 22:11:47 +00:00
|
|
|
public void AddTypes (IGeneratable[] gens)
|
2002-01-05 12:45:55 +00:00
|
|
|
{
|
2003-10-03 22:11:47 +00:00
|
|
|
foreach (IGeneratable gen in gens)
|
|
|
|
types [gen.CName] = gen;
|
2002-01-05 12:45:55 +00:00
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public int Count {
|
2002-01-05 12:45:55 +00:00
|
|
|
get
|
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
return types.Count;
|
2002-01-05 12:45:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public IEnumerable Generatables {
|
2002-03-08 22:40:00 +00:00
|
|
|
get {
|
2003-05-19 02:45:17 +00:00
|
|
|
return types.Values;
|
2002-03-08 22:40:00 +00:00
|
|
|
}
|
2002-01-05 12:45:55 +00:00
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public IGeneratable this [string ctype] {
|
|
|
|
get {
|
2003-10-03 22:11:47 +00:00
|
|
|
return DeAlias (ctype) as IGeneratable;
|
2003-05-19 02:45:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private string Trim(string type)
|
2002-02-03 03:44:10 +00:00
|
|
|
{
|
2002-08-21 00:57:52 +00:00
|
|
|
// HACK: If we don't detect this here, there is no
|
|
|
|
// way of indicating it in the symbol table
|
|
|
|
if (type == "void*" || type == "const-void*") return "gpointer";
|
|
|
|
|
2002-04-04 16:20:53 +00:00
|
|
|
string trim_type = type.TrimEnd('*');
|
2003-05-29 Rachel Hestilow <rachel@nullenvoid.com>
* gconf/Value.cs: Update to use new string marshalling.
* generator/StringGen.cs, ConstStringGen.cs: Added.
* generator/IGeneratable.cs: Add new method ToNativeReturn.
* generator/CallbackGen.cs: Implement ToNativeReturn. Call
ToNativeReturn for the return statement. Fix a couple of
places where s_ret was being used incorrectly for m_ret.
* generator/ClassGen.cs, EnumGen.cs, ManualGen.cs,
SimpleGen.cs, StructBase.cs: Implement ToNativeReturn.
* generator/SignalHandler.cs: Call ToNativeReturn for the
return statement, instead of CallByName.
* generator/SymbolTable.cs: Use StringGen for gchar, char,
and gunichar, and ConstStringGen for their const variants.
Add a new method wrapper for ToNativeReturn.
(Trim): Add a special-case for const strings so that the
const is not stripped. Otherwise there is no way of
resolving the const case.
* glade/XML.custom: Update to use new string marshalling.
* glib/Marshaller.cs: Added.
* glib/GException.cs, Markup.cs, ObjectManager.cs,
Value.cs: Update to use new string marshalling.
* glib/Object.cs: Remove old g_type_name DllImport
as it is no longer used.
* glue/fileselection.c (gtksharp_file_selection_get_fileop_entry):
Mark this as const return.
* gtk/ColorSelection.custom, FileSelection.custom,
SelectionData.custom: Update to use new string marshalling.
svn path=/trunk/gtk-sharp/; revision=15286
2003-06-10 18:09:47 +00:00
|
|
|
|
|
|
|
// HACK: Similar to above, but for const strings
|
2003-10-09 23:14:12 +00:00
|
|
|
if (trim_type == "const-gchar" || trim_type == "const-char" || trim_type == "const-xmlChar") return trim_type;
|
2003-05-29 Rachel Hestilow <rachel@nullenvoid.com>
* gconf/Value.cs: Update to use new string marshalling.
* generator/StringGen.cs, ConstStringGen.cs: Added.
* generator/IGeneratable.cs: Add new method ToNativeReturn.
* generator/CallbackGen.cs: Implement ToNativeReturn. Call
ToNativeReturn for the return statement. Fix a couple of
places where s_ret was being used incorrectly for m_ret.
* generator/ClassGen.cs, EnumGen.cs, ManualGen.cs,
SimpleGen.cs, StructBase.cs: Implement ToNativeReturn.
* generator/SignalHandler.cs: Call ToNativeReturn for the
return statement, instead of CallByName.
* generator/SymbolTable.cs: Use StringGen for gchar, char,
and gunichar, and ConstStringGen for their const variants.
Add a new method wrapper for ToNativeReturn.
(Trim): Add a special-case for const strings so that the
const is not stripped. Otherwise there is no way of
resolving the const case.
* glade/XML.custom: Update to use new string marshalling.
* glib/Marshaller.cs: Added.
* glib/GException.cs, Markup.cs, ObjectManager.cs,
Value.cs: Update to use new string marshalling.
* glib/Object.cs: Remove old g_type_name DllImport
as it is no longer used.
* glue/fileselection.c (gtksharp_file_selection_get_fileop_entry):
Mark this as const return.
* gtk/ColorSelection.custom, FileSelection.custom,
SelectionData.custom: Update to use new string marshalling.
svn path=/trunk/gtk-sharp/; revision=15286
2003-06-10 18:09:47 +00:00
|
|
|
|
2002-02-18 19:26:33 +00:00
|
|
|
if (trim_type.StartsWith("const-")) return trim_type.Substring(6);
|
2002-02-03 03:44:10 +00:00
|
|
|
return trim_type;
|
|
|
|
}
|
|
|
|
|
2003-10-03 22:11:47 +00:00
|
|
|
private object DeAlias (string type)
|
2002-05-26 16:23:40 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
type = Trim (type);
|
2003-10-03 22:11:47 +00:00
|
|
|
while (types [type] is AliasGen) {
|
|
|
|
IGeneratable igen = types [type] as AliasGen;
|
|
|
|
types [type] = types [igen.Name];
|
|
|
|
type = igen.Name;
|
|
|
|
}
|
2002-05-26 16:23:40 +00:00
|
|
|
|
2003-10-03 22:11:47 +00:00
|
|
|
return types [type];
|
2002-05-26 16:23:40 +00:00
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public string FromNativeReturn(string c_type, string val)
|
2002-07-26 06:08:52 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
IGeneratable gen = this[c_type];
|
|
|
|
if (gen == null)
|
|
|
|
return "";
|
|
|
|
return gen.FromNativeReturn (val);
|
2002-07-26 06:08:52 +00:00
|
|
|
}
|
2003-05-29 Rachel Hestilow <rachel@nullenvoid.com>
* gconf/Value.cs: Update to use new string marshalling.
* generator/StringGen.cs, ConstStringGen.cs: Added.
* generator/IGeneratable.cs: Add new method ToNativeReturn.
* generator/CallbackGen.cs: Implement ToNativeReturn. Call
ToNativeReturn for the return statement. Fix a couple of
places where s_ret was being used incorrectly for m_ret.
* generator/ClassGen.cs, EnumGen.cs, ManualGen.cs,
SimpleGen.cs, StructBase.cs: Implement ToNativeReturn.
* generator/SignalHandler.cs: Call ToNativeReturn for the
return statement, instead of CallByName.
* generator/SymbolTable.cs: Use StringGen for gchar, char,
and gunichar, and ConstStringGen for their const variants.
Add a new method wrapper for ToNativeReturn.
(Trim): Add a special-case for const strings so that the
const is not stripped. Otherwise there is no way of
resolving the const case.
* glade/XML.custom: Update to use new string marshalling.
* glib/Marshaller.cs: Added.
* glib/GException.cs, Markup.cs, ObjectManager.cs,
Value.cs: Update to use new string marshalling.
* glib/Object.cs: Remove old g_type_name DllImport
as it is no longer used.
* glue/fileselection.c (gtksharp_file_selection_get_fileop_entry):
Mark this as const return.
* gtk/ColorSelection.custom, FileSelection.custom,
SelectionData.custom: Update to use new string marshalling.
svn path=/trunk/gtk-sharp/; revision=15286
2003-06-10 18:09:47 +00:00
|
|
|
|
|
|
|
public string ToNativeReturn(string c_type, string val)
|
|
|
|
{
|
|
|
|
IGeneratable gen = this[c_type];
|
|
|
|
if (gen == null)
|
|
|
|
return "";
|
|
|
|
return gen.ToNativeReturn (val);
|
|
|
|
}
|
2002-07-26 06:08:52 +00:00
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public string FromNative(string c_type, string val)
|
2002-07-26 06:08:52 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
IGeneratable gen = this[c_type];
|
|
|
|
if (gen == null)
|
|
|
|
return "";
|
|
|
|
return gen.FromNative (val);
|
2002-07-26 06:08:52 +00:00
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public string GetCSType(string c_type)
|
2002-02-08 23:56:27 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
IGeneratable gen = this[c_type];
|
|
|
|
if (gen == null)
|
2002-02-08 23:56:27 +00:00
|
|
|
return "";
|
2003-05-19 02:45:17 +00:00
|
|
|
return gen.QualifiedName;
|
2002-02-08 23:56:27 +00:00
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public string GetName(string c_type)
|
2002-01-05 12:45:55 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
IGeneratable gen = this[c_type];
|
|
|
|
if (gen == null)
|
2002-01-05 13:24:13 +00:00
|
|
|
return "";
|
2003-05-19 02:45:17 +00:00
|
|
|
return gen.Name;
|
2002-01-05 12:45:55 +00:00
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public string GetMarshalReturnType(string c_type)
|
2002-02-15 01:08:57 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
IGeneratable gen = this[c_type];
|
|
|
|
if (gen == null)
|
2002-02-15 01:08:57 +00:00
|
|
|
return "";
|
2003-05-19 02:45:17 +00:00
|
|
|
return gen.MarshalReturnType;
|
2002-02-15 01:08:57 +00:00
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public string GetMarshalType(string c_type)
|
2002-07-26 06:08:52 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
IGeneratable gen = this[c_type];
|
|
|
|
if (gen == null)
|
2002-01-12 02:08:16 +00:00
|
|
|
return "";
|
2003-05-19 02:45:17 +00:00
|
|
|
return gen.MarshalType;
|
2002-01-12 02:08:16 +00:00
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public string CallByName(string c_type, string var_name)
|
2002-02-06 20:09:14 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
IGeneratable gen = this[c_type];
|
|
|
|
if (gen == null)
|
2002-02-06 20:09:14 +00:00
|
|
|
return "";
|
2003-05-19 02:45:17 +00:00
|
|
|
return gen.CallByName(var_name);
|
2002-02-06 20:09:14 +00:00
|
|
|
}
|
2002-07-26 06:08:52 +00:00
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public bool IsOpaque(string c_type)
|
2002-07-26 06:08:52 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
if (this[c_type] is OpaqueGen)
|
|
|
|
return true;
|
|
|
|
|
2002-07-26 06:08:52 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public bool IsBoxed(string c_type)
|
2002-01-17 00:26:46 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
if (this[c_type] is BoxedGen)
|
|
|
|
return true;
|
|
|
|
|
2002-01-17 00:26:46 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public bool IsStruct(string c_type)
|
2002-07-14 01:32:18 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
if (this[c_type] is StructGen)
|
|
|
|
return true;
|
|
|
|
|
2002-07-14 01:32:18 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public bool IsEnum(string c_type)
|
2002-05-02 21:57:41 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
if (this[c_type] is EnumGen)
|
|
|
|
return true;
|
|
|
|
|
2002-05-02 21:57:41 +00:00
|
|
|
return false;
|
|
|
|
}
|
2002-08-03 22:24:37 +00:00
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public bool IsEnumFlags(string c_type)
|
2002-08-03 22:24:37 +00:00
|
|
|
{
|
2003-10-03 22:11:47 +00:00
|
|
|
EnumGen gen = this [c_type] as EnumGen;
|
|
|
|
return (gen != null && gen.Elem.GetAttribute ("type") == "flags");
|
2002-08-03 22:24:37 +00:00
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public bool IsInterface(string c_type)
|
2002-01-17 00:26:46 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
if (this[c_type] is InterfaceGen)
|
|
|
|
return true;
|
|
|
|
|
2002-01-17 00:26:46 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public ClassBase GetClassGen(string c_type)
|
2002-05-23 23:43:25 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
return this[c_type] as ClassBase;
|
2002-05-23 23:43:25 +00:00
|
|
|
}
|
2002-06-21 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: New base class for classes and interfaces.
* generator/InterfaceGen.cs: Inherit from ClassBase, generate declarations.
* generator/ObjectGen.cs: Move half of this into ClassBase.
* generator/Method.cs: Turn all applicable Get/Set functions into .NET
accessors. Remove redundant == overload and move into Equals, as
it was confusing "!= null".
* generator/Parameters.cs: Alter signature creation to accept "is_set"
option, add support for variable arguments. Add properties "Count",
"IsVarArgs", "VAType".
* generator/Ctor.cs: Fixup for changes in Parameters (indenting,
signature creation).
* generator/Signal.cs: Support generating declarations.
* generator/SymbolTable: Change GetObjectGen to GetClassGen.
* glib/IWrapper.cs: Move "Handle" declaration to here, so
both classes and interfaces can benefit from it.
* glib/Object.cs: Inherit from IWrapper.cs
* parser/Metadata.pm: Support attribute changes on constructors,
methods, signals, and paramater lists.
* parser/gapi2xml.pl: Parse init funcs for interfaces. Ignore "_"
functions here.
* parser/gapi_pp.pl: Remove boxed_type_register check, as it will
be caught in the init funcs.
* parser/Atk.metadata: Added.
* parser/Gtk.metadata: Add all needed signal/method collision
renames. Rename GtkEditable.Editable accessors to IsEditable,
as .NET does not like accessors with the same name as their
declaring type. Tag TreeStore constructor as varargs.
* samples/ButtonApp.cs: s/EmitAdd/Add.
* samples/Menu.cs: s/EmitAdd/Add, s/Activate/Activated.
svn path=/trunk/gtk-sharp/; revision=5394
2002-06-21 17:15:19 +00:00
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public bool IsObject(string c_type)
|
2002-01-12 02:08:16 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
if (this[c_type] is ObjectGen)
|
|
|
|
return true;
|
|
|
|
|
2002-01-12 02:08:16 +00:00
|
|
|
return false;
|
|
|
|
}
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public bool IsCallback(string c_type)
|
2002-07-31 19:18:37 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
if (this[c_type] is CallbackGen)
|
|
|
|
return true;
|
|
|
|
|
2002-07-31 19:18:37 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2003-05-19 02:45:17 +00:00
|
|
|
public bool IsManuallyWrapped(string c_type)
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
{
|
2003-05-19 02:45:17 +00:00
|
|
|
if (this[c_type] is ManualGen)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:49:29 +00:00
|
|
|
public string MangleName(string name)
|
|
|
|
{
|
|
|
|
switch (name) {
|
|
|
|
case "string":
|
|
|
|
return "str1ng";
|
|
|
|
case "event":
|
|
|
|
return "evnt";
|
|
|
|
case "null":
|
|
|
|
return "is_null";
|
|
|
|
case "object":
|
|
|
|
return "objekt";
|
|
|
|
case "params":
|
|
|
|
return "parms";
|
|
|
|
case "ref":
|
|
|
|
return "reference";
|
|
|
|
case "in":
|
|
|
|
return "in_param";
|
|
|
|
case "out":
|
|
|
|
return "out_param";
|
|
|
|
case "fixed":
|
|
|
|
return "mfixed";
|
|
|
|
case "byte":
|
|
|
|
return "_byte";
|
|
|
|
case "new":
|
|
|
|
return "_new";
|
|
|
|
case "base":
|
|
|
|
return "_base";
|
2003-12-17 15:27:34 +00:00
|
|
|
case "lock":
|
|
|
|
return "_lock";
|
|
|
|
case "callback":
|
|
|
|
return "cb";
|
2003-08-28 16:49:29 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
2002-01-05 12:45:55 +00:00
|
|
|
}
|
|
|
|
}
|