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 Tommi Komulainen
parent 4fb5b001bb
commit 0fa82c6a4c

View File

@ -839,15 +839,11 @@ start_field (GMarkupParseContext *context,
field = (GIrNodeField *)g_ir_node_new (G_IR_NODE_FIELD);
ctx->current_typed = (GIrNode*) field;
((GIrNode *)field)->name = g_strdup (name);
if (readable && strcmp (readable, "1") == 0)
field->readable = TRUE;
else
field->readable = FALSE;
if (writable && strcmp (writable, "1") == 0)
field->writable = TRUE;
else
field->writable = FALSE;
/* Fields are assumed to be read-only.
* (see also girwriter.py and generate.c)
*/
field->readable = readable == NULL || strcmp (readable, "0") == 0;
field->writable = writable != NULL && strcmp (writable, "1") == 0;
if (bits)
field->bits = atoi (bits);