[Gtk-sharp-list] Changes to gapi_generator to support gtkmozembed
Mark Crichton
crichton@gimp.org
Thu, 12 Dec 2002 01:04:41 -0500
--/WwmFnJnmDyWGHa4
Content-Type: multipart/mixed; boundary="J2SCkAp4GZ/dPZZf"
Content-Disposition: inline
--J2SCkAp4GZ/dPZZf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Ok, here is a patch to fix some of the bugs/patch up some shortcomings
in the gapi_generator w.r.t. gtkmozembed.
A large part of the patch handles the strange enums in the gtkmozembed
widget. On second thought, the way I hack around it is not the right
way of doing things...expect a parser patch Real Soon.
The SignalHandler.cs changes, however, are necessary.
With these changes, we have a mostly working C# web browser. Yea.
Thanks,
Mark Crichton
--J2SCkAp4GZ/dPZZf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="gen.patch"
Content-Transfer-Encoding: quoted-printable
? gen.patch
Index: EnumGen.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/generator/EnumGen.cs,v
retrieving revision 1.14
diff -u -r1.14 EnumGen.cs
--- EnumGen.cs 20 Aug 2002 19:56:14 -0000 1.14
+++ EnumGen.cs 12 Dec 2002 05:49:03 -0000
@@ -60,8 +60,35 @@
=0D
if (Elem.GetAttribute("type") =3D=3D "flags") =0D
sw.WriteLine ("\t[Flags]");=0D
- =0D
- sw.WriteLine ("\tpublic enum " + Name + " {");=0D
+=0D
+ // Ok, this is obscene. We need to go through the enums first=0D
+ // to find "large" values. If we find some, we need to change=0D
+ // the base type of the enum.=0D
+=0D
+ string enum_type =3D null;=0D
+=0D
+ foreach (XmlNode node in Elem.ChildNodes) {=0D
+ if (!(node is XmlElement) || node.Name !=3D "member") {=0D
+ continue;=0D
+ }=0D
+=0D
+ XmlElement member =3D (XmlElement) node;=0D
+=0D
+ if (member.HasAttribute("value")) {=0D
+ string value =3D member.GetAttribute("value");=0D
+ if (value.EndsWith("U")) {=0D
+ enum_type =3D "uint";=0D
+ member.SetAttribute("value", value.TrimEnd('U'));=0D
+ }=0D
+ }=0D
+ }=0D
+ =0D
+ =0D
+ if (enum_type !=3D null)=0D
+ sw.WriteLine ("\tpublic enum " + Name + " : " + enum_type + " {");=0D
+ else=0D
+ sw.WriteLine ("\tpublic enum " + Name + " {");=0D
+=0D
sw.WriteLine ();=0D
=0D
foreach (XmlNode node in Elem.ChildNodes) {=0D
Index: SignalHandler.cs
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/public/gtk-sharp/generator/SignalHandler.cs,v
retrieving revision 1.18
diff -u -r1.18 SignalHandler.cs
--- SignalHandler.cs 10 Nov 2002 10:03:50 -0000 1.18
+++ SignalHandler.cs 12 Dec 2002 05:49:03 -0000
@@ -109,7 +109,7 @@
sw.WriteLine();
sw.WriteLine("\t\tprivate static " + dname + " _Delegate;");
sw.WriteLine();
- sw.Write("\t\tprivate static " + s_ret + " ");
+ sw.Write("\t\tprivate static " + p_ret + " ");
sw.WriteLine(cbname + "(" + pinv + ", int key)");
sw.WriteLine("\t\t{");
sw.WriteLine("\t\t\tif (!_Instances.Contains(key))");
@@ -157,7 +157,12 @@
else
sw.WriteLine ("\t\t\t\tthrow new Exception(\"args.RetVal unset in ca=
llback\");");
=20
- sw.WriteLine("\t\t\treturn (" + s_ret + ") args.RetVal;");
+ sw.Write ("\t\treturn (" + p_ret + ") ");
+ if (SymbolTable.IsObject (retval))
+ sw.WriteLine ("((GLib.Object) args.RetVal).Handle;");
+ else
+ sw.WriteLine ("args.RetVal;");
+
}
sw.WriteLine("\t\t}");
sw.WriteLine();
--J2SCkAp4GZ/dPZZf--
--/WwmFnJnmDyWGHa4
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (SunOS)
iD8DBQE9+Cb4Ofj2Ja/u/oARAqegAJ9QwWBrLUADdENybWv55q4Hv/5PjwCgwrf5
giL90OnLYkb+Ih2sdaI1yIs=
=4T6a
-----END PGP SIGNATURE-----
--/WwmFnJnmDyWGHa4--