summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2008-08-07 07:18:44 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-08-07 07:18:44 +0000
commit490b0ea4ab3d759803ae27995ffdbd5afe06695c (patch)
tree40bf5f8b86cdbbfa2d86012c27b52da056ab05a3
parent478ef21e02a010f06525f024e1959ae87e1b8c5e (diff)
downloadgobject-introspection-490b0ea4ab3d759803ae27995ffdbd5afe06695c.tar.gz
parse glib:boxed tag
svn path=/branches/gir-compiler/; revision=309
-rw-r--r--tests/boxed.test8
-rw-r--r--tools/girparser.c51
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">
<namespace name="Foo">
- <glib:boxed glib:name="BoxedType1" c:type="boxed1" glib:get-type="boxed1_get_type" deprecated="1">
+ <glib:boxed glib:name="BoxedType1" glib:type-name="boxed1" glib:get-type="boxed1_get_type" deprecated="1">
<field name="field1" readable="1" writable="1" offset="0">
<type name="guint32" c:type="guint32"/>
</field>
@@ -42,7 +42,7 @@
<parameter name="val" c:type="gint*" transfer="full" direction="inout" />
</parameters>
</method>
- </boxed>
+ </glib:boxed>
<function name="freefunc" c:identifier="freefunc" deprecated="1">
<return-type c:type="gint" />
<parameters>
@@ -50,7 +50,7 @@
<parameter name="val2" c:type="gint" direction="in" />
</parameters>
</function>
- <boxed name="boxed2" type-name="BoxedType2" get-type="boxed2_get_type" deprecated="1">
- </boxed>
+ <glib:boxed glib:name="boxed2" glib:type-name="BoxedType2" glib:get-type="boxed2_get_type" deprecated="1">
+ </glib:boxed>
</namespace>
</repository>
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;