all repos — hex @ bb80f31447c5d10ec933979d3aa7d3f558f13f89

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

Changed extension from hexb to hbx.
h3rald h3rald@h3rald.com
Tue, 17 Dec 2024 15:31:12 +0100
commit

bb80f31447c5d10ec933979d3aa7d3f558f13f89

parent

0636af424dcf67183bede5870f4c91586e3e86a5

2 files changed, 12 insertions(+), 2 deletions(-)

jump to
M .gitignore.gitignore

@@ -54,7 +54,7 @@ # Exe names

hex # Other -*.hexb +*.hbx src/hex.c example.hex web/out/
M src/main.csrc/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; }