aboutsummaryrefslogtreecommitdiff
path: root/src/interpreter.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/interpreter.zig')
-rw-r--r--src/interpreter.zig10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/interpreter.zig b/src/interpreter.zig
index 5702336..1ab07c9 100644
--- a/src/interpreter.zig
+++ b/src/interpreter.zig
@@ -8,14 +8,18 @@ pub const Interpreter = struct {
pointer: *pointer.Pointer,
pub fn deinit(self: *Interpreter) void {
+ self.pointer.deinit();
+ self.field.deinit();
self.allocator.destroy(self);
}
- pub fn init(allocator: std.mem.Allocator, f: *field.Field, p: *pointer.Pointer) !*Interpreter {
+ pub fn init(allocator: std.mem.Allocator, reader: anytype, ioFunctions: ?pointer.IOFunctions, args: []const []const u8) !*Interpreter {
var i = try allocator.create(Interpreter);
errdefer allocator.destroy(i);
i.allocator = allocator;
- i.field = f;
- i.pointer = p;
+ i.field = try field.Field.init_from_reader(allocator, reader);
+ errdefer i.field.deinit();
+ i.pointer = try pointer.Pointer.init(std.testing.allocator, i.field, ioFunctions, args);
+ errdefer i.pointer.deinit();
return i;
}
pub fn run(self: *Interpreter) !i64 {