summaryrefslogtreecommitdiff
path: root/compiler/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main.c')
-rw-r--r--compiler/main.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/main.c b/compiler/main.c
index da261bc..ada6243 100644
--- a/compiler/main.c
+++ b/compiler/main.c
@@ -174,6 +174,14 @@ parse_args(int argc, char **argv)
}
static void
+print_ptrs(int n_ptrs)
+{
+ for (int n = 0; n < n_ptrs; n++) {
+ putchar('*');
+ }
+}
+
+static void
print_alias(struct type *typ)
{
printf("alias (%lu bytes, %d pointer(s))", typ->size, typ->n_ptrs);
@@ -207,7 +215,7 @@ print_struct(struct type *typ)
{
struct struct_member *mem;
- printf("struct {\n");
+ printf("struct (%lu bytes) {\n", typ->size);
for (size_t r = 0; r < typ->members.n_rows; r++) {
mem = (struct struct_member*)typ->members.rows[r].head;
@@ -216,7 +224,9 @@ print_struct(struct type *typ)
}
do {
- printf(" %.*s %.*s; (%d pointer(s))\n", (int)mem->typ->name_len, mem->typ->name, (int)mem->name_len, mem->name, mem->n_ptrs);
+ printf(" %.*s", (int)mem->typ->name_len, mem->typ->name);
+ print_ptrs(mem->n_ptrs);
+ printf(" %.*s;\n", (int)mem->name_len, mem->name);
mem = (struct struct_member*)mem->hashmap_entry.list_entry.next;
} while (mem != (struct struct_member*)&typ->members.rows[r]);