diff options
author | Julien Dessaux | 2022-12-03 14:44:50 +0100 |
---|---|---|
committer | Julien Dessaux | 2022-12-03 15:07:57 +0100 |
commit | 0bf0375200d28e558f036103b9a19976f8d45872 (patch) | |
tree | 91dd1e3ddc0e3fa965e867e628eebdac42d78f2c /src/interpreter.zig | |
parent | Fixed bugs from zig 0.10 upgrade (some real!) (diff) | |
download | zigfunge98-0bf0375200d28e558f036103b9a19976f8d45872.tar.gz zigfunge98-0bf0375200d28e558f036103b9a19976f8d45872.tar.bz2 zigfunge98-0bf0375200d28e558f036103b9a19976f8d45872.zip |
Began writing a debugging tui
Diffstat (limited to '')
-rw-r--r-- | src/interpreter.zig | 16 |
1 files changed, 16 insertions, 0 deletions
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" { |