Allow both union and struct to be boxed or not

* girepository/girnode.c: Allow gtype_name
	and gtype_init in struct and union.
	* girepository/girparser.c: Parse glib:
	boxed bits for both structure and union.
	* girepository/gtypelib.c: Don't barf
	if structure is boxed.
	* giscanner/girparser.py: Parse new XML
	format.
	* giscanner/girwriter.py: Write out new
	XML format.
	* giscanner/glibast.py: Define new classes
	which are both Boxed and Struct/Union, as
	well as an "Other" for everything else.
	* giscanner/glibtransformer.py: Handle
	boxed types specially; we try to merge
	them with a struct/union if one exists,
	otherwise fall back to generic boxed.
	* tests/*: Update.
	* tools/generate.c: Write out new format.

svn path=/trunk/; revision=575
This commit is contained in:
Colin Walters 2008-09-06 20:33:51 +00:00 committed by Philip Withnall
parent 886b9c66c5
commit 77683a327f

View File

@ -413,15 +413,18 @@ write_struct_info (const gchar *namespace,
name = g_base_info_get_name ((GIBaseInfo *)info); name = g_base_info_get_name ((GIBaseInfo *)info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info); deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
type_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*)info);
type_init = g_registered_type_info_get_type_init ((GIRegisteredTypeInfo*)info);
if (g_base_info_get_type ((GIBaseInfo *)info) == GI_INFO_TYPE_BOXED) if (g_base_info_get_type ((GIBaseInfo *)info) == GI_INFO_TYPE_BOXED)
{ {
type_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*)info); g_fprintf (file, " <glib:boxed glib:name=\"%s\"", name);
type_init = g_registered_type_info_get_type_init ((GIRegisteredTypeInfo*)info);
g_fprintf (file, " <glib:boxed glib:name=\"%s\" glib:type-name=\"%s\" glib:get-type=\"%s\"", name, type_name, type_init);
} }
else else
g_fprintf (file, " <record name=\"%s\"", name); g_fprintf (file, " <record name=\"%s\"", name);
if (type_name != NULL)
g_fprintf (file, " glib:type-name=\"%s\" glib:get-type=\"%s\"", type_name, type_init);
if (deprecated) if (deprecated)
g_fprintf (file, " deprecated=\"1\""); g_fprintf (file, " deprecated=\"1\"");