mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-16 19:44:45 +02:00
* 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 svn path=/trunk/gtk-sharp/; revision=41104
This commit is contained in:
parent
65edda888f
commit
eb4269562f
38
ChangeLog
38
ChangeLog
@ -1,3 +1,41 @@
|
|||||||
|
2005-02-17 Dan Winship <danw@novell.com>
|
||||||
|
|
||||||
|
* 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 <rharinath@novell.com>
|
2005-02-22 Raja R Harinath <rharinath@novell.com>
|
||||||
|
|
||||||
* Makefile.include: Use $(top_builddir)/ instead of ../ so that it
|
* Makefile.include: Use $(top_builddir)/ instead of ../ so that it
|
||||||
|
@ -20,5 +20,6 @@
|
|||||||
<symbol type="manual" cname="GdkEventSetting" name="Gdk.EventSetting"/>
|
<symbol type="manual" cname="GdkEventSetting" name="Gdk.EventSetting"/>
|
||||||
<symbol type="manual" cname="GdkEventVisibility" name="Gdk.EventVisibility"/>
|
<symbol type="manual" cname="GdkEventVisibility" name="Gdk.EventVisibility"/>
|
||||||
<symbol type="manual" cname="GdkEventWindowState" name="Gdk.EventWindowState"/>
|
<symbol type="manual" cname="GdkEventWindowState" name="Gdk.EventWindowState"/>
|
||||||
|
<symbol type="simple" cname="GdkKey" name="Gdk.Key"/>
|
||||||
</api>
|
</api>
|
||||||
|
|
||||||
|
@ -31,6 +31,9 @@ namespace GtkSharp.Generation {
|
|||||||
|
|
||||||
public override void Generate (GenerationInfo gen_info)
|
public override void Generate (GenerationInfo gen_info)
|
||||||
{
|
{
|
||||||
|
if (!Validate ())
|
||||||
|
return;
|
||||||
|
|
||||||
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
|
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
|
||||||
base.Generate (gen_info);
|
base.Generate (gen_info);
|
||||||
sw.WriteLine ("\t\t[DllImport(\"glibsharpglue-2\")]");
|
sw.WriteLine ("\t\t[DllImport(\"glibsharpglue-2\")]");
|
||||||
|
@ -147,16 +147,20 @@ namespace GtkSharp.Generation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Generate (StreamWriter sw)
|
public bool Validate ()
|
||||||
{
|
{
|
||||||
if (Hidden)
|
if (CSType == "" && !Hidden) {
|
||||||
return true;
|
Console.Write ("Field has unknown Type {0} ", CType);
|
||||||
|
|
||||||
if (CSType == "") {
|
|
||||||
Console.WriteLine ("Field has unknown Type {0}", CType);
|
|
||||||
Statistics.ThrottledCount++;
|
Statistics.ThrottledCount++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Generate (StreamWriter sw)
|
||||||
|
{
|
||||||
|
if (Hidden)
|
||||||
|
return;
|
||||||
|
|
||||||
SymbolTable table = SymbolTable.Table;
|
SymbolTable table = SymbolTable.Table;
|
||||||
|
|
||||||
@ -218,8 +222,6 @@ namespace GtkSharp.Generation {
|
|||||||
} else {
|
} else {
|
||||||
sw.WriteLine ("\t\tpublic {0} {1};", CSType, StudlyName);
|
sw.WriteLine ("\t\tpublic {0} {1};", CSType, StudlyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 <mkestner@speakeasy.net>
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||||
//
|
//
|
||||||
@ -40,7 +40,7 @@ namespace GtkSharp.Generation {
|
|||||||
|
|
||||||
switch (node.Name) {
|
switch (node.Name) {
|
||||||
case "field":
|
case "field":
|
||||||
fields.Add (member);
|
fields.Add (new Field (member));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "callback":
|
case "callback":
|
||||||
@ -116,8 +116,7 @@ namespace GtkSharp.Generation {
|
|||||||
{
|
{
|
||||||
Field.bitfields = 0;
|
Field.bitfields = 0;
|
||||||
bool need_field = true;
|
bool need_field = true;
|
||||||
foreach (XmlElement field_elem in fields) {
|
foreach (Field field in fields) {
|
||||||
Field field = new Field (field_elem);
|
|
||||||
if (field.IsBit) {
|
if (field.IsBit) {
|
||||||
if (need_field)
|
if (need_field)
|
||||||
need_field = false;
|
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)
|
public override void Generate (GenerationInfo gen_info)
|
||||||
{
|
{
|
||||||
bool need_close = false;
|
bool need_close = false;
|
||||||
|
@ -31,6 +31,9 @@ namespace GtkSharp.Generation {
|
|||||||
|
|
||||||
public override void Generate (GenerationInfo gen_info)
|
public override void Generate (GenerationInfo gen_info)
|
||||||
{
|
{
|
||||||
|
if (!Validate ())
|
||||||
|
return;
|
||||||
|
|
||||||
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
|
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
|
||||||
base.Generate (gen_info);
|
base.Generate (gen_info);
|
||||||
if (GetMethod ("GetType") == null && GetMethod ("GetGType") == null) {
|
if (GetMethod ("GetType") == null && GetMethod ("GetGType") == null) {
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
<attr path="/api/namespace/struct[@cname='GnomeVFSInetConnection']" name="hidden">1</attr>
|
<attr path="/api/namespace/struct[@cname='GnomeVFSInetConnection']" name="hidden">1</attr>
|
||||||
<attr path="/api/namespace/struct[@cname='GnomeVFSMethod']" name="hidden">1</attr>
|
<attr path="/api/namespace/struct[@cname='GnomeVFSMethod']" name="hidden">1</attr>
|
||||||
<attr path="/api/namespace/struct[@cname='GnomeVFSMimeAction']" name="name">MimeAction</attr>
|
<attr path="/api/namespace/struct[@cname='GnomeVFSMimeAction']" name="name">MimeAction</attr>
|
||||||
|
<attr path="/api/namespace/struct[@cname='GnomeVFSMimeAction']/field[@cname='action']" name="hidden">1</attr>
|
||||||
<attr path="/api/namespace/struct[@cname='GnomeVFSMimeApplication']" name="name">MimeApplication</attr>
|
<attr path="/api/namespace/struct[@cname='GnomeVFSMimeApplication']" name="name">MimeApplication</attr>
|
||||||
<attr path="/api/namespace/struct[@cname='GnomeVFSMimeSniffBuffer']" name="hidden">1</attr>
|
<attr path="/api/namespace/struct[@cname='GnomeVFSMimeSniffBuffer']" name="hidden">1</attr>
|
||||||
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackAdditionalHeadersIn']" name="hidden">1</attr>
|
<attr path="/api/namespace/struct[@cname='GnomeVFSModuleCallbackAdditionalHeadersIn']" name="hidden">1</attr>
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
// Boston, MA 02111-1307, USA.
|
// Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
public Gdk.Key Key;
|
|
||||||
|
|
||||||
public AccelKey (Gdk.Key key, Gdk.ModifierType mods, Gtk.AccelFlags flags)
|
public AccelKey (Gdk.Key key, Gdk.ModifierType mods, Gtk.AccelFlags flags)
|
||||||
{
|
{
|
||||||
this.Key = key;
|
this.Key = key;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<metadata>
|
<metadata>
|
||||||
<attr path="/api/namespace/struct[@cname='GtkAccelKey']/field[@cname='accel_key']" name="type">GdkKey</attr>
|
<attr path="/api/namespace/struct[@cname='GtkAccelKey']/field[@cname='accel_key']" name="type">GdkKey</attr>
|
||||||
<attr path="/api/namespace/struct[@cname='GtkAccelKey']/field[@cname='key']" name="cname">key</attr>
|
<attr path="/api/namespace/struct[@cname='GtkAccelKey']/field[@cname='accel_key']" name="name">Key</attr>
|
||||||
<attr path="/api/namespace/struct[@cname='GtkAccelKey']/field[@cname='accel_mods']" name="type">GdkModifierType</attr>
|
<attr path="/api/namespace/struct[@cname='GtkAccelKey']/field[@cname='accel_mods']" name="type">GdkModifierType</attr>
|
||||||
<attr path="/api/namespace/struct[@cname='GtkAccelKey']/field[@cname='accel_flags']" name="type">GtkAccelFlags</attr>
|
<attr path="/api/namespace/struct[@cname='GtkAccelKey']/field[@cname='accel_flags']" name="type">GtkAccelFlags</attr>
|
||||||
<attr path="/api/namespace/struct[@cname='GtkActionEntry']" name="hidden">1</attr>
|
<attr path="/api/namespace/struct[@cname='GtkActionEntry']" name="hidden">1</attr>
|
||||||
|
Loading…
Reference in New Issue
Block a user