diff options
author | Tommi Komulainen <tommi.komulainen@iki.fi> | 2008-10-17 14:58:37 +0000 |
---|---|---|
committer | Tommi Komulainen <tko@src.gnome.org> | 2008-10-17 14:58:37 +0000 |
commit | caf97d582f8f4a8653d8a4dc06524dd448bf5e26 (patch) | |
tree | 2668b6fa7c9e14f86c797c67afe5178129b51d2a /tools/generate.c | |
parent | 2b1b2ccf3e29c26a50bcaac876b16d0c5c2d4df3 (diff) | |
download | gobject-introspection-caf97d582f8f4a8653d8a4dc06524dd448bf5e26.tar.gz |
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
Diffstat (limited to 'tools/generate.c')
-rw-r--r-- | tools/generate.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/generate.c b/tools/generate.c index 729583f3..fa7dd46b 100644 --- a/tools/generate.c +++ b/tools/generate.c @@ -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); |