diff options
author | Johan Dahlin <johan@src.gnome.org> | 2008-08-06 17:34:42 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-08-06 17:34:42 +0000 |
commit | c09db950fd1e673e3127df1778117627e02d5e23 (patch) | |
tree | 0753b1c99c69e4b780f56a546f229279424c5a0b /tools/girparser.c | |
parent | 7180c04a3df9a5fee853d44a3fc4b16123a405be (diff) | |
download | gobject-introspection-c09db950fd1e673e3127df1778117627e02d5e23.tar.gz |
Make the code compile, parse return-value and type
svn path=/branches/gir-compiler/; revision=303
Diffstat (limited to 'tools/girparser.c')
-rw-r--r-- | tools/girparser.c | 83 |
1 files changed, 24 insertions, 59 deletions
diff --git a/tools/girparser.c b/tools/girparser.c index 4513ee58..844bb0c0 100644 --- a/tools/girparser.c +++ b/tools/girparser.c @@ -46,7 +46,8 @@ typedef enum STATE_STRUCT, STATE_SIGNAL, STATE_ERRORDOMAIN, - STATE_UNION + STATE_UNION, + STATE_PARAMETERS } ParseState; typedef struct _ParseContext ParseContext; @@ -1222,6 +1223,7 @@ start_type (GMarkupParseContext *context, { const gchar *name; const gchar *ctype; + GIrNodeParam *param; if (strcmp (element_name, "type") != 0) return FALSE; @@ -1234,19 +1236,13 @@ start_type (GMarkupParseContext *context, if (ctype == NULL) MISSING_ATTRIBUTE (error, element_name, "c:type"); + param = (GIrNodeParam *)ctx->current_node; + switch (ctx->current_node->type) { - case G_IR_NODE_FUNCTION_RETURN: + case G_IR_NODE_PARAM: { } - if (ctx->current_is_return) - { - func->result = param; - } - else - { - } - } break; case G_IR_NODE_SIGNAL: { @@ -1261,62 +1257,31 @@ start_type (GMarkupParseContext *context, } break; default: + g_printerr("current node is %d\n", ctx->current_node->type); g_assert_not_reached (); } } static gboolean -start_return_type (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - ParseContext *ctx, - GError **error) +start_return_value (GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + ParseContext *ctx, + GError **error) { if (strcmp (element_name, "return-value") == 0 && ctx->state == STATE_FUNCTION) { - const gchar *type; - const gchar *nullok; - const gchar *transfer; - - type = find_attribute ("c:type", attribute_names, attribute_values); - nullok = find_attribute ("null-ok", attribute_names, attribute_values); - transfer = find_attribute ("transfer", attribute_names, attribute_values); - if (type == NULL) - MISSING_ATTRIBUTE (error, element_name, "c:type"); - else - { - GIrNodeParam *param; + GIrNodeParam *param; + + param = (GIrNodeParam *)g_ir_node_new (G_IR_NODE_PARAM); + param->in = FALSE; + param->out = FALSE; + param->retval = TRUE; + + ctx->current_node = (GIrNode *) param; - param = (GIrNodeParam *)g_ir_node_new (G_IR_NODE_PARAM); - param->in = FALSE; - param->out = FALSE; - param->retval = TRUE; - if (nullok && strcmp (nullok, "1") == 0) - param->null_ok = TRUE; - else - param->null_ok = FALSE; - if (transfer && strcmp (transfer, "none") == 0) - { - param->transfer = FALSE; - param->shallow_transfer = FALSE; - } - else if (transfer && strcmp (transfer, "shallow") == 0) - { - param->transfer = FALSE; - param->shallow_transfer = TRUE; - } - else - { - param->transfer = TRUE; - param->shallow_transfer = FALSE; - } - - param->type = parse_type (type); - - } - return TRUE; } @@ -1822,9 +1787,9 @@ start_element_handler (GMarkupParseContext *context, goto out; } - else if (start_return_type (context, element_name, - attribute_names, attribute_values, - ctx, error)) + else if (start_return_value (context, element_name, + attribute_names, attribute_values, + ctx, error)) goto out; else if (strcmp (element_name, "requires") == 0 && ctx->state == STATE_INTERFACE) |