diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-22 18:04:00 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-22 18:07:41 +0100 |
commit | 936971c1a3abe4bd5f197bad65dc8330fb4a22dc (patch) | |
tree | 4e793c17c2bce83537c2d724a28e3b14f0608db8 /src | |
parent | 5eb7b6f431aa821684c7208d9a42779ba7002bec (diff) | |
download | ovm-936971c1a3abe4bd5f197bad65dc8330fb4a22dc.tar.gz ovm-936971c1a3abe4bd5f197bad65dc8330fb4a22dc.tar.bz2 ovm-936971c1a3abe4bd5f197bad65dc8330fb4a22dc.zip |
Changed formats for vm_print_(stack|program)
Easier to read now
Diffstat (limited to 'src')
-rw-r--r-- | src/runtime.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/runtime.c b/src/runtime.c index 0a8a40a..77af177 100644 --- a/src/runtime.c +++ b/src/runtime.c @@ -156,15 +156,14 @@ void vm_print_stack(vm_t *vm, FILE *fp) fprintf(fp, "]\n"); return; } + printf("\n"); for (size_t i = stack.ptr; i > 0; --i) { byte b = stack.data[i - 1]; - fprintf(fp, "{%lu: %X}", stack.ptr - i, b); + fprintf(fp, "\t%lu: %X", stack.ptr - i, b); if (i != 1) fprintf(fp, ", "); - - if (((stack.ptr - i + 1) % 4) == 0) - fprintf(fp, "\n"); + fprintf(fp, "\n"); } fprintf(fp, "]\n"); } @@ -174,15 +173,8 @@ void vm_print_program(vm_t *vm, FILE *fp) struct Program program = vm->program; fprintf(fp, "Program.max = %lu\nProgram.ptr = " - "%lu\nProgram.instructions = [", + "%lu\nProgram.instructions = [\n", program.max, program.ptr); - if (program.ptr == 0) - { - fprintf(fp, "]\n"); - return; - } - - fprintf(fp, "\n"); size_t beg = 0; if (program.ptr >= VM_PRINT_PROGRAM_EXCERPT) { |