diff options
author | Bad Diode <bd@badd10de.dev> | 2021-10-25 12:37:25 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-10-25 12:37:25 +0200 |
commit | b9644b4ccda5abee01fd0704ddc42b08b68e5b5d (patch) | |
tree | ed7d94f6f6ca242574234305c8574797cc6d22b0 /src/bytecode/debug.h | |
parent | e2c284b57641b5feec9a8d04313b0cd6d556e860 (diff) | |
download | bdl-b9644b4ccda5abee01fd0704ddc42b08b68e5b5d.tar.gz bdl-b9644b4ccda5abee01fd0704ddc42b08b68e5b5d.zip |
Change chunk to store a name
Diffstat (limited to 'src/bytecode/debug.h')
-rwxr-xr-x | src/bytecode/debug.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bytecode/debug.h b/src/bytecode/debug.h index 7673703..534ff80 100755 --- a/src/bytecode/debug.h +++ b/src/bytecode/debug.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include "chunk.h" | 4 | #include "chunk.h" |
5 | #include "objects.h" | 5 | #include "objects.h" |
6 | 6 | ||
7 | void disassemble_chunk(Chunk *chunk, const char *name); | 7 | void disassemble_chunk(Chunk *chunk); |
8 | size_t disassemble_instruction(Chunk *chunk, size_t offset); | 8 | size_t disassemble_instruction(Chunk *chunk, size_t offset); |
9 | 9 | ||
10 | static const char* ops_str[] = { | 10 | static const char* ops_str[] = { |
@@ -41,8 +41,8 @@ static const char* ops_str[] = { | |||
41 | }; | 41 | }; |
42 | 42 | ||
43 | void | 43 | void |
44 | disassemble_chunk(Chunk *chunk, const char *name) { | 44 | disassemble_chunk(Chunk *chunk) { |
45 | printf("== %s ==\n", name); | 45 | printf("===== %.*s =====\n", (int)array_size(chunk->name), chunk->name); |
46 | printf("code:\n"); | 46 | printf("code:\n"); |
47 | size_t offset = 0; | 47 | size_t offset = 0; |
48 | while (offset < array_size(chunk->code)) { | 48 | while (offset < array_size(chunk->code)) { |
@@ -56,6 +56,7 @@ disassemble_chunk(Chunk *chunk, const char *name) { | |||
56 | printf("\n"); | 56 | printf("\n"); |
57 | offset++; | 57 | offset++; |
58 | } | 58 | } |
59 | printf("\n"); | ||
59 | } | 60 | } |
60 | 61 | ||
61 | size_t | 62 | size_t |