summaryrefslogtreecommitdiff
path: root/girepository/girparser.c
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-11-09 19:17:23 +0100
committerTomeu Vizoso <tomeu@sugarlabs.org>2009-11-11 13:55:00 +0100
commitf8693bda3775f6339f38a17c037ac7bc4a4cc3f7 (patch)
tree89456982ed5b6e8e5850a7c05f55a50f3be0c5fa /girepository/girparser.c
parent3715b02198c9efc34d70f489d4e55a39456d8f99 (diff)
downloadgobject-introspection-f8693bda3775f6339f38a17c037ac7bc4a4cc3f7.tar.gz
Implement callbacks as part of struct fields. Fixes #557383
gir: embed <callback> inside <field> typelib: if a field contains a callback, store it just after the FieldBlob girepository API: no additions
Diffstat (limited to 'girepository/girparser.c')
-rw-r--r--girepository/girparser.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/girepository/girparser.c b/girepository/girparser.c
index 9387d252..1bbe59fd 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -101,6 +101,7 @@ struct _ParseContext
GList *type_stack;
GList *type_parameters;
int type_depth;
+ gboolean in_embedded_type;
};
#define CURRENT_NODE(ctx) ((GIrNode *)((ctx)->node_stack->data))
@@ -719,6 +720,10 @@ start_function (GMarkupParseContext *context,
strcmp (element_name, "method") == 0 ||
strcmp (element_name, "callback") == 0);
break;
+ case STATE_STRUCT_FIELD:
+ ctx->in_embedded_type = TRUE;
+ found = (found || strcmp (element_name, "callback") == 0);
+ break;
default:
break;
}
@@ -782,6 +787,13 @@ start_function (GMarkupParseContext *context,
ctx->current_module->entries =
g_list_append (ctx->current_module->entries, function);
}
+ else if (ctx->current_typed)
+ {
+ GIrNodeField *field;
+
+ field = (GIrNodeField *)ctx->current_typed;
+ field->callback = function;
+ }
else
switch (CURRENT_NODE (ctx)->type)
{
@@ -2902,7 +2914,13 @@ end_element_handler (GMarkupParseContext *context,
}
else
{
- if (CURRENT_NODE (ctx)->type == G_IR_NODE_INTERFACE)
+ g_debug("case STATE_FUNCTION %d", CURRENT_NODE (ctx)->type);
+ if (ctx->in_embedded_type)
+ {
+ ctx->in_embedded_type = FALSE;
+ state_switch (ctx, STATE_STRUCT_FIELD);
+ }
+ else if (CURRENT_NODE (ctx)->type == G_IR_NODE_INTERFACE)
state_switch (ctx, STATE_INTERFACE);
else if (CURRENT_NODE (ctx)->type == G_IR_NODE_OBJECT)
state_switch (ctx, STATE_CLASS);