2002-01-05 13:45:55 +01:00
|
|
|
// GtkSharp.Generation.SymbolTable.cs - The Symbol Table Class.
|
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
2002-05-24 01:43:25 +02:00
|
|
|
// (c) 2001-2002 Mike Kestner
|
2002-01-05 13:45:55 +01:00
|
|
|
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
public class SymbolTable {
|
|
|
|
|
2002-05-26 18:23:40 +02:00
|
|
|
private static Hashtable alias = new Hashtable ();
|
2002-05-24 01:43:25 +02:00
|
|
|
private static Hashtable complex_types = new Hashtable ();
|
|
|
|
private static Hashtable simple_types;
|
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 10:36:05 +02:00
|
|
|
private static Hashtable manually_wrapped_types;
|
2002-05-24 01:43:25 +02:00
|
|
|
private static Hashtable dlls;
|
2002-01-05 13:45:55 +01:00
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
static SymbolTable ()
|
2002-01-05 14:24:13 +01:00
|
|
|
{
|
|
|
|
simple_types = new Hashtable ();
|
2002-02-09 00:56:27 +01:00
|
|
|
simple_types.Add ("void", "void");
|
2002-01-05 14:24:13 +01:00
|
|
|
simple_types.Add ("gboolean", "bool");
|
|
|
|
simple_types.Add ("gint", "int");
|
|
|
|
simple_types.Add ("guint", "uint");
|
|
|
|
simple_types.Add ("glong", "long");
|
2002-01-06 14:33:25 +01:00
|
|
|
simple_types.Add ("gshort", "short");
|
2002-07-31 01:02:12 +02:00
|
|
|
simple_types.Add ("gushort", "ushort");
|
2002-01-05 14:24:13 +01:00
|
|
|
simple_types.Add ("guint32", "uint");
|
2002-04-04 18:20:53 +02:00
|
|
|
simple_types.Add ("const-gchar", "string");
|
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 10:36:05 +02:00
|
|
|
simple_types.Add ("const-char", "string");
|
2002-04-04 18:20:53 +02:00
|
|
|
simple_types.Add ("gchar", "string");
|
2002-01-05 14:24:13 +01:00
|
|
|
simple_types.Add ("GObject", "GLib.Object");
|
|
|
|
simple_types.Add ("gfloat", "float");
|
|
|
|
simple_types.Add ("gdouble", "double");
|
|
|
|
simple_types.Add ("gint8", "byte");
|
|
|
|
simple_types.Add ("guint8", "byte");
|
|
|
|
simple_types.Add ("gint16", "short");
|
2002-01-06 14:33:25 +01:00
|
|
|
simple_types.Add ("gint32", "int");
|
|
|
|
simple_types.Add ("guint16", "ushort");
|
2002-01-05 14:24:13 +01:00
|
|
|
simple_types.Add ("guint1", "bool");
|
2002-04-04 18:20:53 +02:00
|
|
|
simple_types.Add ("gpointer", "System.IntPtr");
|
2002-01-05 14:24:13 +01:00
|
|
|
simple_types.Add ("guchar", "byte");
|
|
|
|
simple_types.Add ("GValue", "GLib.Value");
|
|
|
|
simple_types.Add ("GtkType", "int");
|
|
|
|
simple_types.Add ("long", "long");
|
|
|
|
simple_types.Add ("gulong", "ulong");
|
|
|
|
simple_types.Add ("GQuark", "int");
|
|
|
|
simple_types.Add ("int", "int");
|
2002-05-08 02:33:53 +02:00
|
|
|
simple_types.Add ("char", "string");
|
2002-01-05 14:24:13 +01:00
|
|
|
simple_types.Add ("double", "double");
|
2002-01-12 03:08:16 +01:00
|
|
|
simple_types.Add ("float", "float");
|
2002-04-04 18:20:53 +02:00
|
|
|
simple_types.Add ("gunichar", "string");
|
2002-01-05 14:24:13 +01:00
|
|
|
simple_types.Add ("uint1", "bool");
|
2002-04-04 18:20:53 +02:00
|
|
|
simple_types.Add ("GPtrArray", "System.IntPtr[]");
|
2002-01-08 21:05:47 +01:00
|
|
|
simple_types.Add ("GType", "int");
|
2002-06-20 03:45:13 +02:00
|
|
|
simple_types.Add ("GError", "IntPtr");
|
2002-07-02 05:35:07 +02:00
|
|
|
// gsize is a system-specific typedef in glibconfig.h,
|
|
|
|
// but this should work for now
|
|
|
|
simple_types.Add ("gsize", "uint");
|
|
|
|
simple_types.Add ("gssize", "int");
|
2002-01-05 14:24:13 +01:00
|
|
|
|
|
|
|
// FIXME: These ought to be handled properly.
|
2002-04-04 18:20:53 +02:00
|
|
|
simple_types.Add ("GList", "System.IntPtr");
|
|
|
|
simple_types.Add ("GMemChunk", "System.IntPtr");
|
|
|
|
simple_types.Add ("GTimeVal", "System.IntPtr");
|
|
|
|
simple_types.Add ("GClosure", "System.IntPtr");
|
|
|
|
simple_types.Add ("GArray", "System.IntPtr");
|
|
|
|
simple_types.Add ("GData", "System.IntPtr");
|
2002-01-10 16:01:31 +01:00
|
|
|
simple_types.Add ("GTypeModule", "GLib.Object");
|
2002-04-04 18:20:53 +02:00
|
|
|
simple_types.Add ("GHashTable", "System.IntPtr");
|
|
|
|
simple_types.Add ("va_list", "System.IntPtr");
|
|
|
|
simple_types.Add ("GParamSpec", "System.IntPtr");
|
2002-07-31 01:02:12 +02:00
|
|
|
simple_types.Add ("GdkAtom", "System.IntPtr");
|
|
|
|
simple_types.Add ("gconstpointer", "System.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 10:36:05 +02:00
|
|
|
|
|
|
|
manually_wrapped_types = new Hashtable ();
|
|
|
|
manually_wrapped_types.Add ("GdkEvent", "Gdk.Event");
|
|
|
|
manually_wrapped_types.Add ("GSList", "GLib.SList");
|
|
|
|
|
2002-01-17 Mike Kestner <mkestner@speakeasy.net>
* generator/BoxedGen.cs : Removed Name, CName, and QualifiedName.
* generator/ObjectGen.cs : Removed Name, CName, and QualifiedName.
* generator/StructBase.cs : Add Name, CName, and QualifiedName. Add
GenCtor method. Stub GetCallString, GetImportSig, and GetSignature
methods.
* generator/StructGen.cs : Removed Name, CName, and QualifiedName.
* generator/SymbolTable.cs : Add GetDllName method.
* parser/gapi2xml.pl : Fix a couple <parameters> bugs.
svn path=/trunk/gtk-sharp/; revision=2030
2002-01-18 00:44:56 +01:00
|
|
|
dlls = new Hashtable();
|
2002-03-28 22:16:43 +01:00
|
|
|
dlls.Add("Pango", "pango-1.0");
|
|
|
|
dlls.Add("Atk", "atk-1.0");
|
|
|
|
dlls.Add("Gdk", "gdk-x11-2.0");
|
2002-06-14 Rachel Hestilow <hestilow@ximian.com>
* glib/GException.cs: Added.
* generator/Ctor.cs, Method.cs: Tag function as unsafe if it throws
an exception. Call parms.HandleException.
* generator/Paramaters.cs: Add property ThrowsException (based
on a trailing GError**). If ThrowsException, mask GError in the
signature, initialize a GError in Initialize, and add new method
HandleException to throw an exception if error != null.
* generator/SymbolTable.cs: Add gdk-pixbuf DLL, and GError type.
* gdk.imaging, gdk.imaging/Makefile.in, gdk.imaging/makefile.win32:
Added.
* configure.in, Makefile, makefile.win32: Build gdk.imaging.
* gtk/Makefile.in, gtk/makefile.win32: Link against gdk.imaging.
* parser/gapi2xml.pl: Support namespace renaming.
* parser/build.pl: Build gdk-pixbuf as gdk.imaging.
svn path=/trunk/gtk-sharp/; revision=5281
2002-06-14 20:27:04 +02:00
|
|
|
dlls.Add("Gdk.Imaging", "gdk_pixbuf-2.0");
|
2002-03-28 22:16:43 +01:00
|
|
|
dlls.Add("Gtk", "gtk-x11-2.0");
|
2002-01-05 14:24:13 +01:00
|
|
|
}
|
|
|
|
|
2002-05-26 18:23:40 +02:00
|
|
|
public static void AddAlias (string name, string type)
|
|
|
|
{
|
|
|
|
type = type.TrimEnd(' ', '\t');
|
|
|
|
alias [name] = type;
|
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static void AddType (IGeneratable gen)
|
2002-01-05 13:45:55 +01:00
|
|
|
{
|
|
|
|
complex_types [gen.CName] = gen;
|
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static int Count {
|
2002-01-05 13:45:55 +01:00
|
|
|
get
|
|
|
|
{
|
|
|
|
return complex_types.Count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static IEnumerable Generatables {
|
2002-03-08 23:40:00 +01:00
|
|
|
get {
|
|
|
|
return complex_types.Values;
|
|
|
|
}
|
2002-01-05 13:45:55 +01:00
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
private static string Trim(string type)
|
2002-02-03 04:44:10 +01:00
|
|
|
{
|
2002-04-04 18:20:53 +02:00
|
|
|
string trim_type = type.TrimEnd('*');
|
2002-02-18 20:26:33 +01:00
|
|
|
if (trim_type.StartsWith("const-")) return trim_type.Substring(6);
|
2002-02-03 04:44:10 +01:00
|
|
|
return trim_type;
|
|
|
|
}
|
|
|
|
|
2002-05-26 18:23:40 +02:00
|
|
|
private static string DeAlias (string type)
|
|
|
|
{
|
|
|
|
while (alias.ContainsKey(type))
|
|
|
|
type = (string) alias[type];
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2002-07-26 08:08:52 +02:00
|
|
|
public static string FromNativeReturn(string c_type, string val)
|
|
|
|
{
|
|
|
|
return FromNative (c_type, val, true);
|
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static string FromNative(string c_type, string val)
|
2002-07-26 08:08:52 +02:00
|
|
|
{
|
|
|
|
return FromNative (c_type, val, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static string FromNative(string c_type, string val, bool ret)
|
2002-02-09 00:56:27 +01:00
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
2002-05-26 18:23:40 +02:00
|
|
|
c_type = DeAlias(c_type);
|
2002-02-09 00:56:27 +01:00
|
|
|
if (simple_types.ContainsKey(c_type)) {
|
|
|
|
return val;
|
|
|
|
} else if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
2002-07-26 08:08:52 +02:00
|
|
|
if (ret)
|
|
|
|
return gen.FromNativeReturn(val);
|
|
|
|
else
|
|
|
|
return gen.FromNative(val);
|
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 10:36:05 +02:00
|
|
|
} else if (manually_wrapped_types.ContainsKey(c_type)) {
|
|
|
|
// FIXME: better way of handling this?
|
|
|
|
if (c_type == "GSList") {
|
|
|
|
return "new GLib.SList (" + val + ")";
|
|
|
|
} else {
|
|
|
|
return "(" + GetCSType (c_type) + ") GLib.Object.GetObject(" + val + ")";
|
|
|
|
}
|
2002-02-09 00:56:27 +01:00
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static string GetCSType(string c_type)
|
2002-01-05 13:45:55 +01:00
|
|
|
{
|
2002-02-03 04:44:10 +01:00
|
|
|
c_type = Trim(c_type);
|
2002-05-26 18:23:40 +02:00
|
|
|
c_type = DeAlias(c_type);
|
2002-01-05 14:24:13 +01:00
|
|
|
if (simple_types.ContainsKey(c_type)) {
|
2002-04-04 18:20:53 +02:00
|
|
|
return (string) simple_types[c_type];
|
2002-01-05 14:24:13 +01:00
|
|
|
} else if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
return gen.QualifiedName;
|
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 10:36:05 +02:00
|
|
|
} else if (manually_wrapped_types.ContainsKey(c_type)) {
|
|
|
|
return (string) manually_wrapped_types[c_type];
|
2002-01-05 14:24:13 +01:00
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
2002-01-05 13:45:55 +01:00
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static string GetName(string c_type)
|
2002-02-15 02:08:57 +01:00
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
2002-05-26 18:23:40 +02:00
|
|
|
c_type = DeAlias(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 10:36:05 +02:00
|
|
|
if (simple_types.ContainsKey(c_type) || manually_wrapped_types.ContainsKey(c_type)) {
|
|
|
|
string stype;
|
|
|
|
if (simple_types.ContainsKey(c_type))
|
|
|
|
stype = (string) simple_types[c_type];
|
|
|
|
else
|
|
|
|
stype = (string) manually_wrapped_types[c_type];
|
2002-02-15 02:08:57 +01:00
|
|
|
int dotidx = stype.IndexOf(".");
|
|
|
|
if (dotidx == -1) {
|
|
|
|
return stype;
|
|
|
|
} else {
|
|
|
|
return stype.Substring(dotidx+1);
|
|
|
|
}
|
|
|
|
} else if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
return gen.Name;
|
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-26 08:08:52 +02:00
|
|
|
public static string GetMarshalReturnType(string c_type)
|
|
|
|
{
|
|
|
|
return GetMarshalType (c_type, true);
|
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static string GetMarshalType(string c_type)
|
2002-07-26 08:08:52 +02:00
|
|
|
{
|
|
|
|
return GetMarshalType (c_type, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static string GetMarshalType(string c_type, bool ret)
|
2002-01-12 03:08:16 +01:00
|
|
|
{
|
2002-02-06 21:09:14 +01:00
|
|
|
c_type = Trim(c_type);
|
2002-05-26 18:23:40 +02:00
|
|
|
c_type = DeAlias(c_type);
|
2002-01-12 03:08:16 +01:00
|
|
|
if (simple_types.ContainsKey(c_type)) {
|
2002-04-04 18:20:53 +02:00
|
|
|
return (string) simple_types[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 10:36:05 +02:00
|
|
|
} else if (manually_wrapped_types.ContainsKey(c_type)) {
|
|
|
|
return "IntPtr";
|
2002-01-12 03:08:16 +01:00
|
|
|
} else if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
2002-07-26 08:08:52 +02:00
|
|
|
if (ret)
|
|
|
|
return gen.MarshalReturnType;
|
|
|
|
else
|
|
|
|
return gen.MarshalType;
|
2002-01-12 03:08:16 +01:00
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static string CallByName(string c_type, string var_name)
|
2002-02-06 21:09:14 +01:00
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
2002-05-26 18:23:40 +02:00
|
|
|
c_type = DeAlias(c_type);
|
2002-02-06 21:09:14 +01:00
|
|
|
if (simple_types.ContainsKey(c_type)) {
|
|
|
|
return var_name;
|
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 10:36:05 +02:00
|
|
|
} else if (manually_wrapped_types.ContainsKey(c_type)) {
|
|
|
|
return var_name + ".Handle";
|
2002-02-06 21:09:14 +01:00
|
|
|
} else if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
return gen.CallByName(var_name);
|
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
2002-07-26 08:08:52 +02:00
|
|
|
|
|
|
|
public static bool IsOpaque(string c_type)
|
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
|
|
|
c_type = DeAlias(c_type);
|
|
|
|
if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
if (gen is OpaqueGen) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static bool IsBoxed(string c_type)
|
2002-01-17 01:26:46 +01:00
|
|
|
{
|
2002-02-15 02:08:57 +01:00
|
|
|
c_type = Trim(c_type);
|
2002-05-26 18:23:40 +02:00
|
|
|
c_type = DeAlias(c_type);
|
2002-01-17 01:26:46 +01:00
|
|
|
if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
if (gen is BoxedGen) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-07-14 03:32:18 +02:00
|
|
|
public static bool IsStruct(string c_type)
|
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
|
|
|
c_type = DeAlias(c_type);
|
|
|
|
if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
if (gen is StructGen) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static bool IsEnum(string c_type)
|
2002-05-02 23:57:41 +02:00
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
2002-05-26 18:23:40 +02:00
|
|
|
c_type = DeAlias(c_type);
|
2002-05-02 23:57:41 +02:00
|
|
|
if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
if (gen is EnumGen) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static bool IsInterface(string c_type)
|
2002-01-17 01:26:46 +01:00
|
|
|
{
|
2002-02-15 02:08:57 +01:00
|
|
|
c_type = Trim(c_type);
|
2002-05-26 18:23:40 +02:00
|
|
|
c_type = DeAlias(c_type);
|
2002-01-17 01:26:46 +01:00
|
|
|
if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
if (gen is InterfaceGen) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
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 19:15:19 +02:00
|
|
|
public static ClassBase GetClassGen(string c_type)
|
2002-05-24 01:43:25 +02:00
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
2002-05-26 18:23:40 +02:00
|
|
|
c_type = DeAlias(c_type);
|
2002-07-26 08:08:52 +02:00
|
|
|
return (complex_types[c_type] as ClassBase);
|
2002-05-24 01:43:25 +02: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 19:15:19 +02:00
|
|
|
|
2002-05-24 01:43:25 +02:00
|
|
|
public static bool IsObject(string c_type)
|
2002-01-12 03:08:16 +01:00
|
|
|
{
|
2002-02-15 02:08:57 +01:00
|
|
|
c_type = Trim(c_type);
|
2002-05-26 18:23:40 +02:00
|
|
|
c_type = DeAlias(c_type);
|
2002-01-12 03:08:16 +01:00
|
|
|
if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
if (gen is ObjectGen) {
|
|
|
|
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 10:36:05 +02:00
|
|
|
|
2002-07-31 21:18:37 +02:00
|
|
|
public static bool IsCallback(string c_type)
|
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
|
|
|
c_type = DeAlias(c_type);
|
|
|
|
if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
if (gen is CallbackGen) {
|
|
|
|
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 10:36:05 +02:00
|
|
|
public static bool IsManuallyWrapped(string c_type)
|
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
|
|
|
c_type = DeAlias(c_type);
|
|
|
|
return manually_wrapped_types.ContainsKey(c_type);
|
|
|
|
}
|
|
|
|
|
2002-01-05 13:45:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|