wip: working on extern in VM

- Feat: add writer externs writing fns
- Feat: add VM reader functions
This commit is contained in:
samsonium
2026-11-05 21:48:40 +03:00
parent 84572edb0d
commit 1db42c1e8e
17 changed files with 608 additions and 16 deletions
+29
View File
@@ -0,0 +1,29 @@
#include <stdbool.h>
#include <stdint.h>
#include <vm/internals/reader.h>
// Reader sizes section
bool vm_rd_sections_sz(fzl_vm_reader_t *reader, FILE *fd)
{
if (!reader || !fd)
return false;
bool ok = vm_rd_u16(fd, 1, (uint16_t *)&reader->consts_count);
if (!ok)
return false;
ok = vm_rd_u16(fd, 1, &reader->extern_libs_count);
if (!ok)
return false;
ok = vm_rd_u16(fd, 1, &reader->extern_types_count);
if (!ok)
return false;
ok = vm_rd_u16(fd, 1, &reader->extern_fns_count);
if (!ok)
return false;
ok = vm_rd_word(fd, 1, &reader->ops_count);
return ok;
}