Changed extension from hexb to hbx.
h3rald h3rald@h3rald.com
Tue, 17 Dec 2024 15:31:12 +0100
2 files changed,
12 insertions(+),
2 deletions(-)
M
.gitignore
→
.gitignore
@@ -54,7 +54,7 @@ # Exe names
hex # Other -*.hexb +*.hbx src/hex.c example.hex web/out/
M
src/main.c
→
src/main.c
@@ -356,6 +356,16 @@ position.column = 1;
position.line = 1 + ctx.hashbang; position.filename = file; int open_quotations = 0; + char *bytecode_file = strdup(file); + char *ext = strrchr(bytecode_file, '.'); + if (ext != NULL) + { + strcpy(ext, ".hbx"); + } + else + { + strcat(bytecode_file, ".hbx"); + } if (hex_bytecode(&ctx, fileContent, &bytecode, &bytecode_size, &position, &open_quotations) != 0) { hex_error(&ctx, "Failed to generate bytecode");@@ -366,7 +376,7 @@ {
hex_error(&ctx, "File contains unbalanced quotations"); return 1; } - if (hex_write_bytecode_file(&ctx, strcat(file, "b"), bytecode, bytecode_size) != 0) + if (hex_write_bytecode_file(&ctx, bytecode_file, bytecode, bytecode_size) != 0) { return 1; }