2002-01-05 Mike Kestner <mkestner@speakeasy.net>
* generator/SymbolTable.cs : First pass at simple_types hash. svn path=/trunk/gtk-sharp/; revision=1860
This commit is contained in:
parent
02fa6a31e6
commit
43a19345ca
2 changed files with 46 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
2002-01-05 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* generator/SymbolTable.cs : First pass at simple_types hash.
|
||||
|
||||
2002-01-05 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* generator/*.cs : Move into GtkSharp.Generation namespace.
|
||||
|
|
|
@ -14,6 +14,40 @@ namespace GtkSharp.Generation {
|
|||
private Hashtable complex_types = new Hashtable ();
|
||||
private Hashtable simple_types;
|
||||
|
||||
public SymbolTable ()
|
||||
{
|
||||
simple_types = new Hashtable ();
|
||||
simple_types.Add ("gboolean", "bool");
|
||||
simple_types.Add ("gint", "int");
|
||||
simple_types.Add ("guint", "uint");
|
||||
simple_types.Add ("glong", "long");
|
||||
simple_types.Add ("guint32", "uint");
|
||||
simple_types.Add ("const-gchar", "String");
|
||||
simple_types.Add ("gchar", "String");
|
||||
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");
|
||||
simple_types.Add ("guint1", "bool");
|
||||
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");
|
||||
simple_types.Add ("double", "double");
|
||||
simple_types.Add ("gunichar", "String");
|
||||
simple_types.Add ("uint1", "bool");
|
||||
|
||||
// FIXME: These ought to be handled properly.
|
||||
simple_types.Add ("GSList", "IntPtr");
|
||||
simple_types.Add ("va_list", "IntPtr");
|
||||
simple_types.Add ("GParamSpec", "IntPtr");
|
||||
}
|
||||
|
||||
public void AddType (IGeneratable gen)
|
||||
{
|
||||
complex_types [gen.CName] = gen;
|
||||
|
@ -33,7 +67,14 @@ namespace GtkSharp.Generation {
|
|||
|
||||
public String GetCSType (String c_type)
|
||||
{
|
||||
return "";
|
||||
if (simple_types.ContainsKey(c_type)) {
|
||||
return (String) simple_types [c_type];
|
||||
} else if (complex_types.ContainsKey(c_type)) {
|
||||
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
||||
return gen.QualifiedName;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue