gobject-introspection r932 - in trunk: . girepository giscanner
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r932 - in trunk: . girepository giscanner
- Date: Mon, 17 Nov 2008 00:27:37 +0000 (UTC)
Author: walters
Date: Mon Nov 17 00:27:37 2008
New Revision: 932
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=932&view=rev
Log:
Bug 559706 - interface prequisites
Modified:
trunk/common.mk
trunk/girepository/gdump.c
trunk/girepository/girparser.c
trunk/giscanner/ast.py
trunk/giscanner/girwriter.py
trunk/giscanner/glibtransformer.py
Modified: trunk/common.mk
==============================================================================
--- trunk/common.mk (original)
+++ trunk/common.mk Mon Nov 17 00:27:37 2008
@@ -7,4 +7,5 @@
SCANNER = $(SCANNER_ENV) $(SCANNER_BIN) $(SCANNER_ARGS)
SCANNER_LIBS = \
$(top_srcdir)/giscanner/*.py \
- $(top_builddir)/giscanner/libgiscanner.la
+ $(top_builddir)/giscanner/libgiscanner.la \
+ $(top_builddir)/girepository/libgirepository.la
Modified: trunk/girepository/gdump.c
==============================================================================
--- trunk/girepository/gdump.c (original)
+++ trunk/girepository/gdump.c Mon Nov 17 00:27:37 2008
@@ -186,7 +186,12 @@
for (i = 0; i < n_interfaces; i++)
{
GType itype = interfaces[i];
- escaped_printf (out, " <extends>%s</extends>\n",
+ if (itype == G_TYPE_OBJECT)
+ {
+ /* This is implicit */
+ continue;
+ }
+ escaped_printf (out, " <prerequisite name=\"%s\"/>\n",
g_type_name (itype));
}
dump_properties (type, out);
Modified: trunk/girepository/girparser.c
==============================================================================
--- trunk/girepository/girparser.c (original)
+++ trunk/girepository/girparser.c Mon Nov 17 00:27:37 2008
@@ -54,7 +54,7 @@
STATE_INTERFACE_PROPERTY, /* 15 */
STATE_INTERFACE_FIELD,
STATE_IMPLEMENTS,
- STATE_REQUIRES,
+ STATE_PREREQUISITE,
STATE_BOXED,
STATE_BOXED_FIELD, /* 20 */
STATE_STRUCT,
@@ -2338,25 +2338,6 @@
attribute_names, attribute_values,
ctx, error))
goto out;
- else if (strcmp (element_name, "class") == 0 &&
- ctx->state == STATE_REQUIRES)
- {
- const gchar *name;
-
- name = find_attribute ("name", attribute_names, attribute_values);
-
- if (name == NULL)
- MISSING_ATTRIBUTE (context, error, element_name, "name");
- else
- {
- GIrNodeInterface *iface;
-
- iface = (GIrNodeInterface *)ctx->current_node;
- iface ->prerequisites = g_list_append (iface->prerequisites, g_strdup (name));
- }
-
- goto out;
- }
break;
case 'd':
@@ -2522,7 +2503,26 @@
attribute_names, attribute_values,
ctx, error))
goto out;
+ else if (strcmp (element_name, "prerequisite") == 0 &&
+ ctx->state == STATE_INTERFACE)
+ {
+ const gchar *name;
+ name = find_attribute ("name", attribute_names, attribute_values);
+
+ state_switch (ctx, STATE_PREREQUISITE);
+
+ if (name == NULL)
+ MISSING_ATTRIBUTE (context, error, element_name, "name");
+ else
+ {
+ GIrNodeInterface *iface;
+
+ iface = (GIrNodeInterface *)ctx->current_node;
+ iface ->prerequisites = g_list_append (iface->prerequisites, g_strdup (name));
+ }
+ goto out;
+ }
break;
case 'r':
@@ -2549,13 +2549,6 @@
attribute_names, attribute_values,
ctx, error))
goto out;
- else if (strcmp (element_name, "requires") == 0 &&
- ctx->state == STATE_INTERFACE)
- {
- state_switch (ctx, STATE_REQUIRES);
-
- goto out;
- }
else if (start_struct (context, element_name,
attribute_names, attribute_values,
ctx, error))
@@ -2893,8 +2886,8 @@
if (require_end_element (context, ctx, "implements", element_name, error))
state_switch (ctx, STATE_CLASS);
break;
- case STATE_REQUIRES:
- if (require_end_element (context, ctx, "requires", element_name, error))
+ case STATE_PREREQUISITE:
+ if (require_end_element (context, ctx, "prerequisite", element_name, error))
state_switch (ctx, STATE_INTERFACE);
break;
case STATE_NAMESPACE_CONSTANT:
Modified: trunk/giscanner/ast.py
==============================================================================
--- trunk/giscanner/ast.py (original)
+++ trunk/giscanner/ast.py Mon Nov 17 00:27:37 2008
@@ -385,6 +385,7 @@
self.methods = []
self.properties = []
self.fields = []
+ self.prerequisites = []
def __repr__(self):
return '%s(%r, %r)' % (
Modified: trunk/giscanner/girwriter.py
==============================================================================
--- trunk/giscanner/girwriter.py (original)
+++ trunk/giscanner/girwriter.py Mon Nov 17 00:27:37 2008
@@ -254,6 +254,9 @@
if isinstance(node, GLibObject):
for iface in node.interfaces:
self.write_tag('implements', [('name', iface)])
+ if isinstance(node, Interface):
+ for iface in node.prerequisites:
+ self.write_tag('prerequisite', [('name', iface)])
if isinstance(node, Class):
for method in node.constructors:
self._write_constructor(method)
Modified: trunk/giscanner/glibtransformer.py
==============================================================================
--- trunk/giscanner/glibtransformer.py (original)
+++ trunk/giscanner/glibtransformer.py Mon Nov 17 00:27:37 2008
@@ -575,6 +575,10 @@
type_name, xmlnode.attrib['get-type'])
self._introspect_properties(node, xmlnode)
self._introspect_signals(node, xmlnode)
+ for child in xmlnode.findall('prerequisite'):
+ name = child.attrib['name']
+ prereq = self._resolve_gtypename(name)
+ node.prerequisites.append(prereq)
# GtkFileChooserEmbed is an example of a private interface, we
# just filter them out
if xmlnode.attrib['get-type'].startswith('_'):
@@ -728,6 +732,9 @@
self._resolve_methods(node.methods)
self._resolve_properties(node.properties, node)
self._resolve_signals(node.signals)
+ node.prerequisites = filter(None,
+ [self._force_resolve(x, allow_unknown=True)
+ for x in node.prerequisites])
def _resolve_glib_object(self, node):
node.parent = self._force_resolve(node.parent)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]