aboutsummaryrefslogtreecommitdiff
path: root/src/inst.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/inst.h')
-rw-r--r--src/inst.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/inst.h b/src/inst.h
index 3c77a86..7fed8e1 100644
--- a/src/inst.h
+++ b/src/inst.h
@@ -13,7 +13,10 @@
#ifndef INST_H
#define INST_H
+#include <stdlib.h>
+
#include "./base.h"
+#include "./darr.h"
typedef enum
{
@@ -57,6 +60,13 @@ typedef struct
data_t operand;
} inst_t;
+size_t inst_bytecode_size(inst_t);
+void inst_write_bytecode(inst_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 *);
+
#define INST_BPUSH(BYTE) \
((inst_t){.opcode = OP_PUSH_BYTE, .operand = DBYTE(BYTE)})