From 0bf0375200d28e558f036103b9a19976f8d45872 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 3 Dec 2022 14:44:50 +0100 Subject: Began writing a debugging tui --- src/interpreter.zig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/interpreter.zig') diff --git a/src/interpreter.zig b/src/interpreter.zig index 760e008..51a542e 100644 --- a/src/interpreter.zig +++ b/src/interpreter.zig @@ -13,6 +13,12 @@ pub const Interpreter = struct { self.field.deinit(); self.allocator.destroy(self); } + pub inline fn getField(self: *Interpreter) *field.Field { + return self.field; + } + pub inline fn getPointer(self: *Interpreter) *pointer.Pointer { + return self.pointer; + } pub fn init(allocator: std.mem.Allocator, fileReader: anytype, timestamp: ?i64, args: []const []const u8, env: []const [*:0]const u8) !*Interpreter { var i = try allocator.create(Interpreter); errdefer allocator.destroy(i); @@ -34,6 +40,16 @@ pub const Interpreter = struct { } } } + pub fn step(self: *Interpreter, ioContext: anytype) !?i64 { + if (try self.pointer.exec(ioContext)) |ret| { + if (ret.code) |code| { + return code; + } else { + return 0; + } + } + return null; + } }; test "all" { -- cgit v1.2.3