diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2024-07-09 00:45:02 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2024-07-09 00:45:02 +0200 |
commit | fdfdcd49bb4fa32572ec9708779dab2a20cebd90 (patch) | |
tree | 7d662c385b05d882cf19635d0b8030aee8849642 /bxgen.c | |
parent | 8bc7b2f0318db2cc0f00a90e52604169086ed66f (diff) | |
download | bxgen-fdfdcd49bb4fa32572ec9708779dab2a20cebd90.zip |
Decoding string table
Diffstat (limited to 'bxgen.c')
-rwxr-xr-x | bxgen.c | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -858,12 +858,33 @@ void unit_write(Pool *pool, i64 unit, u16 target, i64 io_out, void *io_user_data // Skip file // + printf("String table\n\n"); + i64 byte_count = atoi(size); if ((byte_count & 1) == 1) ++byte_count; // align - n = io_seek(f, byte_count, IO_SEEK_CURSOR, io_user_data); if (n == 0) break; - current_offset += n; + b8 has_line = 0; + + while (byte_count > 0) { + c8 c; + n = io_read(f, 1, &c, io_user_data); if (n == 0) break; + current_offset += n; + byte_count -= n; + if (c == '\0') { + if (has_line) { + printf("\n"); + has_line = 0; + } + } else { + if (c == '/') { + if (!has_line) + printf("<EMPTY>"); + } else + printf("%c", c); + has_line = 1; + } + } } else { if (strstr(id, "/") != NULL) *strstr(id, "/") = '\0'; |