From 71473eb033ff1157470d67d6c200f7d51e0dcc8c Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 1 Sep 2008 18:52:34 +0000 Subject: [PATCH] Look in c:type to determine pointer nature * girepository/girparser.c: Look at c:type to determine whether or not an item is a pointer. svn path=/trunk/; revision=571 --- girparser.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/girparser.c b/girparser.c index b7ad408f1..11152d84f 100644 --- a/girparser.c +++ b/girparser.c @@ -330,11 +330,6 @@ parse_type_internal (const gchar *str, char **next, gboolean in_glib) type->is_pointer = basic->pointer; str += strlen(basic->str); - if (*str == '*' && !type->is_pointer) - { - type->is_pointer = TRUE; - (str)++; - } } else if (in_glib) { @@ -484,12 +479,6 @@ parse_type_internal (const gchar *str, char **next, gboolean in_glib) (str)++; type->interface = g_strndup (start, str - start); - - if (*str == '*') - { - type->is_pointer = TRUE; - (str)++; - } } if (g_str_has_prefix (str, "[")) @@ -1552,6 +1541,9 @@ start_type (GMarkupParseContext *context, GError **error) { const gchar *name; + const gchar *ctype; + gboolean is_pointer; + GIrNodeType *typenode; if (strcmp (element_name, "type") != 0) return FALSE; @@ -1593,31 +1585,41 @@ start_type (GMarkupParseContext *context, if (name == NULL) MISSING_ATTRIBUTE (context, error, element_name, "name"); - + + ctype = find_attribute ("c:type", attribute_names, attribute_values); + if (ctype != NULL && strchr (ctype, '*')) + is_pointer = TRUE; + else + is_pointer = FALSE; + + typenode = parse_type (ctx, name); + if (is_pointer) + typenode->is_pointer = is_pointer; + switch (ctx->current_typed->type) { case G_IR_NODE_PARAM: { GIrNodeParam *param = (GIrNodeParam *)ctx->current_typed; - param->type = parse_type (ctx, name); + param->type = typenode; } break; case G_IR_NODE_FIELD: { GIrNodeField *field = (GIrNodeField *)ctx->current_typed; - field->type = parse_type (ctx, name); + field->type = typenode; } break; case G_IR_NODE_PROPERTY: { GIrNodeProperty *property = (GIrNodeProperty *) ctx->current_typed; - property->type = parse_type (ctx, name); + property->type = typenode; } break; case G_IR_NODE_CONSTANT: { GIrNodeConstant *constant = (GIrNodeConstant *)ctx->current_typed; - constant->type = parse_type (ctx, name); + constant->type = typenode; } break; default: @@ -1625,6 +1627,7 @@ start_type (GMarkupParseContext *context, g_assert_not_reached (); } + ctx->current_typed = NULL; return TRUE; }