Commit f11f3162 authored by Christian Hergert's avatar Christian Hergert

signature: hackish attempt to cleanup signatures

parent f3aa213f
......@@ -1084,6 +1084,9 @@ girst_parser_object_get_signature (GirstParserObject *self)
GirstParserObject *return_value;
GirstParserObject *params;
GPtrArray *children;
guint pcount = 0;
guint space = 0;
guint begin;
g_return_val_if_fail (GIRST_IS_PARSER_OBJECT (self), NULL);
......@@ -1109,7 +1112,8 @@ girst_parser_object_get_signature (GirstParserObject *self)
g_string_append (str, "void");
}
g_string_append_c (str, ' ');
g_string_append (str, "\n ");
begin = str->len;
/* Now the function name (or callback/vtable definition) */
......@@ -1152,6 +1156,13 @@ girst_parser_object_get_signature (GirstParserObject *self)
g_string_append_c (str, '(');
space = str->len - begin;
/* XXX: Until we have a better way to ensure this
* is indented from the template code.
*/
space += 3;
params = girst_parser_object_first_typed (self, GIRST_TYPE_PARAMETERS);
if (params == NULL)
......@@ -1168,23 +1179,32 @@ girst_parser_object_get_signature (GirstParserObject *self)
g_autofree gchar *c_type = NULL;
g_autofree gchar *name = NULL;
if (!GIRST_IS_PARAMETER (child) &&
!GIRST_IS_INSTANCE_PARAMETER (child) &&
!GIRST_IS_VARARGS (child))
continue;
if (pcount != 0)
{
for (guint j = 0; j < space; j++)
g_string_append_c (str, ' ');
}
if (GIRST_IS_VARARGS (child))
{
g_string_append (str, "...");
g_string_append (str, "...,\n");
break;
}
if (!GIRST_IS_PARAMETER (child) && !GIRST_IS_INSTANCE_PARAMETER (child))
continue;
g_object_get (child, "name", &name, NULL);
c_type = girst_parser_object_get_lhs_ctype (child);
g_string_append_printf (str, "%s %s, ", c_type, name);
g_string_append_printf (str, "%s %s,\n", c_type, name);
pcount++;
}
if (str->str[str->len-1] == ' ' && str->str[str->len-2] == ',')
g_string_truncate (str, str->len - 2);
g_string_truncate (str, str->len - 2);
cleanup:
g_string_append (str, ");");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment