Skip to content

Commit

Permalink
rename DtMachine variable in main.zig
Browse files Browse the repository at this point in the history
  • Loading branch information
booniepepper authored Nov 17, 2023
1 parent b97a476 commit b6145b5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();

var machine = try DtMachine.init(arena.allocator());
var dt = try DtMachine.init(arena.allocator());

try builtins.defineAll(&machine);
try machine.loadFile(stdlib);
try machine.loadFile(dtlib);
try builtins.defineAll(&dt);
try dt.loadFile(stdlib);
try dt.loadFile(dtlib);

const stdinPiped = !std.io.getStdIn().isTty();
const stdoutPiped = !std.io.getStdOut().isTty();
Expand All @@ -33,19 +33,19 @@ pub fn main() !void {

if (firstArgMaybe) |firstArg| {
if (try readShebangFile(arena.allocator(), firstArg)) |fileContents| {
return machine.loadFile(fileContents) catch |e| return doneOrDie(&machine, e);
return dt.loadFile(fileContents) catch |e| return doneOrDie(&dt, e);
} else if ((std.mem.eql(u8, firstArg, "--stream") or std.mem.startsWith(u8, firstArg, "--stream ")) and (stdinPiped or stdoutPiped)) {
return handlePipedStdoutOnly(&machine);
return handlePipedStdoutOnly(&dt);
}
}

if (stdinPiped) {
return handlePipedStdin(&machine);
return handlePipedStdin(&dt);
} else if (stdoutPiped) {
return handlePipedStdoutOnly(&machine);
return handlePipedStdoutOnly(&dt);
}

return readEvalPrintLoop(&machine);
return readEvalPrintLoop(&dt);
}

fn readFirstArg(allocator: Allocator) !?[]const u8 {
Expand Down

0 comments on commit b6145b5

Please sign in to comment.