eolian: fix type print

This commit is contained in:
Daniel Kolesa 2014-07-11 12:26:33 +01:00
parent 35ada5afff
commit 9e3417aad8
1 changed files with 13 additions and 11 deletions

View File

@ -153,7 +153,7 @@ _print_field(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data,
{ {
printf("%s: ", (const char*)key); printf("%s: ", (const char*)key);
database_type_print((Eolian_Type*)data); database_type_print((Eolian_Type*)data);
puts("; "); printf("; ");
return EINA_TRUE; return EINA_TRUE;
} }
@ -163,11 +163,13 @@ database_type_print(Eolian_Type *tp)
Eina_List *l; Eina_List *l;
Eolian_Type *stp; Eolian_Type *stp;
if (tp->is_own) if (tp->is_own)
puts("own("); printf("own(");
if (tp->is_const) if (tp->is_const)
puts("const("); printf("const(");
if (tp->type == EOLIAN_TYPE_REGULAR) if (tp->type == EOLIAN_TYPE_REGULAR)
puts(tp->name); printf(tp->name);
else if (tp->type == EOLIAN_TYPE_VOID)
printf("void");
else if (tp->type == EOLIAN_TYPE_REGULAR_STRUCT) else if (tp->type == EOLIAN_TYPE_REGULAR_STRUCT)
printf("struct %s", tp->name); printf("struct %s", tp->name);
else if (tp->type == EOLIAN_TYPE_POINTER) else if (tp->type == EOLIAN_TYPE_POINTER)
@ -178,18 +180,18 @@ database_type_print(Eolian_Type *tp)
else if (tp->type == EOLIAN_TYPE_FUNCTION) else if (tp->type == EOLIAN_TYPE_FUNCTION)
{ {
Eina_Bool first = EINA_TRUE; Eina_Bool first = EINA_TRUE;
puts("func"); printf("func");
if (tp->ret_type) if (tp->ret_type)
{ {
putchar(' '); putchar(' ');
database_type_print(tp->ret_type); database_type_print(tp->ret_type);
} }
else else
puts(" void"); printf(" void");
puts(" ("); printf(" (");
EINA_LIST_FOREACH(tp->arguments, l, stp) EINA_LIST_FOREACH(tp->arguments, l, stp)
{ {
if (!first) puts(", "); if (!first) printf(", ");
first = EINA_FALSE; first = EINA_FALSE;
database_type_print(stp); database_type_print(stp);
} }
@ -197,11 +199,11 @@ database_type_print(Eolian_Type *tp)
} }
else if (tp->type == EOLIAN_TYPE_STRUCT) else if (tp->type == EOLIAN_TYPE_STRUCT)
{ {
puts("struct "); printf("struct ");
if (tp->name) printf("%s ", tp->name); if (tp->name) printf("%s ", tp->name);
puts("{ "); printf("{ ");
eina_hash_foreach(tp->fields, _print_field, NULL); eina_hash_foreach(tp->fields, _print_field, NULL);
puts("}"); printf("}");
} }
if (tp->is_own) if (tp->is_own)
putchar(')'); putchar(')');