diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-21 23:23:37 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-21 23:23:37 +0100 |
commit | 44a9a3ca464f0bf24b0da2c0a6f106678dc67d52 (patch) | |
tree | d11b0c92f71bda588dc1c5277b7286f8ef0922db /src/inst.h | |
parent | 903ae3ab04eda63df286bbb32fe83603ffbbd0e0 (diff) | |
download | ovm-44a9a3ca464f0bf24b0da2c0a6f106678dc67d52.tar.gz ovm-44a9a3ca464f0bf24b0da2c0a6f106678dc67d52.tar.bz2 ovm-44a9a3ca464f0bf24b0da2c0a6f106678dc67d52.zip |
Helper functions for read/write instructions from darr or FILE*
Diffstat (limited to 'src/inst.h')
-rw-r--r-- | src/inst.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -57,10 +57,15 @@ void inst_print(inst_t, FILE *); size_t inst_bytecode_size(inst_t); void inst_write_bytecode(inst_t, darr_t *); +void insts_write_bytecode(inst_t *, size_t, darr_t *); // Here the dynamic array is a preloaded buffer of bytes, where // darr.available is the number of overall bytes and used is the // cursor (where we are in the buffer). inst_t inst_read_bytecode(darr_t *); +inst_t *insts_read_bytecode(darr_t *, size_t *); + +void insts_write_bytecode_file(inst_t *, size_t, FILE *); +inst_t *insts_read_bytecode_file(FILE *, size_t *); #define INST_BPUSH(BYTE) \ ((inst_t){.opcode = OP_PUSH_BYTE, .operand = DBYTE(BYTE)}) |