G_TYPE_FLAG_ABSTRACT patch

Jean-Yves Lefort <[email protected]> Fri, 2 Dec 2005 13:51:24 +0100
Newsgroups gmane.comp.gnome.devtools.gob.general
Message-ID <[email protected]>
--Signature=_Fri__2_Dec_2005_13_51_24_+0100_v_/YktFZEVaIQpmO
Content-Type: multipart/mixed;
 boundary="Multipart=_Fri__2_Dec_2005_13_51_24_+0100_fbYDCXzgQQWmb7Fr"


--Multipart=_Fri__2_Dec_2005_13_51_24_+0100_fbYDCXzgQQWmb7Fr
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

The attached patch provides G_TYPE_FLAG_ABSTRACT support:

class My:Foo from My:Bar (abstract) { ... }

Regards,
Jean-Yves Lefort

--=20
Jean-Yves Lefort

[email protected]
http://lefort.be.eu.org/

--Multipart=_Fri__2_Dec_2005_13_51_24_+0100_fbYDCXzgQQWmb7Fr
Content-Type: text/plain;
 name="gob2-2.0.12-abstract.diff"
Content-Disposition: attachment;
 filename="gob2-2.0.12-abstract.diff"
Content-Transfer-Encoding: quoted-printable

--- src/main.c.orig	Thu Dec  1 16:47:20 2005
+++ src/main.c	Thu Dec  1 16:54:41 2005
@@ -1081,8 +1081,8 @@
 	add_interface_infos ();
=20
 	out_printf (out,
-		    "\t\ttype =3D g_type_register_static (%s, \"%s\", &info, (GTypeFlags=
)0);\n",
-		    pmacrotype, typebase);
+		    "\t\ttype =3D g_type_register_static (%s, \"%s\", &info, (GTypeFlags=
)%s);\n",
+		    pmacrotype, typebase, ((Class *)class)->abstract ? "G_TYPE_FLAG_ABST=
RACT" : "0");
=20
 	add_interfaces ();
=20
--- src/parse.y.orig	Thu Dec  1 16:43:23 2005
+++ src/parse.y	Thu Dec  1 16:45:49 2005
@@ -44,6 +44,7 @@
 static GList *flag_vals =3D NULL;
 static GList *error_vals =3D NULL;
=20
+static gboolean abstract =3D FALSE;
 static char *chunk_size =3D NULL;
 static char *bonobo_object_class =3D NULL;
 static int glade_xml =3D FALSE;
@@ -778,6 +779,7 @@
 					  "glade_xml", glade_xml,
 					  "interfaces:steal", interfaces,
 					  "chunk_size:steal", chunk_size,
+					  "abstract", abstract,
 					  NULL);
 			bonobo_object_class =3D NULL;
 			glade_xml =3D FALSE;
@@ -787,6 +789,14 @@
 	;
=20
 classflags:
+	| '(' TOKEN ')' classflags {
+			if(strcmp($<id>2,"abstract") =3D=3D 0) {
+				abstract =3D TRUE;
+			} else {
+				yyerror(_("parse error"));
+				YYERROR;
+			}
+		}
 	| '(' TOKEN TOKEN ')' classflags {
 			if(strcmp($<id>2,"chunks") =3D=3D 0) {
 				g_free (chunk_size);
--- src/treefuncs.def.orig	Thu Dec  1 16:46:14 2005
+++ src/treefuncs.def	Thu Dec  1 16:47:08 2005
@@ -56,6 +56,7 @@
   STRING	chunk_size # if the object should be allocated with mem_chunks
   STRINGLIST	interfaces # GObject interfaces this class exports
   NODELIST	nodes
+  BOOL		abstract # if G_TYPE_FLAG_ABSTRACT should be used
 ENDCLASS
=20
 CLASS Type

--Multipart=_Fri__2_Dec_2005_13_51_24_+0100_fbYDCXzgQQWmb7Fr--

--Signature=_Fri__2_Dec_2005_13_51_24_+0100_v_/YktFZEVaIQpmO
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFDkENMyzD7UaO4AGoRAv3XAJwJJwBshjGjfKYbMs/LgqExfCQlLwCbB4dp
vvtUSvp/5j1sXMZiP/Nhsb4=
=DpYJ
-----END PGP SIGNATURE-----

--Signature=_Fri__2_Dec_2005_13_51_24_+0100_v_/YktFZEVaIQpmO--

--
to unsubscribe:
send mail to [email protected] with "unsubscribe gob-list" in the subject