From f7a5e4f52c529a74ca0e4ec5a269c4d594990802 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 12 Jun 2022 21:47:52 +0200 Subject: Refactored io functions handling --- src/main.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index 3bdf68d..6962c37 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,6 +1,7 @@ const std = @import("std"); const field = @import("field.zig"); const interpreter = @import("interpreter.zig"); +const io = @import("io.zig"); const pointer = @import("pointer.zig"); const stackStack = @import("stackStack.zig"); @@ -17,7 +18,7 @@ pub fn main() anyerror!void { var file = try std.fs.cwd().openFile("mycology/sanity.bf", .{}); defer file.close(); - var i = try interpreter.Interpreter.init(gpa.allocator(), file.reader(), null, args); + var i = try interpreter.Interpreter.init(gpa.allocator(), file.reader(), io.defaultFunctions, args); defer i.deinit(); std.os.exit(@intCast(u8, try i.run())); @@ -30,7 +31,7 @@ test "sanity" { var file = try std.fs.cwd().openFile("mycology/sanity.bf", .{}); defer file.close(); const args = [_][]const u8{"sanity"}; - var i = try interpreter.Interpreter.init(std.testing.allocator, file.reader(), null, args[0..]); + var i = try interpreter.Interpreter.init(std.testing.allocator, file.reader(), io.defaultFunctions, args[0..]); defer i.deinit(); try std.testing.expectEqual(try i.run(), 0); } -- cgit v1.2.3