Bug 556732 – generate gir files consistently

2008-10-17  Tommi Komulainen  <tommi.komulainen@iki.fi>

	Bug 556732 – generate gir files consistently

	* giscanner/ast.py (Field): add readable and writable properties
	* giscanner/girparser.py (_parse_field): copy 'readable' and
	'writable' attributes
	* giscanner/transformer.py (_create_member): create fields as
	read-write
	* giscanner/glibtransformer.py (_introspect_object,
	_pair_class_struct): make object instance and class fields
	read-only
	* giscanner/girwriter.py (_write_field):
	* tools/generate.c (write_field_info): write field 'readable'
	and 'writable' attributes only if non-default (read-only)
	* girepository/girparser.c (start_field): in the absence of
	attributes assume fields are read-only
	* tests/boxed.gir:
	* tests/struct.gir: remove redundant readable="1" from fields
	* tests/scanner/foo-1.0-expected.gir:
	* tests/scanner/utility-1.0-expected.gir: add writable="1" to
	all record and union fields

svn path=/trunk/; revision=743
This commit is contained in:
Tommi Komulainen 2008-10-17 14:58:37 +00:00 committed by Philip Withnall
parent 80429426af
commit 3bddeae0fa

View File

@ -338,10 +338,16 @@ write_field_info (const gchar *namespace,
offset = g_field_info_get_offset (info);
xml_start_element (file, "field");
xml_printf (file, " name=\"%s\" readable=\"%s\" writable=\"%s\"",
name,
flags & GI_FIELD_IS_READABLE ? "1" : "0",
flags & GI_FIELD_IS_WRITABLE ? "1" : "0");
xml_printf (file, " name=\"%s\"", name);
/* Fields are assumed to be read-only
* (see also girwriter.py and girparser.c)
*/
if (!(flags & GI_FIELD_IS_READABLE))
xml_printf (file, " readable=\"0\"");
if (flags & GI_FIELD_IS_WRITABLE)
xml_printf (file, " writable=\"1\"");
if (size)
xml_printf (file, " bits=\"%d\"", size);