diff --git a/ChangeLog b/ChangeLog index 225d984ea..4b8aa0be8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2005-02-17 Dan Winship + + * generator/Field.cs (Validate): new, to check that a field has a + valid type (or is hidden). + + * generator/StructBase.cs (Validate): new, to check that all of + the struct fields have valid types + + * generator/BoxedGen.cs (Generate): + * generator/StructGen.cs: (Generate): Call Validate() and bail out + if it fails; it's no good to generate a struct with the wrong + layout. + + * gdk/gdk-symbols.xml: add a line for GdkKey -> Gdk.Key. (There's + no actual C type GdkKey, but we can use metadata to change uints + to GdkKeys, which will then become Gdk.Keys.) + + * gtk/AccelKey.custom: remove the "Key" field (which was being + added in the wrong place in the struct), since it's properly + generated now. + + * gtk/Gtk.metadata: Fix the line that renames AccelKey.AccelKey + to AccelKey.Key + + * gnomevfs/Gnomevfs.metadata: hide the (mis-parsed) "action" field + in MimeAction, leaving the struct in the same broken state it was + in with the old generator code + + * parser/gapi2xml.pl: add a hack to allow "foo_bar_get_type()" + rather than "FOO_TYPE_BAR" in G_TYPE_CHECK_INSTANCE_CAST macros, + allowing large parts of libgda that were previously misparsed to + be parsed correctly + + * gda/gda-api.raw: Regen + + * gda/Gda.metadata: Make Gda.Value opaque, since it's mostly a + union and we're horribly butchering its layout. + 2005-02-22 Raja R Harinath * Makefile.include: Use $(top_builddir)/ instead of ../ so that it diff --git a/gdk/gdk-symbols.xml b/gdk/gdk-symbols.xml index b3e18f5f2..7656f1d24 100644 --- a/gdk/gdk-symbols.xml +++ b/gdk/gdk-symbols.xml @@ -20,5 +20,6 @@ + diff --git a/generator/BoxedGen.cs b/generator/BoxedGen.cs index ce60b8904..0e9194cf0 100644 --- a/generator/BoxedGen.cs +++ b/generator/BoxedGen.cs @@ -31,6 +31,9 @@ namespace GtkSharp.Generation { public override void Generate (GenerationInfo gen_info) { + if (!Validate ()) + return; + StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name); base.Generate (gen_info); sw.WriteLine ("\t\t[DllImport(\"glibsharpglue-2\")]"); diff --git a/generator/Field.cs b/generator/Field.cs index 3f12c7565..1b41e576c 100644 --- a/generator/Field.cs +++ b/generator/Field.cs @@ -147,16 +147,20 @@ namespace GtkSharp.Generation { } } - public bool Generate (StreamWriter sw) + public bool Validate () { - if (Hidden) - return true; - - if (CSType == "") { - Console.WriteLine ("Field has unknown Type {0}", CType); + if (CSType == "" && !Hidden) { + Console.Write ("Field has unknown Type {0} ", CType); Statistics.ThrottledCount++; return false; } + return true; + } + + public void Generate (StreamWriter sw) + { + if (Hidden) + return; SymbolTable table = SymbolTable.Table; @@ -218,8 +222,6 @@ namespace GtkSharp.Generation { } else { sw.WriteLine ("\t\tpublic {0} {1};", CSType, StudlyName); } - - return true; } } } diff --git a/generator/StructBase.cs b/generator/StructBase.cs index ea84bb667..1dd74a3f8 100644 --- a/generator/StructBase.cs +++ b/generator/StructBase.cs @@ -1,4 +1,4 @@ -// GtkSharp.Generation.StructBase.cs - The Structure/Object Base Class. +// GtkSharp.Generation.StructBase.cs - The Structure/Boxed Base Class. // // Author: Mike Kestner // @@ -40,7 +40,7 @@ namespace GtkSharp.Generation { switch (node.Name) { case "field": - fields.Add (member); + fields.Add (new Field (member)); break; case "callback": @@ -116,8 +116,7 @@ namespace GtkSharp.Generation { { Field.bitfields = 0; bool need_field = true; - foreach (XmlElement field_elem in fields) { - Field field = new Field (field_elem); + foreach (Field field in fields) { if (field.IsBit) { if (need_field) need_field = false; @@ -129,6 +128,18 @@ namespace GtkSharp.Generation { } } + public bool Validate () + { + foreach (Field field in fields) { + if (!field.Validate ()) { + Console.WriteLine ("in Struct " + QualifiedName); + return false; + } + } + + return true; + } + public override void Generate (GenerationInfo gen_info) { bool need_close = false; diff --git a/generator/StructGen.cs b/generator/StructGen.cs index 63635a384..b44cdd43b 100644 --- a/generator/StructGen.cs +++ b/generator/StructGen.cs @@ -31,6 +31,9 @@ namespace GtkSharp.Generation { public override void Generate (GenerationInfo gen_info) { + if (!Validate ()) + return; + StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name); base.Generate (gen_info); if (GetMethod ("GetType") == null && GetMethod ("GetGType") == null) { diff --git a/gnomevfs/Gnomevfs.metadata b/gnomevfs/Gnomevfs.metadata index cb750deae..7332c165a 100644 --- a/gnomevfs/Gnomevfs.metadata +++ b/gnomevfs/Gnomevfs.metadata @@ -85,6 +85,7 @@ 1 1 MimeAction + 1 MimeApplication 1 1 diff --git a/gtk/AccelKey.custom b/gtk/AccelKey.custom index 1b5e4a948..3730e00b6 100644 --- a/gtk/AccelKey.custom +++ b/gtk/AccelKey.custom @@ -13,8 +13,6 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. -public Gdk.Key Key; - public AccelKey (Gdk.Key key, Gdk.ModifierType mods, Gtk.AccelFlags flags) { this.Key = key; diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index b0ef7738a..fb66add5a 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -1,7 +1,7 @@ GdkKey - key + Key GdkModifierType GtkAccelFlags 1