2002-01-05 12:45:55 +00:00
|
|
|
// GtkSharp.Generation.SymbolTable.cs - The Symbol Table Class.
|
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
2002-05-23 23:43:25 +00:00
|
|
|
// (c) 2001-2002 Mike Kestner
|
2002-01-05 12:45:55 +00:00
|
|
|
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
public class SymbolTable {
|
|
|
|
|
2002-05-26 16:23:40 +00:00
|
|
|
private static Hashtable alias = new Hashtable ();
|
2002-05-23 23:43:25 +00: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 08:36:05 +00:00
|
|
|
private static Hashtable manually_wrapped_types;
|
2002-05-23 23:43:25 +00:00
|
|
|
private static Hashtable dlls;
|
2002-01-05 12:45:55 +00:00
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
static SymbolTable ()
|
2002-01-05 13:24:13 +00:00
|
|
|
{
|
|
|
|
simple_types = new Hashtable ();
|
2002-02-08 23:56:27 +00:00
|
|
|
simple_types.Add ("void", "void");
|
2002-01-05 13:24:13 +00:00
|
|
|
simple_types.Add ("gboolean", "bool");
|
|
|
|
simple_types.Add ("gint", "int");
|
|
|
|
simple_types.Add ("guint", "uint");
|
|
|
|
simple_types.Add ("glong", "long");
|
2002-01-06 13:33:25 +00:00
|
|
|
simple_types.Add ("gshort", "short");
|
2002-01-05 13:24:13 +00:00
|
|
|
simple_types.Add ("guint32", "uint");
|
2002-04-04 16:20:53 +00: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 08:36:05 +00:00
|
|
|
simple_types.Add ("const-char", "string");
|
2002-04-04 16:20:53 +00:00
|
|
|
simple_types.Add ("gchar", "string");
|
2002-01-05 13:24:13 +00: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 13:33:25 +00:00
|
|
|
simple_types.Add ("gint32", "int");
|
|
|
|
simple_types.Add ("guint16", "ushort");
|
2002-01-05 13:24:13 +00:00
|
|
|
simple_types.Add ("guint1", "bool");
|
2002-04-04 16:20:53 +00:00
|
|
|
simple_types.Add ("gpointer", "System.IntPtr");
|
2002-01-05 13:24:13 +00: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 00:33:53 +00:00
|
|
|
simple_types.Add ("char", "string");
|
2002-01-05 13:24:13 +00:00
|
|
|
simple_types.Add ("double", "double");
|
2002-01-12 02:08:16 +00:00
|
|
|
simple_types.Add ("float", "float");
|
2002-04-04 16:20:53 +00:00
|
|
|
simple_types.Add ("gunichar", "string");
|
2002-01-05 13:24:13 +00:00
|
|
|
simple_types.Add ("uint1", "bool");
|
2002-04-04 16:20:53 +00:00
|
|
|
simple_types.Add ("GPtrArray", "System.IntPtr[]");
|
2002-01-08 20:05:47 +00:00
|
|
|
simple_types.Add ("GType", "int");
|
2002-06-20 01:45:13 +00:00
|
|
|
simple_types.Add ("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
|
|
|
|
simple_types.Add ("gsize", "uint");
|
|
|
|
simple_types.Add ("gssize", "int");
|
2002-01-05 13:24:13 +00:00
|
|
|
|
|
|
|
// FIXME: These ought to be handled properly.
|
2002-04-04 16:20:53 +00: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 15:01:31 +00:00
|
|
|
simple_types.Add ("GTypeModule", "GLib.Object");
|
2002-04-04 16:20:53 +00:00
|
|
|
simple_types.Add ("GHashTable", "System.IntPtr");
|
|
|
|
simple_types.Add ("va_list", "System.IntPtr");
|
|
|
|
simple_types.Add ("GParamSpec", "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 08:36:05 +00: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-17 23:44:56 +00:00
|
|
|
dlls = new Hashtable();
|
2002-03-28 21:16:43 +00: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 18:27:04 +00:00
|
|
|
dlls.Add("Gdk.Imaging", "gdk_pixbuf-2.0");
|
2002-03-28 21:16:43 +00:00
|
|
|
dlls.Add("Gtk", "gtk-x11-2.0");
|
2002-01-05 13:24:13 +00:00
|
|
|
}
|
|
|
|
|
2002-05-26 16:23:40 +00:00
|
|
|
public static void AddAlias (string name, string type)
|
|
|
|
{
|
|
|
|
type = type.TrimEnd(' ', '\t');
|
|
|
|
alias [name] = type;
|
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public static void AddType (IGeneratable gen)
|
2002-01-05 12:45:55 +00:00
|
|
|
{
|
|
|
|
complex_types [gen.CName] = gen;
|
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public static int Count {
|
2002-01-05 12:45:55 +00:00
|
|
|
get
|
|
|
|
{
|
|
|
|
return complex_types.Count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public static IEnumerable Generatables {
|
2002-03-08 22:40:00 +00:00
|
|
|
get {
|
|
|
|
return complex_types.Values;
|
|
|
|
}
|
2002-01-05 12:45:55 +00:00
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
private static string Trim(string type)
|
2002-02-03 03:44:10 +00:00
|
|
|
{
|
2002-04-04 16:20:53 +00:00
|
|
|
string trim_type = type.TrimEnd('*');
|
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;
|
|
|
|
}
|
|
|
|
|
2002-05-26 16:23:40 +00:00
|
|
|
private static string DeAlias (string type)
|
|
|
|
{
|
|
|
|
while (alias.ContainsKey(type))
|
|
|
|
type = (string) alias[type];
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public static string FromNative(string c_type, string val)
|
2002-02-08 23:56:27 +00:00
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
2002-05-26 16:23:40 +00:00
|
|
|
c_type = DeAlias(c_type);
|
2002-02-08 23:56:27 +00:00
|
|
|
if (simple_types.ContainsKey(c_type)) {
|
|
|
|
return val;
|
|
|
|
} else if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
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 08:36:05 +00: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-08 23:56:27 +00:00
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public static string GetCSType(string c_type)
|
2002-01-05 12:45:55 +00:00
|
|
|
{
|
2002-02-03 03:44:10 +00:00
|
|
|
c_type = Trim(c_type);
|
2002-05-26 16:23:40 +00:00
|
|
|
c_type = DeAlias(c_type);
|
2002-01-05 13:24:13 +00:00
|
|
|
if (simple_types.ContainsKey(c_type)) {
|
2002-04-04 16:20:53 +00:00
|
|
|
return (string) simple_types[c_type];
|
2002-01-05 13:24:13 +00: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 08:36:05 +00:00
|
|
|
} else if (manually_wrapped_types.ContainsKey(c_type)) {
|
|
|
|
return (string) manually_wrapped_types[c_type];
|
2002-01-05 13:24:13 +00:00
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
2002-01-05 12:45:55 +00:00
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public static string GetName(string c_type)
|
2002-02-15 01:08:57 +00:00
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
2002-05-26 16:23:40 +00: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 08:36:05 +00: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 01:08:57 +00: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-05-23 23:43:25 +00:00
|
|
|
public static string GetMarshalType(string c_type)
|
2002-01-12 02:08:16 +00:00
|
|
|
{
|
2002-02-06 20:09:14 +00:00
|
|
|
c_type = Trim(c_type);
|
2002-05-26 16:23:40 +00:00
|
|
|
c_type = DeAlias(c_type);
|
2002-01-12 02:08:16 +00:00
|
|
|
if (simple_types.ContainsKey(c_type)) {
|
2002-04-04 16:20:53 +00: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 08:36:05 +00:00
|
|
|
} else if (manually_wrapped_types.ContainsKey(c_type)) {
|
|
|
|
return "IntPtr";
|
2002-01-12 02:08:16 +00:00
|
|
|
} else if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
return gen.MarshalType;
|
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public static string CallByName(string c_type, string var_name)
|
2002-02-06 20:09:14 +00:00
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
2002-05-26 16:23:40 +00:00
|
|
|
c_type = DeAlias(c_type);
|
2002-02-06 20:09:14 +00: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 08:36:05 +00:00
|
|
|
} else if (manually_wrapped_types.ContainsKey(c_type)) {
|
|
|
|
return var_name + ".Handle";
|
2002-02-06 20:09:14 +00:00
|
|
|
} else if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
return gen.CallByName(var_name);
|
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public static bool IsBoxed(string c_type)
|
2002-01-17 00:26:46 +00:00
|
|
|
{
|
2002-02-15 01:08:57 +00:00
|
|
|
c_type = Trim(c_type);
|
2002-05-26 16:23:40 +00:00
|
|
|
c_type = DeAlias(c_type);
|
2002-01-17 00:26:46 +00:00
|
|
|
if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
if (gen is BoxedGen) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public static bool IsEnum(string c_type)
|
2002-05-02 21:57:41 +00:00
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
2002-05-26 16:23:40 +00:00
|
|
|
c_type = DeAlias(c_type);
|
2002-05-02 21:57:41 +00:00
|
|
|
if (complex_types.ContainsKey(c_type)) {
|
|
|
|
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
|
|
|
if (gen is EnumGen) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public static bool IsInterface(string c_type)
|
2002-01-17 00:26:46 +00:00
|
|
|
{
|
2002-02-15 01:08:57 +00:00
|
|
|
c_type = Trim(c_type);
|
2002-05-26 16:23:40 +00:00
|
|
|
c_type = DeAlias(c_type);
|
2002-01-17 00:26:46 +00: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 17:15:19 +00:00
|
|
|
public static ClassBase GetClassGen(string c_type)
|
2002-05-23 23:43:25 +00:00
|
|
|
{
|
|
|
|
c_type = Trim(c_type);
|
2002-05-26 16:23:40 +00:00
|
|
|
c_type = DeAlias(c_type);
|
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
|
|
|
if (IsInterface(c_type) || IsObject (c_type)) {
|
|
|
|
return (ClassBase) complex_types[c_type];
|
2002-05-23 23:43:25 +00:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
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
|
|
|
|
2002-05-23 23:43:25 +00:00
|
|
|
public static bool IsObject(string c_type)
|
2002-01-12 02:08:16 +00:00
|
|
|
{
|
2002-02-15 01:08:57 +00:00
|
|
|
c_type = Trim(c_type);
|
2002-05-26 16:23:40 +00:00
|
|
|
c_type = DeAlias(c_type);
|
2002-01-12 02:08:16 +00: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 08:36:05 +00: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 12:45:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|