From 490b0ea4ab3d759803ae27995ffdbd5afe06695c Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Thu, 7 Aug 2008 07:18:44 +0000 Subject: parse glib:boxed tag svn path=/branches/gir-compiler/; revision=309 --- tests/boxed.test | 8 ++++---- tools/girparser.c | 51 ++++++++++++++++++++++++--------------------------- 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/tests/boxed.test b/tests/boxed.test index e4480fce..8ab4c0ef 100644 --- a/tests/boxed.test +++ b/tests/boxed.test @@ -4,7 +4,7 @@ xmlns:c="http://www.gtk.org/introspection/c/1.0" xmlns:glib="http://www.gtk.org/introspection/glib/1.0"> - + @@ -42,7 +42,7 @@ - + @@ -50,7 +50,7 @@ - - + + diff --git a/tools/girparser.c b/tools/girparser.c index 9bd5e4d0..04306dce 100644 --- a/tools/girparser.c +++ b/tools/girparser.c @@ -406,14 +406,14 @@ parse_type (const gchar *type) } static gboolean -start_boxed (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - ParseContext *ctx, - GError **error) +start_glib_boxed (GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + ParseContext *ctx, + GError **error) { - if (strcmp (element_name, "boxed") == 0 && + if (strcmp (element_name, "glib:boxed") == 0 && ctx->state == STATE_NAMESPACE) { const gchar *name; @@ -421,16 +421,14 @@ start_boxed (GMarkupParseContext *context, const gchar *typeinit; const gchar *deprecated; - name = find_attribute ("name", attribute_names, attribute_values); + name = find_attribute ("glib:name", attribute_names, attribute_values); typename = find_attribute ("glib:type-name", attribute_names, attribute_values); typeinit = find_attribute ("glib:get-type", attribute_names, attribute_values); deprecated = find_attribute ("deprecated", attribute_names, attribute_values); if (name == NULL) MISSING_ATTRIBUTE (context, error, element_name, "name"); - else if (typename == NULL) - MISSING_ATTRIBUTE (context, error, element_name, "glib:type-name"); - else if (typeinit == NULL) + else if (typename == NULL || typeinit == NULL) MISSING_ATTRIBUTE (context, error, element_name, "glib:get-type"); else { @@ -1349,12 +1347,12 @@ start_return_value (GMarkupParseContext *context, } static gboolean -start_signal (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - ParseContext *ctx, - GError **error) +start_glib_signal (GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + ParseContext *ctx, + GError **error) { if (strcmp (element_name, "glib:signal") == 0 && (ctx->state == STATE_OBJECT || @@ -1646,13 +1644,6 @@ start_element_handler (GMarkupParseContext *context, switch (element_name[0]) { - case 'b': - if (start_boxed (context, element_name, - attribute_names, attribute_values, - ctx, error)) - goto out; - break; - case 'c': if (start_function (context, element_name, attribute_names, attribute_values, @@ -1722,9 +1713,15 @@ start_element_handler (GMarkupParseContext *context, break; case 'g': - if (start_signal (context, element_name, - attribute_names, attribute_values, - ctx, error)) + if (start_glib_boxed (context, element_name, + attribute_names, attribute_values, + ctx, error)) + goto out; + break; + + if (start_glib_signal (context, element_name, + attribute_names, attribute_values, + ctx, error)) goto out; break; -- cgit v1.2.1