From: Michael Wallner Date: Thu, 22 Nov 2018 07:38:06 +0000 (+0100) Subject: fix enum dump; fix float formats; fix dumps X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=12964ebafbb9090db90faa09fba4140bdffff0eb;p=m6w6%2Fext-psi fix enum dump; fix float formats; fix dumps --- diff --git a/src/types/decl_enum.c b/src/types/decl_enum.c index df35339..674dd03 100644 --- a/src/types/decl_enum.c +++ b/src/types/decl_enum.c @@ -51,13 +51,15 @@ void psi_decl_enum_free(struct psi_decl_enum **e_ptr) void psi_decl_enum_dump(struct psi_dump *dump, struct psi_decl_enum *e, unsigned level) { - bool is_anon = psi_decl_type_is_anon(e->name, "enum"); - PSI_DUMP(dump, "enum %s%s%s {\n", - is_anon ? "/* ":"", e->name->val, is_anon ? " */":""); - if (e->items) { - size_t i = 0; - struct psi_decl_enum_item *item; + size_t i = 0; + struct psi_decl_enum_item *item; + PSI_DUMP(dump, "enum "); + if (!psi_decl_type_is_anon(e->name, "enum")) { + PSI_DUMP(dump, "%s ", e->name->val); + } + if (e->items) { + PSI_DUMP(dump, "{\n"); while (psi_plist_get(e->items, i++, &item)) { if (i > 1) { PSI_DUMP(dump, ",\n"); @@ -65,8 +67,8 @@ void psi_decl_enum_dump(struct psi_dump *dump, struct psi_decl_enum *e, unsigned PSI_DUMP(dump, "%s", psi_t_indent(level + 1)); psi_decl_enum_item_dump(dump, item); } + PSI_DUMP(dump, "%s\n} ", psi_t_indent(level)); } - PSI_DUMP(dump, "\n}"); } bool psi_decl_enum_validate(struct psi_data *data, struct psi_decl_enum *e) diff --git a/src/types/decl_type.c b/src/types/decl_type.c index 9db6de1..1445c35 100644 --- a/src/types/decl_type.c +++ b/src/types/decl_type.c @@ -326,24 +326,11 @@ void psi_decl_type_dump(struct psi_dump *dump, struct psi_decl_type *t, unsigned return; case PSI_T_ENUM: - PSI_DUMP(dump, "enum "); if (psi_decl_type_is_anon(t->name, "enum")) { - size_t i = 0, c = psi_plist_count(t->real.enm->items); - struct psi_decl_enum_item *item; - - PSI_DUMP(dump, "{\n"); - ++level; - while (psi_plist_get(t->real.enm->items, i++, &item)) { - PSI_DUMP(dump, "%s", psi_t_indent(level)); - psi_decl_enum_item_dump(dump, item); - if (i < c) { - PSI_DUMP(dump, "%s\n", i < c ? "," : ""); - } - } - --level; - PSI_DUMP(dump, "%s\n} ", psi_t_indent(level)); + psi_decl_enum_dump(dump, t->real.enm, level); return; } + PSI_DUMP(dump, "enum "); break; case PSI_T_STRUCT: