[Gtk-sharp-list] Changes to gapi_generator to support gtkmozembed
Mark Crichton
crichton@gimp.org
Thu, 13 Feb 2003 12:53:14 -0500
--uZ3hkaAS1mZxFaxD
Content-Type: multipart/mixed; boundary="45Z9DzgjV8m4Oswq"
Content-Disposition: inline
--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
* Mike Kestner (mkestner@speakeasy.net) [030114 22:21]:
> I recall approving the SignalHandler changes, and I don't think we ever
> saw the parser patch.
Ugly patch attached. Warning, may cause fits of madness, but it works
in the case where you have added types to enums.
Mark
--45Z9DzgjV8m4Oswq
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="parser.diff"
Content-Transfer-Encoding: quoted-printable
diff -u -r1.15 EnumGen.cs
--- generator/EnumGen.cs 5 Jan 2003 23:51:37 -0000 1.15
+++ generator/EnumGen.cs 13 Feb 2003 17:38:41 -0000
@@ -61,9 +61,35 @@
if (Elem.GetAttribute("type") =3D=3D "flags") =0D
sw.WriteLine ("\t[Flags]");=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
sw.WriteLine ("#region Autogenerated code");=0D
- =0D
- sw.WriteLine ("\tpublic enum " + Name + " {");=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
--45Z9DzgjV8m4Oswq--
--uZ3hkaAS1mZxFaxD
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (SunOS)
iD8DBQE+S9uJOfj2Ja/u/oARAjgVAKC7AVIcVq1xbDWqkxTB1uCaQa9ltQCgritV
83/EbSV8kW2wViJ/rwa6fnQ=
=vz2u
-----END PGP SIGNATURE-----
--uZ3hkaAS1mZxFaxD--